[lld] r324559 - Symbols defined in linker scripts should not have dso_local flag set in LTO resolutions.
Dmitry Mikulin via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 20:25:52 PST 2018
Author: dmikulin
Date: Wed Feb 7 20:25:52 2018
New Revision: 324559
URL: http://llvm.org/viewvc/llvm-project?rev=324559&view=rev
Log:
Symbols defined in linker scripts should not have dso_local flag set in LTO resolutions.
Differential Revision: https://reviews.llvm.org/D43051
Modified:
lld/trunk/ELF/LTO.cpp
lld/trunk/test/ELF/lto/abs-resol.ll
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=324559&r1=324558&r2=324559&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Wed Feb 7 20:25:52 2018
@@ -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);
Modified: lld/trunk/test/ELF/lto/abs-resol.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/abs-resol.ll?rev=324559&r1=324558&r2=324559&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/abs-resol.ll (original)
+++ lld/trunk/test/ELF/lto/abs-resol.ll Wed Feb 7 20:25:52 2018
@@ -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"
More information about the llvm-commits
mailing list