diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-07-22 15:39:16 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-07-22 15:39:16 +0000 |
commit | b2691bb69e10ee363d42a3fc165247f330d25a67 (patch) | |
tree | 217b8e9d6292e90418ea9463e29e649fa149498c | |
parent | df966c82003b3fe214b662298aa3f3b47527fc1a (diff) |
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.c | 3 |
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; |