[PATCH] D108511: [ExecutionEngine] Use libunwind logic if __APPLE__

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 21 09:49:25 PDT 2021


hvdijk created this revision.
hvdijk added a reviewer: lhames.
Herald added a subscriber: hiraditya.
hvdijk requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

One of the bots has a test failure that appears to suggest that Apple may have libunwind's __register_frame without __unw_add_dynamic_fde, so the check I did in D106129 <https://reviews.llvm.org/D106129> fails. Until this can be looked into deeper, restore the previous behaviour if __APPLE__ is defined, but keep the new behaviour otherwise.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108511

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


Index: llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
===================================================================
--- llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
+++ llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
@@ -69,7 +69,7 @@
 
 /* libgcc and libunwind __register_frame behave differently. 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;
Index: llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
+++ llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
@@ -85,7 +85,7 @@
 }
 #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 @@
   return Error::success();
 }
 
-#endif // HAVE_UNW_ADD_DYNAMIC_FDE
+#endif // defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
 
 Error registerEHFrameSection(const void *EHFrameSectionAddr,
                              size_t EHFrameSectionSize) {
   /* libgcc and libunwind __register_frame behave differently. 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 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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108511.367962.patch
Type: text/x-patch
Size: 2205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210821/0101b98c/attachment.bin>


More information about the llvm-commits mailing list