Re: PIC is wasteful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Agner Fog <agner@xxxxxxxxx> writes:

> Thanks for the tip about -Bsymbolic, that's what I want, but it
> doesn't seem to do the job.
> When I compile with -Bsymbolic -fpic I still get a GOT entry in 64 bit mode.

-Bsymbolic is a linker option.  -fpic is a compiler option.  To disable
all GOT entries, you have to tell the compiler to not use them;
-Bsymbolic does not do that.  For that you want -fvisibility=protected.
If you consistently use -fvisibility=protected, then I'm not sure that
-Bsymbolic adds anything.


> This 'local symbol' is my function in section .eh_frame. Why does it
> make .eh_frame when I turn off exception handling?

The x86_64 ABI requires creating unwind tables so that stack unwinding
works, not just for exceptions but also for things like the libc
backtrace function.  To disable this you need to use not just
-fno-exceptions but also -fno-unwind-tables.


> 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? How can I force it to use full 64 bit addresses or 32
> bit relative addresses without specifying -fpic?

-mcmodel=medium puts "small" data objects in the low order 32 bits.  To
avoid any such assumptions, use -mcmodel=large.  This is all documented.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux