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

Re: shlib-with-non-pic-code



On Tue, Aug 29, 2006 at 08:59:19AM +0200, Mike Hommey wrote:
> Now, it seems the involved code doesn't set visibility. The best for
> Michael to do is to grep PLT in the generated assembler code and check
> what can be generating those.

Searching for PLT won't help, you won't find text relocations that
way.

Text relocations result when library code assumes that itself or
other libraries are loaded at specific addresses. 

However PLT/GOT is a mechanism to make binaries/libraries
independent of their load addresses, i.e. to avoid text relocations
in the first place.


What I'd recommend is compiling the library with debug symbols and
running `readelf -r «lib»`. You're looking for R_386_RELATIVE,
R_386_32 and R_386_PC32. The relocation is performed at "Offset"
(first column displayed by readelf), so that's the address you have
to investigate. `addr2line` may help here.

If you got a ton of those relocations, you're probably missing -fPIC
somewhere. If you have 10 or 20, it's probably something more subtle
(like carelessly written asm code).

Michael, if you put the source package online somewhere I'll take a
look and see if I can help with this.

Cheers,
Christian Aichinger

Attachment: signature.asc
Description: Digital signature


Reply to: