From: Lang Hames Date: Wed, 19 Oct 2022 21:58:57 +0000 (-0700) Subject: [examples][ORC] Make sure eh-frame registration code is linked into an example. X-Git-Tag: upstream/17.0.6~30076 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af2b2214b4e2717d2114c0b01e3610e0b64a14be;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp index a7cb4fc..32c49f6 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 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);