Based on patches from Eric Youngdale <eric@aib.com>:
authorIan Lance Taylor <ian@airs.com>
Mon, 10 Jul 1995 17:31:31 +0000 (17:31 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 10 Jul 1995 17:31:31 +0000 (17:31 +0000)
* elflink.h (NAME(bfd_elf,size_dynamic_sections)): If -Bsymbolic,
output a DT_SYMBOLIC dynamic entry.
(elf_adjust_dynamic_symbol): If -Bsymbolic, don't require a PLT
entry for a locally defined symbol.
* elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, do warn
about undefined symbols, and fill in the GOT entry for a symbol
defined in a regular object file.
(elf_i386_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
reloc rather than a GLOB_DAT reloc for a symbol defined in a
regular object file.
* elf32-m68k.c (elf_m68k_relocate_section): If -Bsymbolic, do warn
about undefined symbols, and fill in the GOT entry for a symbol
defined in a regular object file.
(elf_m68k_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
reloc rather than a GLOB_DAT reloc for a symbol defined in a
regular object file.
* elf32-sparc.c (elf32_sparc_relocate_section): If -Bsymbolic, do
warn about undefined symbols, and fill in the GOT entry for a
symbol defined in a regular object file.
(elf32_sparc_finish_dynamic_symbol): If -Bsymbolic, output a
RELATIVE reloc rather than a GLOB_DAT reloc for a symbol defined
in a regular object file.

bfd/ChangeLog
bfd/elflink.h

index eea1b29..e006596 100644 (file)
@@ -5,6 +5,30 @@ Mon Jul 10 11:45:55 1995  Ken Raeburn  <raeburn@cygnus.com>
 
 Mon Jul 10 11:09:58 1995  Ian Lance Taylor  <ian@cygnus.com>
 
+       Based on patches from Eric Youngdale <eric@aib.com>:
+       * elflink.h (NAME(bfd_elf,size_dynamic_sections)): If -Bsymbolic,
+       output a DT_SYMBOLIC dynamic entry.
+       (elf_adjust_dynamic_symbol): If -Bsymbolic, don't require a PLT
+       entry for a locally defined symbol.
+       * elf32-i386.c (elf_i386_relocate_section): If -Bsymbolic, do warn
+       about undefined symbols, and fill in the GOT entry for a symbol
+       defined in a regular object file.
+       (elf_i386_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
+       reloc rather than a GLOB_DAT reloc for a symbol defined in a
+       regular object file.
+       * elf32-m68k.c (elf_m68k_relocate_section): If -Bsymbolic, do warn
+       about undefined symbols, and fill in the GOT entry for a symbol
+       defined in a regular object file.
+       (elf_m68k_finish_dynamic_symbol): If -Bsymbolic, output a RELATIVE
+       reloc rather than a GLOB_DAT reloc for a symbol defined in a
+       regular object file.
+       * elf32-sparc.c (elf32_sparc_relocate_section): If -Bsymbolic, do
+       warn about undefined symbols, and fill in the GOT entry for a
+       symbol defined in a regular object file.
+       (elf32_sparc_finish_dynamic_symbol): If -Bsymbolic, output a
+       RELATIVE reloc rather than a GLOB_DAT reloc for a symbol defined
+       in a regular object file.
+
        * config/m68k-coff.mt (SELECT_VECS): Rename from SELECT_VECTORS.
        Correct elements to be actual BFD vector names.
 
index 9ba2bed..b9cb000 100644 (file)
@@ -1273,6 +1273,12 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath,
            return false;
        }      
 
+      if (info->symbolic)
+       {
+         if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
+           return false;
+       }
+
       if (rpath != NULL)
        {
          bfd_size_type indx;
@@ -1431,6 +1437,16 @@ elf_adjust_dynamic_symbol (h, data)
   bfd *dynobj;
   struct elf_backend_data *bed;
 
+  /* If -Bsymbolic was used (which means to bind references to global
+     symbols to the definition within the shared object), and this
+     symbol was defined in a regular object, then it actually doesn't
+     need a PLT entry.  */
+  if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
+      && eif->info->shared
+      && eif->info->symbolic
+      && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+    h->elf_link_hash_flags &=~ ELF_LINK_HASH_NEEDS_PLT;
+
   /* If this symbol does not require a PLT entry, and it is not
      defined by a dynamic object, or is not referenced by a regular
      object, ignore it.  FIXME: Do we need to worry about symbols