[llvm] r358840 - [JITLink] Remove an overly strict error check in JITLink's eh-frame parser.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 20 21:48:32 PDT 2019
Author: lhames
Date: Sat Apr 20 21:48:32 2019
New Revision: 358840
URL: http://llvm.org/viewvc/llvm-project?rev=358840&view=rev
Log:
[JITLink] Remove an overly strict error check in JITLink's eh-frame parser.
The error check required FDEs to refer to the most recent CIE, but the eh-frame
spec allows them to refer to any previously seen CIE. This patch removes the
offending check.
Modified:
llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp
llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupportImpl.h
Modified: llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp?rev=358840&r1=358839&r2=358840&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp Sat Apr 20 21:48:32 2019
@@ -164,7 +164,6 @@ Error EHFrameParser::processCIE() {
LLVM_DEBUG(dbgs() << " Record is CIE\n");
/// Reset state for the new CIE.
- MostRecentCIE = CurRecordAtom;
LSDAFieldPresent = false;
uint8_t Version = 0;
@@ -276,26 +275,19 @@ Error EHFrameParser::processFDE(JITTarge
uint32_t CIEPointer) {
LLVM_DEBUG(dbgs() << " Record is FDE\n");
- // Sanity check the CIE pointer: if this is an FDE it must be proceeded by
- // a CIE.
- if (MostRecentCIE == nullptr)
- return make_error<JITLinkError>("__eh_frame must start with CIE, not "
- "FDE");
-
LLVM_DEBUG({
dbgs() << " CIE pointer: "
<< format("0x%016" PRIx64, CIEPointerAddress - CIEPointer) << "\n";
});
- // Verify that this FDE's CIE pointer points to the most recent CIE entry.
- if (CIEPointerAddress - CIEPointer != MostRecentCIE->getAddress())
- return make_error<JITLinkError>("__eh_frame FDE's CIE Pointer does not "
- "point at the most recent CIE");
+ auto CIEAtom = G.findAtomByAddress(CIEPointerAddress - CIEPointer);
+ if (!CIEAtom)
+ return CIEAtom.takeError();
// The CIEPointer looks good. Add a relocation.
CurRecordAtom->addEdge(FDEToCIERelocKind,
CIEPointerAddress - CurRecordAtom->getAddress(),
- *MostRecentCIE, 0);
+ *CIEAtom, 0);
// Read and sanity check the PC-start pointer and size.
JITTargetAddress PCBeginAddress = EHFrameAddress + EHFrameReader.getOffset();
Modified: llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupportImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupportImpl.h?rev=358840&r1=358839&r2=358840&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupportImpl.h (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupportImpl.h Sat Apr 20 21:48:32 2019
@@ -50,7 +50,6 @@ private:
JITTargetAddress EHFrameAddress;
BinaryStreamReader EHFrameReader;
DefinedAtom *CurRecordAtom = nullptr;
- DefinedAtom *MostRecentCIE = nullptr;
bool LSDAFieldPresent = false;
Edge::Kind FDEToCIERelocKind;
Edge::Kind FDEToTargetRelocKind;
More information about the llvm-commits
mailing list