forked from OSchip/llvm-project
[lld] Allow rel iplt symbols with dynamic symbol table
Emit these symbols as long as we're building in a static configuration, even if we're emitting a dynamic symbol table. This is consistent with both bfd and gold. Ordinarily, the combination of -static and -export-dynamic wouldn't make much sense. Unfortunately, cmake versions prior to 3.4 forcefully injected -rdynamic [1], so it seems worthwhile to support. [1] https://cmake.org/cmake/help/v3.4/policy/CMP0065.html Differential Revision: https://reviews.llvm.org/D36350 llvm-svn: 310168
This commit is contained in:
parent
60711ca253
commit
335fad1c24
|
@ -774,7 +774,7 @@ addOptionalRegular(StringRef Name, SectionBase *Sec, uint64_t Val,
|
|||
// need these symbols, since IRELATIVE relocs are resolved through GOT
|
||||
// and PLT. For details, see http://www.airs.com/blog/archives/403.
|
||||
template <class ELFT> void Writer<ELFT>::addRelIpltSymbols() {
|
||||
if (InX::DynSymTab)
|
||||
if (!Config->Static)
|
||||
return;
|
||||
StringRef S = Config->IsRela ? "__rela_iplt_start" : "__rel_iplt_start";
|
||||
addOptionalRegular<ELFT>(S, In<ELFT>::RelaIplt, 0, STV_HIDDEN, STB_WEAK);
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
||||
// RUN: ld.lld -static -export-dynamic %t.o -o %tout
|
||||
// RUN: llvm-nm -U %tout | FileCheck %s
|
||||
// REQUIRES: x86
|
||||
|
||||
// CHECK: __rela_iplt_end
|
||||
// CHECK: __rela_iplt_start
|
||||
|
||||
.text
|
||||
.type foo STT_GNU_IFUNC
|
||||
.globl foo
|
||||
foo:
|
||||
ret
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
call foo
|
||||
movl $__rela_iplt_start,%edx
|
||||
movl $__rela_iplt_end,%edx
|
Loading…
Reference in New Issue