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]

Re: binutils is broken


On Tue, Oct 02, 2001 at 01:40:18PM -0700, H . J . Lu wrote:
> Hi Alan,
> 
> Your patch
> 
> http://sources.redhat.com/ml/binutils/2001-09/msg00460.html
> 
> breaks binutils. Now "make check" in glibc failed on i386 at
> timezone/tst-timezone.out.
> 
> 

Here is the relevant change which breaks ld. The problem is the generic
linker also sets ELF_LINK_NON_GOT_REF in elf_fix_symbol_flags. Now with
your change, it is simply ignored. Could you please fix it?

Thanks.


H.J.
----
--- elf32-i386.c.weak	Tue Oct  2 13:19:46 2001
+++ elf32-i386.c	Tue Oct  2 14:35:21 2001
@@ -44,9 +44,6 @@ static boolean create_got_section
   PARAMS((bfd *, struct bfd_link_info *));
 static boolean elf_i386_create_dynamic_sections
   PARAMS((bfd *, struct bfd_link_info *));
-static void
-elf_i386_copy_indirect_symbol
-  PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
 static boolean elf_i386_check_relocs
   PARAMS ((bfd *, struct bfd_link_info *, asection *,
 	   const Elf_Internal_Rela *));
@@ -627,28 +624,6 @@ elf_i386_create_dynamic_sections (dynobj
   return true;
 }
 
-/* Copy the extra info we tack onto an elf_link_hash_entry.  */
-
-void
-elf_i386_copy_indirect_symbol (dir, ind)
-     struct elf_link_hash_entry *dir, *ind;
-{
-  struct elf_i386_link_hash_entry *edir, *eind;
-
-  edir = (struct elf_i386_link_hash_entry *) dir;
-  eind = (struct elf_i386_link_hash_entry *) ind;
-
-  if (edir->dyn_relocs == NULL)
-    {
-      edir->dyn_relocs = eind->dyn_relocs;
-      eind->dyn_relocs = NULL;
-    }
-  else if (eind->dyn_relocs != NULL)
-    abort ();
-
-  _bfd_elf_link_hash_copy_indirect (dir, ind);
-}
-
 /* Look through the relocs for a section during the first phase, and
    allocate space in the global offset table or procedure linkage
    table.  */
@@ -777,12 +752,9 @@ elf_i386_check_relocs (abfd, info, sec, 
 	  if (h != NULL && !info->shared)
 	    {
 	      /* If this reloc is in a read-only section, we might
-		 need a copy reloc.  We can't check reliably at this
-		 stage whether the section is read-only, as input
-		 sections have not yet been mapped to output sections.
-		 Tentatively set the flag for now, and correct in
-		 adjust_dynamic_symbol.  */
-	      h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+		 need a copy reloc.  */
+	      if ((sec->flags & SEC_READONLY) != 0)
+		h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
 
 	      /* We may need a .plt entry if the function this reloc
 		 refers to is in a shared lib.  */
@@ -824,6 +796,7 @@ elf_i386_check_relocs (abfd, info, sec, 
 	      || (!info->shared
 		  && (sec->flags & SEC_ALLOC) != 0
 		  && h != NULL
+		  && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
 		  && (h->root.type == bfd_link_hash_defweak
 		      || (h->elf_link_hash_flags
 			  & ELF_LINK_HASH_DEF_REGULAR) == 0)))
@@ -1085,8 +1058,6 @@ elf_i386_adjust_dynamic_symbol (info, h)
 {
   struct elf_i386_link_hash_table *htab;
   bfd *dynobj;
-  struct elf_i386_link_hash_entry * eh;
-  struct elf_i386_dyn_relocs *p;
   asection *s;
   unsigned int power_of_two;
 
@@ -1132,6 +1103,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
 		  || h->weakdef->root.type == bfd_link_hash_defweak);
       h->root.u.def.section = h->weakdef->root.u.def.section;
       h->root.u.def.value = h->weakdef->root.u.def.value;
+      return true;
     }
 
   /* This is a reference to a symbol defined by a dynamic object which
@@ -1149,22 +1121,6 @@ elf_i386_adjust_dynamic_symbol (info, h)
   if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
     return true;
 
-  eh = (struct elf_i386_link_hash_entry *) h;
-  for (p = eh->dyn_relocs; p != NULL; p = p->next)
-    {
-      s = p->sec->output_section;
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
-	break;
-    }
-
-  /* If we didn't find any dynamic relocs in read-only sections, then
-     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */ 
-  if (p == NULL)
-    {
-      h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
-      return true;
-    }
-
   /* We must allocate the symbol in our .dynbss section, which will
      become part of the .bss section of the executable.  There will be
      an entry for this symbol in the .dynsym section.  The dynamic
@@ -2411,7 +2367,6 @@ elf_i386_finish_dynamic_sections (output
 #define bfd_elf32_bfd_reloc_type_lookup	      elf_i386_reloc_type_lookup
 
 #define elf_backend_adjust_dynamic_symbol     elf_i386_adjust_dynamic_symbol
-#define elf_backend_copy_indirect_symbol      elf_i386_copy_indirect_symbol
 #define elf_backend_check_relocs	      elf_i386_check_relocs
 #define elf_backend_create_dynamic_sections   elf_i386_create_dynamic_sections
 #define elf_backend_finish_dynamic_sections   elf_i386_finish_dynamic_sections


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