[llvm] 0d0f219 - [JITLink] Allow pre-existing eh-frame CIE edges on FDEs.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 22:21:15 PDT 2023
Author: Lang Hames
Date: 2023-10-09T22:21:07-07:00
New Revision: 0d0f2199f4ac9bc693dfd4b37a14441edaea5f50
URL: https://github.com/llvm/llvm-project/commit/0d0f2199f4ac9bc693dfd4b37a14441edaea5f50
DIFF: https://github.com/llvm/llvm-project/commit/0d0f2199f4ac9bc693dfd4b37a14441edaea5f50.diff
LOG: [JITLink] Allow pre-existing eh-frame CIE edges on FDEs.
This restores the pre-b9383a86b8f behavior. Most platforms / compilers don't
add relocations for CIEs, however they're not prohibited and we want objects
that contain them to remain loadable.
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
index c095b13e8c30c56..16665f422cb3cb0 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -304,24 +304,39 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B,
{
// Process the CIE pointer field.
auto CIEEdgeItr = BlockEdges.find(CIEDeltaFieldOffset);
- if (CIEEdgeItr != BlockEdges.end())
- return make_error<JITLinkError>(
- "CIE pointer field already has edge at " +
- formatv("{0:x16}", RecordAddress + CIEDeltaFieldOffset));
orc::ExecutorAddr CIEAddress =
RecordAddress + orc::ExecutorAddrDiff(CIEDeltaFieldOffset) -
orc::ExecutorAddrDiff(CIEDelta);
- LLVM_DEBUG({
- dbgs() << " Adding edge at " << (RecordAddress + CIEDeltaFieldOffset)
- << " to CIE at: " << CIEAddress << "\n";
- });
- if (auto CIEInfoOrErr = PC.findCIEInfo(CIEAddress))
- CIEInfo = *CIEInfoOrErr;
- else
- return CIEInfoOrErr.takeError();
- assert(CIEInfo->CIESymbol && "CIEInfo has no CIE symbol set");
- B.addEdge(NegDelta32, CIEDeltaFieldOffset, *CIEInfo->CIESymbol, 0);
+ if (CIEEdgeItr == BlockEdges.end()) {
+ LLVM_DEBUG({
+ dbgs() << " Adding edge at "
+ << (RecordAddress + CIEDeltaFieldOffset)
+ << " to CIE at: " << CIEAddress << "\n";
+ });
+ if (auto CIEInfoOrErr = PC.findCIEInfo(CIEAddress))
+ CIEInfo = *CIEInfoOrErr;
+ else
+ return CIEInfoOrErr.takeError();
+ assert(CIEInfo->CIESymbol && "CIEInfo has no CIE symbol set");
+ B.addEdge(NegDelta32, CIEDeltaFieldOffset, *CIEInfo->CIESymbol, 0);
+ } else {
+ LLVM_DEBUG({
+ dbgs() << " Already has edge at "
+ << (RecordAddress + CIEDeltaFieldOffset) << " to CIE at "
+ << CIEAddress << "\n";
+ });
+ auto &EI = CIEEdgeItr->second;
+ if (EI.Addend)
+ return make_error<JITLinkError>(
+ "CIE edge at " +
+ formatv("{0:x16}", RecordAddress + CIEDeltaFieldOffset) +
+ " has non-zero addend");
+ if (auto CIEInfoOrErr = PC.findCIEInfo(EI.Target->getAddress()))
+ CIEInfo = *CIEInfoOrErr;
+ else
+ return CIEInfoOrErr.takeError();
+ }
}
// Process the PC-Begin field.
More information about the llvm-commits
mailing list