aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-07-19 18:18:19 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-07-19 18:18:19 +0000
commite776dd9ca2f8ce20fb50b8e179cc563826f3892d (patch)
treed25ca0fc36658757e283f78e8fe6372a746dd9f2 /llvm/lib/LTO/LTO.cpp
parent5fc5d0a4069e304597b04adb0ecc79a009684b75 (diff)
downloadllvm-e776dd9ca2f8ce20fb50b8e179cc563826f3892d.zip
llvm-e776dd9ca2f8ce20fb50b8e179cc563826f3892d.tar.gz
llvm-e776dd9ca2f8ce20fb50b8e179cc563826f3892d.tar.bz2
LTO: Export functions referenced by the CFI jump table.
If the LowerTypeTests pass decides to add a function to a jump table for CFI, it will add its name to the set cfiFunctionDefs, which among other things will cause the function to be renamed in the ThinLTO backend. One other thing that we must do with such functions is to not internalize them, because the jump table in the full LTO object will contain a reference to the actual function body in the ThinLTO object. This patch handles that by ensuring that we export any functions whose names appear in the cfiFunctionDefs set. Fixes PR33831. Differential Revision: https://reviews.llvm.org/D35605 llvm-svn: 308504
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 1997394..958151a 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -1072,6 +1072,12 @@ Error LTO::runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache,
ExportedGUIDs.insert(GUID);
}
+ // Any functions referenced by the jump table in the regular LTO object must
+ // be exported.
+ for (auto &Def : ThinLTO.CombinedIndex.cfiFunctionDefs())
+ ExportedGUIDs.insert(
+ GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(Def)));
+
auto isExported = [&](StringRef ModuleIdentifier, GlobalValue::GUID GUID) {
const auto &ExportList = ExportLists.find(ModuleIdentifier);
return (ExportList != ExportLists.end() &&