summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto2/llvm-lto2.cpp
diff options
context:
space:
mode:
authorTobias Edler von Koch <tobias@codeaurora.org>2017-04-13 16:24:14 +0000
committerTobias Edler von Koch <tobias@codeaurora.org>2017-04-13 16:24:14 +0000
commit90df1f48d56657586f77eb7e6e747866105937fd (patch)
tree166093fbd068544092439d25ac1b04253ec17c03 /llvm/tools/llvm-lto2/llvm-lto2.cpp
parentd77394c5f2ec4d4f5241ca293d7bf66299bc91cd (diff)
downloadbcm5719-llvm-90df1f48d56657586f77eb7e6e747866105937fd.tar.gz
bcm5719-llvm-90df1f48d56657586f77eb7e6e747866105937fd.zip
LTO: Pass SF_Executable flag through to InputFile::Symbol
Summary: The linker needs to be able to determine whether a symbol is text or data to handle the case of a common being overridden by a strong definition in an archive. If the archive contains a text member of the same name as the common, that function is discarded. However, if the archive contains a data member of the same name, that strong definition overrides the common. This is a behavior of ld.bfd, which the Qualcomm linker also supports in LTO. Here's a test case to illustrate: #### cat > 1.c << \! int blah; ! cat > 2.c << \! int blah() { return 0; } ! cat > 3.c << \! int blah = 20; ! clang -c 1.c clang -c 2.c clang -c 3.c ar cr lib.a 2.o 3.o ld 1.o lib.a -t #### The correct output is: 1.o (lib.a)3.o Thanks to Shankar Easwaran and Hemant Kulkarni for the test case! Reviewers: mehdi_amini, rafael, pcc, davide Reviewed By: pcc Subscribers: davide, llvm-commits, inglorion Differential Revision: https://reviews.llvm.org/D31901 llvm-svn: 300205
Diffstat (limited to 'llvm/tools/llvm-lto2/llvm-lto2.cpp')
-rw-r--r--llvm/tools/llvm-lto2/llvm-lto2.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 52ba669279c..7a8d4055338 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -317,18 +317,19 @@ static int dumpSymtab(int argc, char **argv) {
PrintBool('I', Sym.isIndirect());
PrintBool('O', Sym.canBeOmittedFromSymbolTable());
PrintBool('T', Sym.isTLS());
+ PrintBool('X', Sym.isExecutable());
outs() << ' ' << Sym.getName() << '\n';
if (Sym.isCommon())
- outs() << " size " << Sym.getCommonSize() << " align "
+ outs() << " size " << Sym.getCommonSize() << " align "
<< Sym.getCommonAlignment() << '\n';
int Comdat = Sym.getComdatIndex();
if (Comdat != -1)
- outs() << " comdat " << ComdatTable[Comdat] << '\n';
+ outs() << " comdat " << ComdatTable[Comdat] << '\n';
if (Sym.isWeak() && Sym.isIndirect())
- outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
+ outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
}
outs() << '\n';
OpenPOWER on IntegriCloud