Relocation bug

Maciej W. Rozycki macro@ds2.pg.gda.pl
Mon Feb 24 15:13:00 GMT 2003


On Mon, 24 Feb 2003, Ralf Baechle wrote:

> > > [ralf@dea b0rked]$ mips-linux-objdump --full-contents --section=.data s.so 
> > > 
> > > s.so:     file format elf32-tradbigmips
> > > 
> > > Contents of section .data:
> > >  40410 00041644 00000000 00000000 00000000  ...D............
> > >        ^^^^^^^^
> > > 
> > > Which is the address of .data plus 0x1234.
> > 
> > Hmm, if you do this then I think you should be using symbol index zero
> > in the relocation too.
> 
> I believe you're right, this is a little bug, too.

 Note that by using symbol index zero in the relocation you make currently
ld.so magically work out of the box.  I've already pointed this case out
to you -- for R_MIPS_REL32 relocations both ones relative to external
symbols and absolute ones are interpreted consistently across
implementations. 

> Anyway I think you poked my nose at something interesting.  All flavours
> of the GNU libc dynamic linker I know of are properly treating R_MIPS_REL32
> with a symbol index of zero.  I've not checked the BSDs but I bet it's the
> same there.  That opens an elegant way out of how to fix the relocation
> thing with as little breaking of binaries as possible.  Fix binutils to emit
> the relocs with symbol index zero and the difference between old binaries
> and current binaries will eventually fade away - without touching dynamic
> linkers.

 Hmm, you weren't interested in this option previously, strange...

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +



More information about the Binutils mailing list