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 2734bbbcba 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:	2734bbbcba ("libthr: Create landing pad in thr_once in C++ exception")
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Konstantin Belousov committed 2026-11-07 01:21:08 +02:00
1 parent c3a05933b3
commit 9dae9b31d2
1 file changed
+1 -1
+1 -1
View File
@@ -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) {