Re: relocatable code and object files and shared libraries

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

 



Ian Lance Taylor wrote:
This is talking about position independent code, which is not the same
as relocatable code.  Relocatable code is code whose address may be
assigned at link time.  Position independent code is code whose
address may be assigned at run time.
It is more understandable to think of that as load time, rather than run time, and to think of it in terms of efficiency rather than absolute can/can't.

Many kinds of relocation cannot be used in PIC code even though they can be adjusted at load time. Other kinds of relocation can be used in PIC code even though they require adjustments at load time.
All object files are relocatable.  For most targets, only object files
compiled with -fpic or -fPIC or -pie are position independent.
On most platforms, few if any shared objects are truly position independent. They need to be adjusted for position at load time.

-fPIC may make some constructs truly position independent, for which the most efficient code would require link time adjustment.

-fPIC mainly clusters the load time adjustments together to reduce the performance and security consequences of the load time adjustment process, where the most efficient code would require link and/or load time adjustments distributed through the code segment.


[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