summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2017-07-22 15:39:15 +0000
committerkettenis <kettenis@openbsd.org>2017-07-22 15:39:15 +0000
commitf9ac264ef65222b02c7465e1d85c749c27859b14 (patch)
treecd5ba101b40cb4891534331d924d65ab8e70b4e7
parentWhitespace. (diff)
downloadwireguard-openbsd-f9ac264ef65222b02c7465e1d85c749c27859b14.tar.xz
wireguard-openbsd-f9ac264ef65222b02c7465e1d85c749c27859b14.zip
Prefer the definition of a variable in the executable over a definition
in a shared library, even for commons. This is what the current generation of linkers (current bfd, gold, lld) do. This fixes the relocation R_X86_64_PC32 against `xxx' can not be used when making a shared object; recompile with -fPIC warnings that we have seen in ports with clang. This change is somewhat suspect as a similar change was reverted in upstream binutils at some point. However that was for another corner case on an architecture (s390) that we do not run on. Tested by naddy@, sthen@
-rw-r--r--gnu/usr.bin/binutils-2.17/bfd/elflink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/usr.bin/binutils-2.17/bfd/elflink.c b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
index 2f1d604f1cb..a6d17dcb4d9 100644
--- a/gnu/usr.bin/binutils-2.17/bfd/elflink.c
+++ b/gnu/usr.bin/binutils-2.17/bfd/elflink.c
@@ -1180,7 +1180,8 @@ _bfd_elf_merge_symbol (bfd *abfd,
&& (olddef
|| (h->root.type == bfd_link_hash_common
&& (newweak
- || ELF_ST_TYPE (sym->st_info) == STT_FUNC))))
+ || ELF_ST_TYPE (sym->st_info) == STT_FUNC
+ || (!olddyn && info->executable)))))
{
*override = TRUE;
newdef = FALSE;