summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2014-12-25 23:10:17 +0000
committerkettenis <kettenis@openbsd.org>2014-12-25 23:10:17 +0000
commitfda68da1d69e87bda29e4c262dc5379ef4454cec (patch)
treef21041c527c9d1499ccd08649fe3af6ff982c56b
parentreturn ERANGE instead of ENOMEM, so callers can differentiate real oom (diff)
downloadwireguard-openbsd-fda68da1d69e87bda29e4c262dc5379ef4454cec.tar.xz
wireguard-openbsd-fda68da1d69e87bda29e4c262dc5379ef4454cec.zip
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@
-rw-r--r--gnu/usr.bin/binutils/bfd/elf64-sparc.c5
-rw-r--r--gnu/usr.bin/binutils/bfd/elflink.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/gnu/usr.bin/binutils/bfd/elf64-sparc.c b/gnu/usr.bin/binutils/bfd/elf64-sparc.c
index 1dd92ed667c..7704bb71012 100644
--- a/gnu/usr.bin/binutils/bfd/elf64-sparc.c
+++ b/gnu/usr.bin/binutils/bfd/elf64-sparc.c
@@ -2222,7 +2222,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
{
@@ -2776,7 +2777,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
asection *sec = h->root.u.def.section;
diff --git a/gnu/usr.bin/binutils/bfd/elflink.c b/gnu/usr.bin/binutils/bfd/elflink.c
index 4707de15838..73a8a4778aa 100644
--- a/gnu/usr.bin/binutils/bfd/elflink.c
+++ b/gnu/usr.bin/binutils/bfd/elflink.c
@@ -2139,7 +2139,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& 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->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
{