[PATCH] support: Use unwinder in links-dso-program-c only with libgcc_s
Florian Weimer
fweimer@redhat.com
Wed Mar 26 15:36:32 GMT 2025
Do not build links-dso-program-c with exception (unwinding) support
if libgcc_s is not available. In this case, the unwinder may be
part of libgcc.a or libgcc_eh.a, depending on how GCC was built.
If the unwinder is in libgcc_eh.a only, linking links-dso-program-c
failed before this change. After this change, the exception
handling landing pad is only generated if libgcc_s available,
avoiding an undefined _Unwind_Resume (or equivalent) symbol
reference in the non-libgcc_s case.
Fixes commit ffd36cc27407003a6f9efcb9c16370e3435c5b1d ("support: Use
unwinder in links-dso-program-c only with libgcc_s") and
commit 5dfbc3c43ecc1bcfc760a032c91bb002660051bc ("support: Link
links-dso-program-c with libgcc_s only if available").
Regarding testing:
I verified that it works in our peculiar build environment, for a subset
of build-many-glibcs.py targets (including arm-linux-gnueabi), and also
for regular builds on RHEL 9 using system GCC 11. It seems the right
thing to do as well.
Thanks,
Florian
---
support/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/Makefile b/support/Makefile
index ea7b4cd4a0..dfe8e547f6 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -281,9 +281,9 @@ CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
ifeq (,$(CXX))
LINKS_DSO_PROGRAM = links-dso-program-c
-CFLAGS-links-dso-program-c.c += -fexceptions
LDLIBS-links-dso-program-c = -lgcc
ifeq ($(have-libgcc_s),yes)
+CFLAGS-links-dso-program-c.c += -fexceptions
LDLIBS-links-dso-program-c += -lgcc_s $(libunwind)
endif
else
base-commit: 3263675250cbcbbcc76ede4f7c660418bd345a11
More information about the Libc-alpha
mailing list