From c13dba05ba5968a9ac1d10c064da59d313ba0825 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 22 Apr 2019 01:35:16 +0000 Subject: [PATCH] [JITLink] Fix section start address calculation in eh-frame recorder. Section atoms are not sorted, so we need to scan the whole section to find the start address. No test case: Found by inspection, and any reproduction would depend on pointer ordering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358865 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp b/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp index 2aa4a45600c..38c537b5c78 100644 --- a/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp +++ b/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp @@ -516,6 +516,9 @@ AtomGraphPassFunction createEHFrameRecorderPass(const Triple &TT, 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; } -- 2.50.1