On Tuesday 03 June 2003 23:05, Frank Van Damme wrote: > ...which brings up the question: wtf is PIC? :)
[P]osition [I]ndependant [C]ode. On x86 it is a little bit slower than normal code since the data section is accessed using the ebx register as index. The result is that the compiler has less possibilities to optimize the code since one general register is reserved. Therefore there exist two versions of libaries: Static libraries don't need PIC code since the position (and therefore the position of the data segment) is know at link time, that is compile time. And shared libraries, which are linked at runtime and therefore has to be PIC. Note that it would be possible to use non-PIC code for shared libraries by simply relocating all symbols accessing data. But that would lead to patching the code segment which would make it impossible to share the same library between different address spaces (at least with ELF). Frank -- ## Dept. of Computer Science, Dresden University of Technology, Germany ## ## http://os.inf.tu-dresden.de/~fm3 ##
pgp37TTX8OT5X.pgp
Description: signature