Skip to content

libcxxabi: declare __gnu_unwind_frame in cxa_personality - #189787

Merged
alexrp merged 1 commit into
llvm:mainfrom
kraj:kraj/libcxx-arm-forward-decls
Apr 27, 2026
Merged

libcxxabi: declare __gnu_unwind_frame in cxa_personality#189787
alexrp merged 1 commit into
llvm:mainfrom
kraj:kraj/libcxx-arm-forward-decls

Conversation

@kraj

@kraj kraj commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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.

@kraj
kraj requested a review from a team as a code owner April 1, 2026 02:39
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label Apr 1, 2026
@llvmbot

llvmbot commented Apr 1, 2026

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-libcxxabi

Author: Khem Raj (kraj)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/189787.diff

1 Files Affected:

  • (modified) libcxxabi/src/cxa_personality.cpp (+2)
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
index 35f4e38077248..ddff277cc7b81 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

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@kraj
kraj force-pushed the kraj/libcxx-arm-forward-decls branch from a2a457b to 3ac77d4 Compare April 1, 2026 03:48
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.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
@kraj
kraj force-pushed the kraj/libcxx-arm-forward-decls branch from 3ac77d4 to e9d3306 Compare April 1, 2026 03:49
@MaskRay
MaskRay requested a review from philnik777 April 1, 2026 03:54
@MaskRay

MaskRay commented Apr 1, 2026

Copy link
Copy Markdown
Member

Seems better than #189280 as there is no unrelated formatting.
But ideally __gnu_unwind_frame should only be declared with ARM EABI is used, and with a comment.

@kraj

kraj commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Seems better than #189280 as there is no unrelated formatting. But ideally __gnu_unwind_frame should only be declared with ARM EABI is used, and with a comment.

Good point. This is already in the _LIBCXXABI_ARM_EHABI branch, but I can make that explicit in the #else comment and add a short note explaining that __gnu_unwind_frame is the ARM EHABI unwinder entry point used by continue_unwind(). but i feel that might become noisy

kraj added a commit to kraj/llvm-project that referenced this pull request Apr 8, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Apr 9, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Apr 11, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
@planetmarshall

planetmarshall commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

#116261 moved this declaration to libunwind, so there should probably be a preprocessor guard in case it's already been declared (by building libcxxabi with libunwind).

@planetmarshall

Copy link
Copy Markdown
Contributor

Seems better than #189280 as there is no unrelated formatting.

The formatting changes were required by the CI checks. In the end I'm not bothered which PR gets merged, so long as it's fixed!

kraj added a commit to kraj/llvm-project that referenced this pull request Apr 21, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Apr 24, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
@alexrp alexrp linked an issue Apr 26, 2026 that may be closed by this pull request
@alexrp alexrp added this to the LLVM 22.x Release milestone Apr 26, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in LLVM Release Status Apr 26, 2026
@alexrp

alexrp commented Apr 27, 2026

Copy link
Copy Markdown
Member

This is a fairly significant regression in 22.x and the fix is basically zero-risk, so let's just get this in.

@alexrp
alexrp merged commit 8119f18 into llvm:main Apr 27, 2026
78 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in LLVM Release Status Apr 27, 2026
dyung pushed a commit to llvmbot/llvm-project that referenced this pull request Apr 28, 2026
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.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
(cherry picked from commit 8119f18)
yingopq pushed a commit to yingopq/llvm-project that referenced this pull request Apr 29, 2026
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.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
KHicketts pushed a commit to KHicketts/llvm-project that referenced this pull request Apr 30, 2026
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.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request May 23, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request May 31, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Jun 8, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Jun 12, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Jun 15, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
kraj added a commit to kraj/llvm-project that referenced this pull request Jun 16, 2026
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 [llvm#189787]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++abi libc++abi C++ Runtime Library. Not libc++.

Projects

Development

Successfully merging this pull request may close these issues.

libcxxabi fails to compile for ARM/FreeBSD and ARM/OpenBSD in 22.x

5 participants