This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Supprt DF_TEXTREL/DT_TEXTREL for SVR4 mips


This patch is needed for building DSOs with relocations to read-only
sections.



H.J.
-----
2001-06-15  H.J. Lu  <hjl@gnu.org>

	* elf32-mips.c (_bfd_mips_elf_check_relocs): Record DF_TEXTREL
	if there is a relocation against a read-only section in a DSO.
	(_bfd_mips_elf_size_dynamic_sections): Set DT_TEXTREL if
	DF_TEXTREL is set.

--- bfd/elf32-mips.c.rodata	Fri Jun 15 16:38:16 2001
+++ bfd/elf32-mips.c	Fri Jun 15 20:10:05 2001
@@ -7883,11 +7883,17 @@ _bfd_mips_elf_check_relocs (abfd, info, 
 		    }
 		}
 	      if (info->shared)
-		/* When creating a shared object, we must copy these
-		   reloc types into the output file as R_MIPS_REL32
-		   relocs.  We make room for this reloc in the
-		   .rel.dyn reloc section.  */
-		mips_elf_allocate_dynamic_relocations (dynobj, 1);
+		{
+		  /* When creating a shared object, we must copy these
+		     reloc types into the output file as R_MIPS_REL32
+		     relocs.  We make room for this reloc in the
+		     .rel.dyn reloc section.  */
+		  mips_elf_allocate_dynamic_relocations (dynobj, 1);
+		  if ((sec->flags & SEC_READONLY) != 0)
+		    /* We tell the dynamic linker that there are
+		       relocations against the text segment.  */
+		    info->flags |= DF_TEXTREL;
+		}
 	      else
 		{
 		  struct mips_elf_link_hash_entry *hmips;
@@ -8493,11 +8499,14 @@ _bfd_mips_elf_size_dynamic_sections (out
 		return false;
 	    }
 	}
+
       if (reltext && SGI_COMPAT (output_bfd))
+	info->flags |= DF_TEXTREL;
+
+      if ((info->flags & DF_TEXTREL) != 0)
 	{
 	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
 	    return false;
-	  info->flags |= DF_TEXTREL;
 	}
 
       if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]