Module Name:    src
Committed By:   matt
Date:           Sat Sep  5 03:10:39 UTC 2009

Modified Files:
        src/gnu/dist/binutils/bfd [matt-nb5-mips64]: elfxx-mips.c

Log Message:
Fix BFD to understand that R_MIPS_GPREL32 with R_MIPS_64 will not require text
section modifications and thus you don't have to set the shared image as being
DT_TEXTREL.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.32.1 src/gnu/dist/binutils/bfd/elfxx-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/gnu/dist/binutils/bfd/elfxx-mips.c
diff -u src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3 src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3.32.1
--- src/gnu/dist/binutils/bfd/elfxx-mips.c:1.1.1.3	Thu Feb  2 20:47:51 2006
+++ src/gnu/dist/binutils/bfd/elfxx-mips.c	Sat Sep  5 03:10:39 2009
@@ -6135,11 +6135,25 @@
 		     relocs.  We make room for this reloc in the
 		     .rel.dyn reloc section.  */
 		  mips_elf_allocate_dynamic_relocations (dynobj, 1);
-		  if ((sec->flags & MIPS_READONLY_SECTION)
-		      == MIPS_READONLY_SECTION)
-		    /* We tell the dynamic linker that there are
-		       relocations against the text segment.  */
-		    info->flags |= DF_TEXTREL;
+		  /* In the N32 and 64-bit ABIs there may be multiple
+		     consecutive relocations for the same offset.  If we have
+		     a R_MIPS_GPREL32 followed by a R_MIPS_64 then that
+		     relocation is complete and needs no futher adjustment.  */
+		  if ((rel == relocs
+		      || rel[-1].r_offset != rel->r_offset
+		      || r_type != R_MIPS_64
+		      || ELF_R_TYPE(abfd, rel[-1].r_info) != R_MIPS_GPREL32)
+		      && (sec->flags & MIPS_READONLY_SECTION)
+			  == MIPS_READONLY_SECTION)
+		    {
+		      /* We tell the dynamic linker that there are
+		         relocations against the text segment.  */
+		      info->flags |= DF_TEXTREL;
+		      info->callbacks->warning
+			(info,
+			 _("relocation emitted against readonly section"),
+			 NULL, abfd, sec, rel->r_offset);
+		    }
 		}
 	      else
 		{

Reply via email to