Re: more non-PIC static libs in shared libs
On Sun, Feb 02, 2003 at 12:44:35AM +0100, Daniel Kobras wrote:
> [Sorry, took me a while to get back to this issue.]
>
> On Mon, Jan 13, 2003 at 10:09:39AM -0500, Daniel Jacobowitz wrote:
> > The question is what relocations the assembly uses. Looking at the
> > linker... if there are any relocations in .rel.dyn which apply to
> > read-only sections, i.e. .text usually, then the library is
> > inadequately PIC. Are you branching to externally visible functions
> > from assembly without using the GOT? Take a look through .rel.dyn; see
> > if you can find the problem relocations by their offsets, and post the
> > affected assembly code.
>
> The assembly does all kinds of weird stuff: jumping to .text symbols,
> referencing .rodata symbols. But even when I discarded all references
> to read-only symbols from the asm, the lib still was flagged as TEXTREL.
> There are still lots of relocations to read-write symbols in .data and
> .bss. They end up as R_386_32 relocations. Am I right in assuming that
> I'd have to clean those up as well?
I believe so; the only references allowed are pc-relative. You should
look at gcc-generated PIC code to get a feel for what you can do.
R_386_RELATIVE is PIC; R_386_32 is not, I think. R_386_JUMP_SLOT is.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
Reply to: