[llvm] d898693 - [ExecutionEngine] Use the libunwind __register_frame on Darwin

Azharuddin Mohammed via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 14:54:13 PDT 2021


Author: Azharuddin Mohammed
Date: 2021-08-23T14:51:14-07:00
New Revision: d898693f72fc8609883c88f341171a2166ac4719

URL: https://github.com/llvm/llvm-project/commit/d898693f72fc8609883c88f341171a2166ac4719
DIFF: https://github.com/llvm/llvm-project/commit/d898693f72fc8609883c88f341171a2166ac4719.diff

LOG: [ExecutionEngine] Use the libunwind __register_frame on Darwin

This was already the case, but the recent change (957334382cd1) altered
the behavior on some of our bots where __unw_add_dynamic_fde is not
found. This restores the prior behavior on Darwin while also retaining
the new behavior from that change.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
    llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
index 6f891afabfdc3..8816586f5a542 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
@@ -85,7 +85,7 @@ static Error deregisterFrameWrapper(const void *P) {
 }
 #endif
 
-#ifdef HAVE_UNW_ADD_DYNAMIC_FDE
+#if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
 
 template <typename HandleFDEFn>
 Error walkLibunwindEHFrameSection(const char *const SectionStart,
@@ -123,13 +123,13 @@ Error walkLibunwindEHFrameSection(const char *const SectionStart,
   return Error::success();
 }
 
-#endif // HAVE_UNW_ADD_DYNAMIC_FDE
+#endif // HAVE_UNW_ADD_DYNAMIC_FDE || __APPLE__
 
 Error registerEHFrameSection(const void *EHFrameSectionAddr,
                              size_t EHFrameSectionSize) {
   /* libgcc and libunwind __register_frame behave 
diff erently. We use the
    * presence of __unw_add_dynamic_fde to detect libunwind. */
-#ifdef HAVE_UNW_ADD_DYNAMIC_FDE
+#if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
   // With libunwind, __register_frame has to be called for each FDE entry.
   return walkLibunwindEHFrameSection(
       static_cast<const char *>(EHFrameSectionAddr), EHFrameSectionSize,
@@ -146,7 +146,7 @@ Error registerEHFrameSection(const void *EHFrameSectionAddr,
 
 Error deregisterEHFrameSection(const void *EHFrameSectionAddr,
                                size_t EHFrameSectionSize) {
-#ifdef HAVE_UNW_ADD_DYNAMIC_FDE
+#if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
   return walkLibunwindEHFrameSection(
       static_cast<const char *>(EHFrameSectionAddr), EHFrameSectionSize,
       deregisterFrameWrapper);

diff  --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
index 252e20c3c38c9..42a6ed9578cac 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
@@ -69,7 +69,7 @@ static void __deregister_frame(void *p) {
 
 /* libgcc and libunwind __register_frame behave 
diff erently. We use the presence
  * of __unw_add_dynamic_fde to detect libunwind. */
-#ifdef HAVE_UNW_ADD_DYNAMIC_FDE
+#if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
 
 static const char *processFDE(const char *Entry, bool isDeregister) {
   const char *P = Entry;


        


More information about the llvm-commits mailing list