Bug in ld 2.11.90.0.29

Alan Modra amodra@bigpond.net.au
Fri Sep 7 22:46:00 GMT 2001


Fixes an error in my 2001-06-27 change to avoid COPY relocs.  The bug
manifests itself as an abort in relocate_section when linking oracle.

	* elf32-i386.c (elf_i386_relocate_section): Check !DEF_REGULAR
	as well as DEF_DYNAMIC in test for avoided copy relocs.
	(allocate_plt_and_got_and_discard_relocs): Likewise.
	* elf32-i386.c (elf_i386_relocate_section): Likewise.
	(allocate_plt_and_got_and_discard_relocs): Likewise.

-- 
Alan Modra

Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.41
diff -u -p -r1.41 elf32-i386.c
--- elf32-i386.c	2001/08/27 18:04:37	1.41
+++ elf32-i386.c	2001/09/08 05:20:59
@@ -1213,7 +1213,8 @@ allocate_plt_and_got_and_discard_relocs 
 
   if (!info->shared
       && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-      && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+      && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+	   && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	  || (htab->root.dynamic_sections_created
 	      && (h->root.type == bfd_link_hash_undefweak
 		  || h->root.type == bfd_link_hash_undefined))))
@@ -1707,8 +1708,10 @@ elf_i386_relocate_section (output_bfd, i
 		  && h != NULL
 		  && h->dynindx != -1
 		  && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-		  && ((h->elf_link_hash_flags
-		       & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+		  && (((h->elf_link_hash_flags
+			& ELF_LINK_HASH_DEF_DYNAMIC) != 0
+		       && (h->elf_link_hash_flags
+			   & ELF_LINK_HASH_DEF_REGULAR) == 0)
 		      || h->root.type == bfd_link_hash_undefweak
 		      || h->root.type == bfd_link_hash_undefined)))
 	    {
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.42
diff -u -p -r1.42 elf32-hppa.c
--- elf32-hppa.c	2001/08/03 05:10:39	1.42
+++ elf32-hppa.c	2001/09/08 05:21:02
@@ -2140,7 +2140,8 @@ allocate_plt_and_got_and_discard_relocs 
   /* First handle the non-shared case.  */
   if (!info->shared
       && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-      && ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+      && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+	   && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
 	  || (hplink->root.dynamic_sections_created
 	      && (h->root.type == bfd_link_hash_undefweak
 		  || h->root.type == bfd_link_hash_undefined))))
@@ -3899,11 +3900,11 @@ elf32_hppa_relocate_section (output_bfd,
 	     (dynindx test in this case) to cater for relocs removed
 	     by hppa_discard_copies.  If you squint, the non-shared
 	     test here does indeed match the one in check_relocs, the
-	     difference being that here we test DEF_DYNAMIC rather
-	     than a maybe-DEF_DYNAMIC via !DEF_REGULAR.  Common syms
-	     end up with !DEF_REGULAR, which is why we can't use that
-	     here.  Conversely, DEF_DYNAMIC can't be used in
-	     check_relocs as there all files have not been loaded.  */
+	     difference being that here we test DEF_DYNAMIC as well as
+	     !DEF_REGULAR.  All common syms end up with !DEF_REGULAR,
+	     which is why we can't use just that test here.
+	     Conversely, DEF_DYNAMIC can't be used in check_relocs as
+	     there all files have not been loaded.  */
 	  if ((info->shared
 	       && (input_section->flags & SEC_ALLOC) != 0
 	       && (IS_ABSOLUTE_RELOC (r_type)
@@ -3917,8 +3918,10 @@ elf32_hppa_relocate_section (output_bfd,
 		  && h != NULL
 		  && h->elf.dynindx != -1
 		  && (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
-		  && ((h->elf.elf_link_hash_flags
-		       & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+		  && (((h->elf.elf_link_hash_flags
+			& ELF_LINK_HASH_DEF_DYNAMIC) != 0
+		       && (h->elf.elf_link_hash_flags
+			   & ELF_LINK_HASH_DEF_REGULAR) == 0)
 		      || h->elf.root.type == bfd_link_hash_undefweak
 		      || h->elf.root.type == bfd_link_hash_undefined)))
 	    {



More information about the Binutils mailing list