From 951fe66d6208b801aaeedda3bf4b380a89b1feac Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 10 Jul 1995 17:31:31 +0000 Subject: [PATCH] Based on patches from Eric Youngdale : * 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 | 24 ++++++++++++++++++++++++ bfd/elflink.h | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eea1b291e6..e006596507 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -5,6 +5,30 @@ Mon Jul 10 11:45:55 1995 Ken Raeburn Mon Jul 10 11:09:58 1995 Ian Lance Taylor + Based on patches from Eric Youngdale : + * 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. diff --git a/bfd/elflink.h b/bfd/elflink.h index 9ba2bed11a..b9cb000d5c 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -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