* elfcode.h (elf_link_add_object_symbols): Permit common and
authorIan Lance Taylor <ian@airs.com>
Mon, 3 Jul 1995 17:57:25 +0000 (17:57 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 3 Jul 1995 17:57:25 +0000 (17:57 +0000)
indirect symbols in weakdefs BFD_ASSERT.
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Simplify
BFD_ASSERT to permit some legal, but odd, cases.
* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-sparc.c
bfd/elfcode.h

index 6cb306e..86de90a 100644 (file)
@@ -1,8 +1,9 @@
 Mon Jul  3 11:30:45 1995  Ian Lance Taylor  <ian@cygnus.com>
 
-       * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Correct
-       BFD_ASSERT to handle __start_SECNAME symbols automatically defined
-       by the linker.
+       * elfcode.h (elf_link_add_object_symbols): Permit common and
+       indirect symbols in weakdefs BFD_ASSERT.
+       * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Simplify
+       BFD_ASSERT to permit some legal, but odd, cases.
        * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
        * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
 
@@ -242,8 +243,6 @@ Wed May 24 10:52:01 1995  Steve Chamberlain  <sac@slash.cygnus.com>
        * linker.c (_bfd_generic_link_output_symbols): Cope with
        indirect symbols.
 
-       pr ld/6997
-
        * elf32-i386.c (elf_i386_relocate_section): Give error
        message when linking to a shared reloc which isn't there.
 
index 3d56995..1f8d4e9 100644 (file)
@@ -607,22 +607,14 @@ elf_i386_adjust_dynamic_symbol (info, h)
   dynobj = elf_hash_table (info)->dynobj;
 
   /* Make sure we know what is going on here.  */
-  BFD_ASSERT (dynobj != NULL);
-  BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
-             || ((h->elf_link_hash_flags
-                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_REF_REGULAR) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_DEF_REGULAR) == 0
-                 && (h->root.type == bfd_link_hash_defined
-                     || h->root.type == bfd_link_hash_defweak)
-                 && (h->root.u.def.section->owner == NULL
-                     || ((elf_elfheader (h->root.u.def.section->owner)->e_type
-                          == ET_DYN)
-                         && (bfd_get_flavour (h->root.u.def.section->owner)
-                             == bfd_target_elf_flavour)
-                         && h->root.u.def.section->output_section == NULL))));
+  BFD_ASSERT (dynobj != NULL
+             && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+                 || ((h->elf_link_hash_flags
+                      & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_REF_REGULAR) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later,
index 5ba6527..ed15b01 100644 (file)
@@ -581,22 +581,14 @@ elf_m68k_adjust_dynamic_symbol (info, h)
   dynobj = elf_hash_table (info)->dynobj;
 
   /* Make sure we know what is going on here.  */
-  BFD_ASSERT (dynobj != NULL);
-  BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
-             || ((h->elf_link_hash_flags
-                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_REF_REGULAR) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_DEF_REGULAR) == 0
-                 && (h->root.type == bfd_link_hash_defined
-                     || h->root.type == bfd_link_hash_defweak)
-                 && (h->root.u.def.section->owner == NULL
-                     || ((elf_elfheader (h->root.u.def.section->owner)->e_type
-                          == ET_DYN)
-                         && (bfd_get_flavour (h->root.u.def.section->owner)
-                             == bfd_target_elf_flavour)
-                         && h->root.u.def.section->output_section == NULL))));
+  BFD_ASSERT (dynobj != NULL
+             && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+                 || ((h->elf_link_hash_flags
+                      & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_REF_REGULAR) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later,
index 9bf032f..e44922c 100644 (file)
@@ -573,22 +573,14 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
   dynobj = elf_hash_table (info)->dynobj;
 
   /* Make sure we know what is going on here.  */
-  BFD_ASSERT (dynobj != NULL);
-  BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
-             || ((h->elf_link_hash_flags
-                  & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_REF_REGULAR) != 0
-                 && (h->elf_link_hash_flags
-                     & ELF_LINK_HASH_DEF_REGULAR) == 0
-                 && (h->root.type == bfd_link_hash_defined
-                     || h->root.type == bfd_link_hash_defweak)
-                 && (h->root.u.def.section->owner == NULL
-                     || ((elf_elfheader (h->root.u.def.section->owner)->e_type
-                          == ET_DYN)
-                         && (bfd_get_flavour (h->root.u.def.section->owner)
-                             == bfd_target_elf_flavour)
-                         && h->root.u.def.section->output_section == NULL))));
+  BFD_ASSERT (dynobj != NULL
+             && ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
+                 || ((h->elf_link_hash_flags
+                      & ELF_LINK_HASH_DEF_DYNAMIC) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_REF_REGULAR) != 0
+                     && (h->elf_link_hash_flags
+                         & ELF_LINK_HASH_DEF_REGULAR) == 0)));
 
   /* If this is a function, put it in the procedure linkage table.  We
      will fill in the contents of the procedure linkage table later
index 63b55f4..4c73825 100644 (file)
@@ -2261,32 +2261,35 @@ elf_sort_hdrs (arg1, arg2)
   const Elf_Internal_Shdr *hdr1 = *(const Elf_Internal_Shdr **) arg1;
   const Elf_Internal_Shdr *hdr2 = *(const Elf_Internal_Shdr **) arg2;
 
-#define TOEND(x) (((x)->sh_flags &  SHF_ALLOC)==0)
+#define TOEND(x) (((x)->sh_flags & SHF_ALLOC)==0)
 
-  if (TOEND(hdr1))
-    if (TOEND(hdr2))
+  if (TOEND (hdr1))
+    if (TOEND (hdr2))
       return 0;
     else 
       return 1;
 
-  if (TOEND(hdr2))
-       return -1;
+  if (TOEND (hdr2))
+    return -1;
 
-      if (hdr1->sh_addr < hdr2->sh_addr)
-       return -1;
-      else if (hdr1->sh_addr > hdr2->sh_addr)
-       return 1;
-      /* Put !SHT_NOBITS sections before SHT_NOBITS ones.
-         The main loop in map_program_segments requires this. */
-      ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
-      if (ret != 0)
-       return ret;
+  if (hdr1->sh_addr < hdr2->sh_addr)
+    return -1;
+  else if (hdr1->sh_addr > hdr2->sh_addr)
+    return 1;
+
+  /* Put !SHT_NOBITS sections before SHT_NOBITS ones.
+     The main loop in map_program_segments requires this. */
+
+  ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
+
+  if (ret != 0)
+    return ret;
   if (hdr1->sh_size < hdr2->sh_size)
-       return -1;
+    return -1;
   if (hdr1->sh_size > hdr2->sh_size)
-       return 1;
-      return 0;
-    }
+    return 1;
+  return 0;
+}
 
 
 
@@ -4696,7 +4699,9 @@ elf_link_add_object_symbols (abfd, info)
       hlook->weakdef = NULL;
 
       BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
-                 || hlook->root.type == bfd_link_hash_defweak);
+                 || hlook->root.type == bfd_link_hash_defweak
+                 || hlook->root.type == bfd_link_hash_common
+                 || hlook->root.type == bfd_link_hash_indirect);
       slook = hlook->root.u.def.section;
       vlook = hlook->root.u.def.value;