[llvm] r358865 - [JITLink] Fix section start address calculation in eh-frame recorder.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 18:35:16 PDT 2019


Author: lhames
Date: Sun Apr 21 18:35:16 2019
New Revision: 358865

URL: http://llvm.org/viewvc/llvm-project?rev=358865&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp

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=358865&r1=358864&r2=358865&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/JITLink_EHFrameSupport.cpp Sun Apr 21 18:35:16 2019
@@ -516,6 +516,9 @@ AtomGraphPassFunction createEHFrameRecor
     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;
       }
 




More information about the llvm-commits mailing list