Relocation bug

H. J. Lu hjl@lucon.org
Sat Feb 22 01:41:00 GMT 2003


Can you try this patch?


H.J.
--- elfxx-mips.c.local	Thu Jan 23 09:23:27 2003
+++ elfxx-mips.c	Fri Feb 21 17:38:42 2003
@@ -3016,7 +3016,7 @@ mips_elf_create_dynamic_relocation (outp
 	 this symbol will not be referred to by the relocation, we must
 	 adjust it by the value we give it in the dynamic symbol table.
 	 Otherwise leave the job up to the dynamic linker.  */
-      if (!indx && r_type != R_MIPS_REL32)
+      if ((!h || !indx) && r_type != R_MIPS_REL32)
 	*addendp += symbol;
 
       /* The relocation is always an REL32 relocation because we don't

On Sat, Feb 22, 2003 at 01:04:09AM +0100, Ralf Baechle wrote:
> Hi Hongjiu,
> 
> a while ago we introduced a linker bug.  The bug got introduced between
> binutils 2.10 and 2.11.  This is what happened:
> 
> Have you noticed that GNU binutils will produce different linker output from
> the IRIX tools and from older binutils for the following small testcase:
> 
> foo:    .word   foo + 0x1234
> 
> This is what a somewhat older linker and the IRIX tools are making from it:
> 
> objdump -h libs.so | fgrep .data
>   6 .data         00000010  00000000600204e0  00000000600204e0  000004e0  2**4
> objdump --full-contents --section=.data libs.so
> 
> libs.so:     file format elf32-bigmips
> 
> Contents of section .data:
>  600204e0 60021714 00000000 00000000 00000000  `...............
>           ^^^^^^^^
> So the content here is .data + 0x1234, as it is supposed to be.
> 
> And this is a more recent linker:
> 
> [ralf@dea libc]$ mips-linux-objdump -h libs.so | fgrep .data
> [ralf@dea libc]$ mips-linux-objdump --full-contents --section=.data s.so
> 
> s.so:     file format elf32-tradbigmips
> 
> Contents of section .data:
>  40400 00001234 00000000 00000000 00000000  ...4............
> 
> That's pretty annoying, there are third party tool chains affected (I'm
> currently waiting for more info).  Also there are still parties shipping
> glibc 2.0.6 in fairly large quantities, for example Sony's Playstation 2
> Linux kit.  So we've got two Linux flavours in circulation, we've broken
> the linker for o32 IRIX ELF and MIPS ABI ELF.
> 
>   Ralf



More information about the Binutils mailing list