[llvm] Revert "[ORC] Use __unw_add_dynamic_eh_frame_section/__unw_remove_dyn… (PR #227894)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 21:48:36 PDT 2026


https://github.com/lhames updated https://github.com/llvm/llvm-project/pull/227894

>From 35142c79c6036e70bfa59651409b7f625f40dbe3 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Fri, 2 Oct 2026 09:47:01 +1000
Subject: [PATCH] Revert "[ORC] Use
 __unw_add_dynamic_eh_frame_section/__unw_remove_dynamic_eh_ frame_section in
 RegisterEHFrames.cpp (#212260)"

Reverts commit d49626c811c304c047e028a80cedc0d377f49dfb due to build
failures (see discussion on PR).
---
 .../Orc/TargetProcess/RegisterEHFrames.cpp    | 27 +------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
index 01b5f67f8f04d..1856181e36788 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.cpp
@@ -22,15 +22,6 @@ using namespace llvm::orc::shared;
 namespace llvm {
 namespace orc {
 
-// Reference __unw_* only if __attribute__((weak)) is available to avoid force
-// pulling them.
-#if LLVM_HAS_ATTRIBUTE_WEAK
-extern "C" void
-__unw_add_dynamic_eh_frame_section(const void *) LLVM_ATTRIBUTE_WEAK;
-extern "C" void
-__unw_remove_dynamic_eh_frame_section(const void *) LLVM_ATTRIBUTE_WEAK;
-#endif
-
 #if defined(HAVE_REGISTER_FRAME) && defined(HAVE_DEREGISTER_FRAME) &&          \
     !defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
 
@@ -131,17 +122,8 @@ Error walkLibunwindEHFrameSection(const char *const SectionStart,
 
 Error registerEHFrameSection(const void *EHFrameSectionAddr,
                              size_t EHFrameSectionSize) {
-  // For libunwind after D111863.
-#if LLVM_HAS_ATTRIBUTE_WEAK
-  if (__unw_add_dynamic_eh_frame_section &&
-      __unw_remove_dynamic_eh_frame_section) {
-    __unw_add_dynamic_eh_frame_section(EHFrameSectionAddr);
-    return Error::success();
-  }
-#endif
   /* libgcc and libunwind __register_frame behave differently. We use the
-   * presence of __unw_add_dynamic_fde to detect libunwind. The code below
-   * is for older Apple/LLVM libunwind versions. */
+   * presence of __unw_add_dynamic_fde to detect libunwind. */
 #if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
   // With libunwind, __register_frame has to be called for each FDE entry.
   return walkLibunwindEHFrameSection(
@@ -159,13 +141,6 @@ Error registerEHFrameSection(const void *EHFrameSectionAddr,
 
 Error deregisterEHFrameSection(const void *EHFrameSectionAddr,
                                size_t EHFrameSectionSize) {
-#if LLVM_HAS_ATTRIBUTE_WEAK
-  if (__unw_add_dynamic_eh_frame_section &&
-      __unw_remove_dynamic_eh_frame_section) {
-    __unw_remove_dynamic_eh_frame_section(EHFrameSectionAddr);
-    return Error::success();
-  }
-#endif
 #if defined(HAVE_UNW_ADD_DYNAMIC_FDE) || defined(__APPLE__)
   return walkLibunwindEHFrameSection(
       static_cast<const char *>(EHFrameSectionAddr), EHFrameSectionSize,



More information about the llvm-commits mailing list