From: kettenis Date: Thu, 25 Dec 2014 23:11:21 +0000 (+0000) Subject: Don't generate PLT entries for symbols defined in a regular object for X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e1299991cc2a7944d66910774bfcc132411d0b7c;p=openbsd Don't generate PLT entries for symbols defined in a regular object for -static -pie. On sparc64, avoid generating GLOB_DAT relocs and convert certain absolute relocs into RELATIVE relocs when we can for -static -pie. With this change we don't need -Wl,-Bsymbolic anymore when building -static -pie binaries. ok millert@, kurt@ --- diff --git a/gnu/usr.bin/binutils-2.17/bfd/elflink.c b/gnu/usr.bin/binutils-2.17/bfd/elflink.c index afb05a7996f..ee159727815 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/elflink.c +++ b/gnu/usr.bin/binutils-2.17/bfd/elflink.c @@ -2327,7 +2327,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, if (h->needs_plt && eif->info->shared && is_elf_hash_table (eif->info->hash) - && (eif->info->symbolic + && (eif->info->symbolic || eif->info->static_link || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) && h->def_regular) { diff --git a/gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c b/gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c index 1bf20119a33..11a7f8d9302 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c +++ b/gnu/usr.bin/binutils-2.17/bfd/elfxx-sparc.c @@ -2842,7 +2842,8 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, /* h->dynindx may be -1 if the symbol was marked to become local. */ else if (h != NULL && ! is_plt - && ((! info->symbolic && h->dynindx != -1) + && ((!info->symbolic && !info->static_link + && h->dynindx != -1) || !h->def_regular)) { BFD_ASSERT (h->dynindx != -1); @@ -3731,7 +3732,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd, The entry in the global offset table will already have been initialized in the relocate_section function. */ if (info->shared - && (info->symbolic || h->dynindx == -1) + && (info->symbolic || info->static_link || h->dynindx == -1) && h->def_regular) { asection *sec = h->root.u.def.section;