[llvm] af2b221 - [examples][ORC] Make sure eh-frame registration code is linked into an example.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 19 15:06:22 PDT 2022
Author: Lang Hames
Date: 2022-10-19T15:03:42-07:00
New Revision: af2b2214b4e2717d2114c0b01e3610e0b64a14be
URL: https://github.com/llvm/llvm-project/commit/af2b2214b4e2717d2114c0b01e3610e0b64a14be
DIFF: https://github.com/llvm/llvm-project/commit/af2b2214b4e2717d2114c0b01e3610e0b64a14be.diff
LOG: [examples][ORC] Make sure eh-frame registration code is linked into an example.
Since aedeb8d5570, 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
Added:
Modified:
llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
Removed:
################################################################################
diff --git a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
index a7cb4fce94909..32c49f63e38d6 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
@@ -37,6 +37,7 @@
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
#include "llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h"
+#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/ModuleSummaryIndex.h"
@@ -172,6 +173,12 @@ Expected<ThreadSafeModule> loadModule(StringRef Path,
return ThreadSafeModule(std::move(*M), std::move(TSCtx));
}
+// Make sure the eh-frame registration functions get linked into the binary.
+LLVM_ATTRIBUTE_USED void linkComponents() {
+ errs() << (void *)&llvm_orc_registerEHFrameSectionWrapper
+ << (void *)&llvm_orc_deregisterEHFrameSectionWrapper;
+}
+
int main(int Argc, char *Argv[]) {
InitLLVM X(Argc, Argv);
More information about the llvm-commits
mailing list