]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Merge from mainline
authorPhil Blundell <philb@gnu.org>
Sun, 22 Oct 2000 15:19:57 +0000 (15:19 +0000)
committerPhil Blundell <philb@gnu.org>
Sun, 22 Oct 2000 15:19:57 +0000 (15:19 +0000)
12 files changed:
bfd/ChangeLog
bfd/elf-hppa.h
bfd/elf32-arm.h
bfd/elf32-i386.c
bfd/elf32-m68k.c
bfd/elf32-mcore.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-sparc.c
bfd/elf64-alpha.c
bfd/elf64-sparc.c
bfd/elflink.c

index e510060f991f3162e515bb94b1a7fb6869dc683d..0ce64e9fdc52acdc5659a0f96de76f5d32c66afe 100644 (file)
@@ -1,3 +1,27 @@
+2000-10-22  Philip Blundell  <philb@gnu.org>
+
+       * elf32-arm.h (elf32_arm_finish_dynamic_symbol): Don't make 
+       PLT entries that could serve as a definition for a weak symbol.
+
+       From 2000-06-05  H.J. Lu  <hjl@gnu.org>
+       * elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
+       an error when seeing an undefined symbol with hidden/internal
+       attribute. It is handled in *_relocate_section ().
+
+       From 2000-05-23  H.J. Lu  <hjl@gnu.org>
+       * elf32-i386.c (elf_i386_relocate_section): Don't allow the
+       undefined symbol with the non-default visibility attributes.
+       * elf-hppa.h (elf_hppa_relocate_section): Likewise.
+       * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+       * elf32-i370.c (i370_elf_relocate_section): Likewise.
+       * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+       * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+       * elf32-mips.c (mips_elf_calculate_relocation): Likewise.
+       * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+       * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+       * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+       * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+
 2000-10-16  Geoffrey Keating  <geoffk@cygnus.com>
 
        From 2000-10-14  Geoffrey Keating  <geoffk@cygnus.com>
index b55e1c4e5bc1111f238c2e38128794d6edf8e42b..000ffea3c75946f5137ae7a9a372bf45cd6e56bf 100644 (file)
@@ -1079,7 +1079,8 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
                relocation = 0;
            }
          /* Allow undefined symbols in shared libraries.  */
-          else if (info->shared && !info->no_undefined)
+          else if (info->shared && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            {
              if (info->symbolic)
                (*info->callbacks->undefined_symbol)
index 7cb5bbc23321342b8e6b591f40ba5d1521a5e5a9..74fb5bbaa4d036e4d0ae581505c46a1df0189cc7 100644 (file)
@@ -1807,14 +1807,17 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (!((*info->callbacks->undefined_symbol)
                    (info, h->root.root.string, input_bfd,
                     input_section, rel->r_offset,
-                    (!info->shared || info->no_undefined))))
+                    (!info->shared || info->no_undefined
+                     || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
@@ -3012,6 +3015,13 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
          /* Mark the symbol as undefined, rather than as defined in
             the .plt section.  Leave the value alone.  */
          sym->st_shndx = SHN_UNDEF;
+         /* If the symbol is weak, we do need to clear the value.
+            Otherwise, the PLT entry would provide a definition for
+            the symbol even if the symbol wasn't defined anywhere,
+            and so the symbol would never be NULL.  */
+         if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) 
+             == 0)
+           sym->st_value = 0;
        }
     }
 
index e4dbf9da0964a53328b142455dc4610b82c53eba..fc1b5a8ccb6ebc4561c24be8a74881bfd1528085 100644 (file)
@@ -1315,14 +1315,17 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd,
                      input_section, rel->r_offset,
-                     (!info->shared || info->no_undefined))))
+                     (!info->shared || info->no_undefined
+                      || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
index cc6223017558f5329e58161a54a623f8efc092a7..3df26d2c7f96b61bed3b9cd1d18ebe3985264224 100644 (file)
@@ -1479,14 +1479,17 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (!(info->callbacks->undefined_symbol
                    (info, h->root.root.string, input_bfd,
                     input_section, rel->r_offset,
-                    (!info->shared || info->no_undefined))))
+                    (!info->shared || info->no_undefined
+                     || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
index 5963a9eff6ea8d0465e537547384c0ecfc12cdda..edc6f678c226de5323152bff337e657190ee164e 100644 (file)
@@ -532,7 +532,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared)
+         else if (info->shared
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
index d91bab9726841e2e304b21e4d74a8381a2e40639..6306f108365b55ac8c7efd4bd4b3c3a123378577 100644 (file)
@@ -5930,7 +5930,8 @@ mips_elf_calculate_relocation (abfd,
           and check to see if they exist by looking at their
           addresses.  */
        symbol = 0;
-      else if (info->shared && !info->symbolic && !info->no_undefined)
+      else if (info->shared && !info->symbolic && !info->no_undefined
+              && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
        symbol = 0;
       else if (strcmp (h->root.root.root.string, "_DYNAMIC_LINK") == 0)
        {
@@ -5948,7 +5949,8 @@ mips_elf_calculate_relocation (abfd,
          if (! ((*info->callbacks->undefined_symbol)
                 (info, h->root.root.root.string, input_bfd,
                  input_section, relocation->r_offset,
-                 (!info->shared || info->no_undefined))))
+                 (!info->shared || info->no_undefined
+                  || ELF_ST_VISIBILITY (h->other)))))
            return bfd_reloc_undefined;
          symbol = 0;
        }
index e648f0256c28b0ad7d837018c9b71f1bd98f1f06..9eec59bde5c6ba38e067f0466928a076cb738eda 100644 (file)
@@ -3108,7 +3108,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
@@ -3118,7 +3120,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                                                         input_section,
                                                         rel->r_offset,
                                                         (!info->shared
-                                                         || info->no_undefined)))
+                                                         || info->no_undefined
+                                                         ELF_ST_VISIBILITY (h->other))))
                return false;
              relocation = 0;
            }
index e61a82fabeb5cc8a0134068635ecb107e86afd8b..1c8d0ba275ae583cd3223e499950ea3aca8d5540 100644 (file)
@@ -1213,14 +1213,17 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd,
                      input_section, rel->r_offset,
-                     (!info->shared || info->no_undefined))))
+                     (!info->shared || info->no_undefined
+                      || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
index 4da9e925c636ea645570f3f90a06a3d829e5930d..c8fac5361ec9b60bec03392010cfef3d084867b4 100644 (file)
@@ -3475,14 +3475,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (!((*info->callbacks->undefined_symbol)
                    (info, h->root.root.root.string, input_bfd,
                     input_section, rel->r_offset,
-                    (!info->shared || info->no_undefined))))
+                    (!info->shared || info->no_undefined
+                     || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
index 46e777552f2aac9c5d42088a1aa3f662bafa9332..c9e862677ac767aa0040c3244e6ec14c7c3651ca 100644 (file)
@@ -2049,14 +2049,17 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
            }
          else if (h->root.type == bfd_link_hash_undefweak)
            relocation = 0;
-         else if (info->shared && !info->symbolic && !info->no_undefined)
+         else if (info->shared && !info->symbolic
+                  && !info->no_undefined
+                  && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
            relocation = 0;
          else
            {
              if (! ((*info->callbacks->undefined_symbol)
                     (info, h->root.root.string, input_bfd,
                      input_section, rel->r_offset,
-                     (!info->shared || info->no_undefined))))
+                     (!info->shared || info->no_undefined
+                      || ELF_ST_VISIBILITY (h->other)))))
                return false;
              relocation = 0;
            }
index c593e496f95ccc27391737d7f26c3047d24a6830..8039b4fe35b006f8681f975549a5d8b42a8d23e3 100644 (file)
@@ -226,21 +226,8 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
        {
        case STV_INTERNAL:
        case STV_HIDDEN:
-         /* This symbol must be defined in the shared object or
-            executable.  */
-         if (h->root.type == bfd_link_hash_undefined)
-           {
-             bfd * abfd = h->root.u.undef.abfd;
-             const char * name = h->root.root.string;
-             
-             (*info->callbacks->undefined_symbol)
-               (info, name, abfd, bfd_und_section_ptr, 0, true);
-
-             /* We have flaged a fatal error. We now treat this as
-                a normal symbol to avoid further error messages. */
-             h->other ^= ELF_ST_VISIBILITY (h->other);
-           }
-         else if (h->root.type != bfd_link_hash_undefweak)
+         if (h->root.type != bfd_link_hash_undefined
+             && h->root.type != bfd_link_hash_undefweak)
            {
              h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
              return true;