diff options
author | Dmitry Mikulin <dmitry.mikulin@sony.com> | 2018-02-08 04:25:52 +0000 |
---|---|---|
committer | Dmitry Mikulin <dmitry.mikulin@sony.com> | 2018-02-08 04:25:52 +0000 |
commit | 8ddd922d7319a7382df0d89df906027058b876f5 (patch) | |
tree | 73519beb78f82caf7738153f8dc35751715a4863 | |
parent | 4c17d95bea903c4d9fd37f43f369fca6327d8264 (diff) | |
download | bcm5719-llvm-8ddd922d7319a7382df0d89df906027058b876f5.tar.gz bcm5719-llvm-8ddd922d7319a7382df0d89df906027058b876f5.zip |
Symbols defined in linker scripts should not have dso_local flag set in LTO resolutions.
Differential Revision: https://reviews.llvm.org/D43051
llvm-svn: 324559
-rw-r--r-- | lld/ELF/LTO.cpp | 5 | ||||
-rw-r--r-- | lld/test/ELF/lto/abs-resol.ll | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp index 098e842597d..d5c4d80cd5b 100644 --- a/lld/ELF/LTO.cpp +++ b/lld/ELF/LTO.cpp @@ -160,8 +160,9 @@ void BitcodeCompiler::add(BitcodeFile &F) { // Skip absolute symbols from ELF objects, otherwise PC-rel relocations // will be generated by for them, triggering linker errors. // Symbol section is always null for bitcode symbols, hence the check - // for isElf(). - !(Sym->File && Sym->File->isElf() && DR->Section == nullptr); + // for isElf(). Skip linker script defined symbols as well: they have + // no File defined. + !(DR->Section == nullptr && (!Sym->File || Sym->File->isElf())); if (R.Prevailing) undefine(Sym); diff --git a/lld/test/ELF/lto/abs-resol.ll b/lld/test/ELF/lto/abs-resol.ll index eddf49988a9..4b0fb47a9e2 100644 --- a/lld/test/ELF/lto/abs-resol.ll +++ b/lld/test/ELF/lto/abs-resol.ll @@ -2,7 +2,10 @@ ; RUN: llvm-as %s -o %t.o ; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/absolute.s -o %t2.o -filetype=obj -; RUN: ld.lld %t.o %t2.o -o %t.out -pie +; RUN: ld.lld %t.o %t2.o -o %t3.out -pie + +; RUN: echo "blah = 0xdeadfeef;" > %t.script +; RUN: ld.lld %t.o -T%t.script -o %t4.out -pie target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" |