[PATCH] elf: Minimize library dependencies of tst-nolink-libc.c

Florian Weimer fweimer@redhat.com
Tue Jan 7 17:06:36 GMT 2025


On 32-bit Arm, -fasynchronous-unwind-tables creates a reference
to the symbol __aeabi_unwind_cpp_pr0.  Compile the tests without
this flag even if it is passed as part of CC, to avoid linker
failures.

---
 elf/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/elf/Makefile b/elf/Makefile
index 8f11c04d7e..048878d602 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -3377,8 +3377,10 @@ endif
 # a port adds them to the tests variables.  Neither test variant is
 # linked against libc.so, but tst-nolink-libc-1 is linked against
 # ld.so.  The test is always run directly, not under the dynamic
-# linker.
-CFLAGS-tst-nolink-libc.c += $(no-stack-protector)
+# linker.  It is necessary to minimize run-time dependencies, by
+# disabling stack protection and unwinding.
+CFLAGS-tst-nolink-libc.c += $(no-stack-protector) \
+ -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
 $(objpfx)tst-nolink-libc-1: $(objpfx)tst-nolink-libc.o $(objpfx)ld.so
 	$(LINK.o) -nostdlib -nostartfiles -o $@ $< \
 	  -Wl,--dynamic-linker=$(objpfx)ld.so,--no-as-needed $(objpfx)ld.so

base-commit: 706209867f1ba89c458033408d419e92d8055f58



More information about the Libc-alpha mailing list