summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto2/llvm-lto2.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-07-25 19:42:32 +0000
committerTeresa Johnson <tejohnson@google.com>2017-07-25 19:42:32 +0000
commita83c3f787969ac4c71b87ecffc10f92aa98e7a0d (patch)
tree430396504a3451bf3f183ca01404742a85c69f2c /llvm/tools/llvm-lto2/llvm-lto2.cpp
parent612d9184352bdcbdc25e546eda5c5d1d67ca5622 (diff)
downloadbcm5719-llvm-a83c3f787969ac4c71b87ecffc10f92aa98e7a0d.tar.gz
bcm5719-llvm-a83c3f787969ac4c71b87ecffc10f92aa98e7a0d.zip
[LTO] Prevent dead stripping and internalization of symbols with sections
Summary: ELF linkers generate __start_<secname> and __stop_<secname> symbols when there is a value in a section <secname> where the name is a valid C identifier. If dead stripping determines that the values declared in section <secname> are dead, and we then internalize (and delete) such a symbol, programs that reference the corresponding start and end section symbols will get undefined reference linking errors. To fix this, add the section name to the IRSymtab entry when a symbol is defined in a specific section. Then use this in the gold-plugin to mark the symbol as external and visible from outside the summary when the section name is a valid C identifier. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D35639 llvm-svn: 309009
Diffstat (limited to 'llvm/tools/llvm-lto2/llvm-lto2.cpp')
-rw-r--r--llvm/tools/llvm-lto2/llvm-lto2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 5426e040cd7..fac3fe49d67 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -355,6 +355,9 @@ static int dumpSymtab(int argc, char **argv) {
if (TT.isOSBinFormatCOFF() && Sym.isWeak() && Sym.isIndirect())
outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
+
+ if (!Sym.getSectionName().empty())
+ outs() << " section " << Sym.getSectionName() << "\n";
}
outs() << '\n';
OpenPOWER on IntegriCloud