PIC is wasteful
Andrew Haley
aph@redhat.com
Fri Jun 24 10:39:00 GMT 2011
On 24/06/11 09:09, Agner Fog wrote:
>
> When I compile with -fno-exceptions I don't get this error, but instead
> I get:
>
> relocation R_X86_64_32 against `a local symbol' can not be used when
> making a shared object; recompile with -fPIC
>
> This 'local symbol' is my function in section .eh_frame. Why does it
> make .eh_frame when I turn off exception handling?
It's an ABI requirement for thread cancellation.
> A further problem in 64 bit mode is that even though I compile with
> -mcmodel=medium, I get:
>
> relocation R_X86_64_32 against `VariableName' can not be used when
> making a shared object; recompile with -fPIC
>
> Why does it make 32 bit absolute addresses when I specify
> -mcmodel=medium?
Small symbols are placed in the lower 2G.
Andrew.
More information about the Gcc-help
mailing list