[llvm] 45ad6fa - [JITLink] Use edge kind names for fixups in EHFrameEdgeFixer.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 23 21:42:15 PST 2021
Author: Lang Hames
Date: 2021-01-24T15:38:04+11:00
New Revision: 45ad6fac6ad0dea2a1f7a1c6b65b64d230757667
URL: https://github.com/llvm/llvm-project/commit/45ad6fac6ad0dea2a1f7a1c6b65b64d230757667
DIFF: https://github.com/llvm/llvm-project/commit/45ad6fac6ad0dea2a1f7a1c6b65b64d230757667.diff
LOG: [JITLink] Use edge kind names for fixups in EHFrameEdgeFixer.
Previously FDE field names were used, but the fixup kind used for a field can
vary based on the pointer encoding.
This change will improve readability / maintainability when EH-frame support is
added to JITLink/ELF.
Added:
Modified:
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
index 7a89476687d2..8b730bc23ce0 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -119,10 +119,9 @@ Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B,
}
EHFrameEdgeFixer::EHFrameEdgeFixer(StringRef EHFrameSectionName,
- Edge::Kind FDEToCIE, Edge::Kind FDEToPCBegin,
- Edge::Kind FDEToLSDA)
- : EHFrameSectionName(EHFrameSectionName), FDEToCIE(FDEToCIE),
- FDEToPCBegin(FDEToPCBegin), FDEToLSDA(FDEToLSDA) {}
+ Edge::Kind Delta64, Edge::Kind NegDelta32)
+ : EHFrameSectionName(EHFrameSectionName), Delta64(Delta64),
+ NegDelta32(NegDelta32) {}
Error EHFrameEdgeFixer::operator()(LinkGraph &G) {
auto *EHFrame = G.findSectionByName(EHFrameSectionName);
@@ -419,7 +418,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B,
else
return CIEInfoOrErr.takeError();
assert(CIEInfo->CIESymbol && "CIEInfo has no CIE symbol set");
- B.addEdge(FDEToCIE, RecordOffset + CIEDeltaFieldOffset,
+ B.addEdge(NegDelta32, RecordOffset + CIEDeltaFieldOffset,
*CIEInfo->CIESymbol, 0);
} else {
LLVM_DEBUG({
@@ -459,8 +458,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B,
auto PCBeginSym = getOrCreateSymbol(PC, PCBegin);
if (!PCBeginSym)
return PCBeginSym.takeError();
- B.addEdge(FDEToPCBegin, RecordOffset + PCBeginFieldOffset, *PCBeginSym,
- 0);
+ B.addEdge(Delta64, RecordOffset + PCBeginFieldOffset, *PCBeginSym, 0);
PCBeginBlock = &PCBeginSym->getBlock();
} else {
auto &EI = PCEdgeItr->second;
@@ -521,7 +519,7 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, Block &B,
<< formatv("{0:x16}", RecordAddress + LSDAFieldOffset)
<< " to LSDA at " << formatv("{0:x16}", LSDA) << "\n";
});
- B.addEdge(FDEToLSDA, RecordOffset + LSDAFieldOffset, *LSDASym, 0);
+ B.addEdge(Delta64, RecordOffset + LSDAFieldOffset, *LSDASym, 0);
} else {
LLVM_DEBUG({
auto &EI = LSDAEdgeItr->second;
diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
index a8cd32c664dc..83f27a285998 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
@@ -40,8 +40,8 @@ class EHFrameSplitter {
/// edges.
class EHFrameEdgeFixer {
public:
- EHFrameEdgeFixer(StringRef EHFrameSectionName, Edge::Kind FDEToCIE,
- Edge::Kind FDEToPCBegin, Edge::Kind FDEToLSDA);
+ EHFrameEdgeFixer(StringRef EHFrameSectionName, Edge::Kind Delta64,
+ Edge::Kind NegDelta32);
Error operator()(LinkGraph &G);
private:
@@ -101,9 +101,8 @@ class EHFrameEdgeFixer {
Expected<Symbol &> getOrCreateSymbol(ParseContext &PC, JITTargetAddress Addr);
StringRef EHFrameSectionName;
- Edge::Kind FDEToCIE;
- Edge::Kind FDEToPCBegin;
- Edge::Kind FDEToLSDA;
+ Edge::Kind Delta64;
+ Edge::Kind NegDelta32;
};
} // end namespace jitlink
diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
index e32bf847014b..24559cc7e772 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
@@ -670,7 +670,7 @@ void link_MachO_x86_64(std::unique_ptr<LinkGraph> G,
// Add eh-frame passses.
Config.PrePrunePasses.push_back(EHFrameSplitter("__eh_frame"));
Config.PrePrunePasses.push_back(
- EHFrameEdgeFixer("__eh_frame", NegDelta32, Delta64, Delta64));
+ EHFrameEdgeFixer("__eh_frame", Delta64, NegDelta32));
// Add a mark-live pass.
if (auto MarkLive = Ctx->getMarkLivePass(G->getTargetTriple()))
More information about the llvm-commits
mailing list