From ce8255f3e24a3f2272a3a39d17eab7eeb357a14d Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sat, 4 May 2019 00:23:09 +0000 Subject: [JITLink] Add two useful Section operations: find by name, get address range. These operations were already used in eh-frame registration, and are likely to be used in other runtime registrations, so this commit moves them into a header where they can be re-used. llvm-svn: 359950 --- llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'llvm/lib/ExecutionEngine/JITLink') diff --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp index b54fd378aa5..67c37a5f9b1 100644 --- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp @@ -521,15 +521,8 @@ createEHFrameRecorderPass(const Triple &TT, // Search for a non-empty eh-frame and record the address of the first atom // in it. JITTargetAddress Addr = 0; - for (auto &S : G.sections()) - if (S.getName() == EHFrameSectionName && !S.atoms_empty()) { - Addr = (*S.atoms().begin())->getAddress(); - for (auto *DA : S.atoms()) - if (DA->getAddress() < Addr) - Addr = DA->getAddress(); - break; - } - + if (auto *S = G.findSectionByName(EHFrameSectionName)) + Addr = S->getRange().getStart(); StoreFrameAddress(Addr); return Error::success(); }; -- cgit v1.2.3