git: 9dae9b31d2c7 - main - libthr: require both _Unwind_ForcedUnwind and _Unwind_GetCFA for !PIC
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Nov 2026 23:22:20 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9dae9b31d2c7834de72a27c6d635ebeab53cebc6
commit 9dae9b31d2c7834de72a27c6d635ebeab53cebc6
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-06 14:26:18 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-06 23:21:08 +0000
libthr: require both _Unwind_ForcedUnwind and _Unwind_GetCFA for !PIC
Static linking must bring in both symbols for the unwind to work.
The landing pads added by 2734bbbcba3c reference _Unwind_Resume and
__gcc_personality_v0. In a static link, these pull UnwindLevel1.o
from libgcc_eh.a, which also defines _Unwind_ForcedUnwind, but
not UnwindLevel1-gcc-ext.o, which defines _Unwind_GetCFA. Unless
something else pulls that object in, as libcxxrt does for C++ programs,
thread_unwind_stop() calls a NULL _Unwind_GetCFA on every thread exit.
Reported and tested by: dch
Fixes: 2734bbbcba3c ("libthr: Create landing pad in thr_once in C++ exception")
Sponsored by: The FreeBSD Foundation
---
lib/libthr/thread/thr_exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 4c9692ccf1a5..8929ed5a9f11 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -241,7 +241,7 @@ _pthread_exit_mask(void *status, sigset_t *mask)
thread_uw_init();
if (uwl_forcedunwind != NULL) {
#else
- if (_Unwind_ForcedUnwind != NULL) {
+ if (_Unwind_ForcedUnwind != NULL && _Unwind_GetCFA != NULL) {
#endif
if (curthread->unwind_disabled) {
if (message_printed == 0) {