diff options
author | Lang Hames <lhames@gmail.com> | 2019-05-04 00:23:09 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2019-05-04 00:23:09 +0000 |
commit | ce8255f3e24a3f2272a3a39d17eab7eeb357a14d (patch) | |
tree | 3785942199b471684fc0df58c017681bef4ba5a8 /llvm/lib/ExecutionEngine/JITLink | |
parent | 5fe2ddbdf47dddc90233e3240a3aa6bcdea8721f (diff) | |
download | bcm5719-llvm-ce8255f3e24a3f2272a3a39d17eab7eeb357a14d.tar.gz bcm5719-llvm-ce8255f3e24a3f2272a3a39d17eab7eeb357a14d.zip |
[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
Diffstat (limited to 'llvm/lib/ExecutionEngine/JITLink')
-rw-r--r-- | llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
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(); }; |