2.10.91: elf32-mips.c changes for ABI conformance

Maciej W. Rozycki macro@ds2.pg.gda.pl
Fri Jan 19 12:55:00 GMT 2001


Hi,

 I sent the patch several weeks ago.  I have no idea why it didn't get
applied.

bfd/ChangeLog:

2001-01-18  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* elf32-mips.c (mips_elf_create_dynamic_relocation): Undo patch
	from 2000-10-13.  Do not add the symbol's value for R_MIPS_REL32
	relocations against dynsym symbols.

  Maciej

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

binutils-2.10.91-20010116-mips-dyn-addend.patch
diff -up --recursive --new-file binutils.macro/bfd/elf32-mips.c binutils/bfd/elf32-mips.c
--- binutils.macro/bfd/elf32-mips.c	Wed Dec 13 04:26:02 2000
+++ binutils/bfd/elf32-mips.c	Thu Jan 18 22:24:41 2001
@@ -193,7 +193,7 @@ static bfd_vma mips_elf_got16_entry
 static boolean mips_elf_create_dynamic_relocation
   PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
 	   struct mips_elf_link_hash_entry *, asection *,
-	   bfd_vma, bfd_vma *, asection *, boolean local_p));
+	   bfd_vma, bfd_vma *, asection *));
 static void mips_elf_allocate_dynamic_relocations
   PARAMS ((bfd *, unsigned int));
 static boolean mips_elf_stub_section_p
@@ -5748,7 +5748,7 @@ mips_elf_next_relocation (r_type, reloca
 
 static boolean
 mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
-				    symbol, addendp, input_section, local_p)
+				    symbol, addendp, input_section)
      bfd *output_bfd;
      struct bfd_link_info *info;
      const Elf_Internal_Rela *rel;
@@ -5757,7 +5757,6 @@ mips_elf_create_dynamic_relocation (outp
      bfd_vma symbol;
      bfd_vma *addendp;
      asection *input_section;
-     boolean local_p;
 {
   Elf_Internal_Rel outrel;
   boolean skip;
@@ -5842,15 +5841,16 @@ mips_elf_create_dynamic_relocation (outp
 	  /* The relocation we're building is section-relative.
 	     Therefore, the original addend must be adjusted by the
 	     section offset.  */
-	  *addendp += symbol - sec->output_section->vma;
+	  *addendp += section_offset;
 	  /* Now, the relocation is just against the section.  */
 	  symbol = sec->output_section->vma;
 	}
 
-      /* If the relocation is against a local symbol was previously an
-	 absolute relocation, we must adjust it by the value we give
-	 it in the dynamic symbol table.  */
-      if (local_p && r_type != R_MIPS_REL32)
+      /* If the relocation was previously an absolute relocation and
+	 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)
 	*addendp += symbol;
 
       /* The relocation is always an REL32 relocation because we don't
@@ -6288,7 +6288,7 @@ mips_elf_calculate_relocation (abfd,
 						   sec,
 						   symbol,
 						   &value,
-						   input_section, local_p))
+						   input_section))
 	    return false;
 	}
       else



More information about the Binutils mailing list