Skip to content

Commit af2b221

Browse files
committed
[examples][ORC] Make sure eh-frame registration code is linked into an example.
Since aedeb8d, which switched to EPC-based eh-frame registration, the eh-frame registration functions need to be forcibly linked into the target process. We need a general solution to this problem, but for now just force it in this example to fix the test failures in https://green.lab.llvm.org/green/job/clang-stage1-RA/31497 rdar://101083784
1 parent 795f679 commit af2b221

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
3838
#include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
3939
#include "llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h"
40+
#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h"
4041
#include "llvm/IR/GlobalValue.h"
4142
#include "llvm/IR/LLVMContext.h"
4243
#include "llvm/IR/ModuleSummaryIndex.h"
@@ -172,6 +173,12 @@ Expected<ThreadSafeModule> loadModule(StringRef Path,
172173
return ThreadSafeModule(std::move(*M), std::move(TSCtx));
173174
}
174175

176+
// Make sure the eh-frame registration functions get linked into the binary.
177+
LLVM_ATTRIBUTE_USED void linkComponents() {
178+
errs() << (void *)&llvm_orc_registerEHFrameSectionWrapper
179+
<< (void *)&llvm_orc_deregisterEHFrameSectionWrapper;
180+
}
181+
175182
int main(int Argc, char *Argv[]) {
176183
InitLLVM X(Argc, Argv);
177184

0 commit comments

Comments
 (0)