On Tue, Aug 29, 2006 at 01:16:40AM +0200, Michael Biebl wrote: > Matthew Palmer wrote: > > More important than the linker command line is the compilation command > > line. > > You need to make sure that all of the source files that make up those .so > > files were built with -fPIC in their command lines. > > thanks for your advice but it seems that they all are built with -fPIC. > > Any other ideas?
If you really compile all your files with -fPIC and you still got text
relocations, you should check for assembly code.
-fPIC tells gcc to produce position independent code, however with
asm code you write yourself gcc can't help you. It's pretty easy to
write non-pic asm code if you don't know exactly what you're doing.
If you got your TEXTREL's because of asm code that's probably
fixable, but requires some asm knowledge.
Btw, text relocations are suboptimal on i386 too, they just don't
cause segfaults, as it's possible on other archs. [1]
Cheers,
Christian Aichinger
[1]: Normally when your library is loaded by 20 programs the code is
present only once in physical memory, the kernel just maps it
to different addresses in every program.
With text relocations your code is modified during dynamic
linking (i.e. when the lib is loaded). This means that the
resulting code looks different every time it's loaded and the
kernel can't share the pages.
signature.asc
Description: Digital signature

