Skip to contentSkip to conversation

libcxx: Fix build failure on arm targets

PATCH New Khem Raj 1 participant 1 message Apr 1

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 libcxx: Fix build failure on arm targets

Add needed forward declaration

---
 ...e-__gnu_unwind_frame-in-cxa_personal.patch | 33 +++++++++++++++++++
 meta/recipes-devtools/clang/common.inc        |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 meta/recipes-devtools/clang/clang/0040-libcxxabi-declare-__gnu_unwind_frame-in-cxa_personal.patch
meta/recipes-devtools/clang/clang/0040-libcxxabi-declare-__gnu_unwind_frame-in-cxa_personal.patch new file +33 -0
new file mode 100644
index 0000000000..f458fd0cf8
@@ -0,0 +1,33 @@
+From 5dbd0a05f64a43849a7edde95a0e5f2323cd1f9d Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 31 Mar 2026 19:33:29 -0700
+Subject: [PATCH] libcxxabi: declare __gnu_unwind_frame in cxa_personality
+
+ARM EHABI builds of libcxxabi fail with clang-22+ because
+cxa_personality.cpp calls __gnu_unwind_frame without a visible
+declaration, triggering:
+
+  error: use of undeclared identifier '__gnu_unwind_frame'
+
+Add an extern "C" forward declaration before the EHABI unwind helper
+so the source compiles correctly.
+
+Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/189787]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ libcxxabi/src/cxa_personality.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
+index 35f4e3807724..ddff277cc7b8 100644
+--- a/libcxxabi/src/cxa_personality.cpp
++++ b/libcxxabi/src/cxa_personality.cpp
+@@ -1116,6 +1116,8 @@ __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
+
+ #else
+
++extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,
++                                                  _Unwind_Context*);
+ // Helper function to unwind one frame.
+ // ARM EHABI 7.3 and 7.4: If the personality function returns _URC_CONTINUE_UNWIND, the
+ // personality routine should update the virtual register set (VRS) according to the
meta/recipes-devtools/clang/common.inc +1 -0
index afb79129b3..3b1070ef93 100644
@@ -60,6 +60,7 @@ SRC_URI = "\
     file://0037-clang-Only-build-clang-tblgen-if-it-is-actually-need.patch \
     file://0038-llvm-libgcc-Fix-symlink-path-for-libcc-when-LLVM_ENA.patch \
     file://0039-Clang-Rename-OffloadArch-UNUSED-to-UNUSED_-to-avoid-.patch \
+    file://0040-libcxxabi-declare-__gnu_unwind_frame-in-cxa_personal.patch \
 "
 # Fallback to no-PIE if not set
 GCCPIE ??= ""