[PATCH v3] elf: Second ld.so relocation only if libc.so has been loaded
Florian Weimer
fweimer@redhat.com
Tue Jan 7 14:31:37 GMT 2025
* Andreas Schwab:
> The tests fail to link on armv7:
>
> gcc -nostdlib -nostartfiles -o /home/abuild/rpmbuild/BUILD/glibc-2.40.9000.712.g706209867/cc-base/elf/tst-nolink-libc-1 /home/abuild/rpmbuild/BUILD/glibc-2.40.9000.712.g706209867/cc-base/elf/tst-nolink-libc.o \
> -Wl,--dynamic-linker=/home/abuild/rpmbuild/BUILD/glibc-2.40.9000.712.g706209867/cc-base/elf/ld.so,--no-as-needed /home/abuild/rpmbuild/BUILD/glibc-2.40.9000.712.g706209867/cc-base/elf/ld.so
> /usr/lib/gcc/armv7hl-suse-linux-gnueabi/14/../../../../armv7hl-suse-linux-gnueabi/bin/ld: /home/abuild/rpmbuild/BUILD/glibc-2.40.9000.712.g706209867/cc-base/elf/tst-nolink-libc.o:(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
> collect2: error: ld returned 1 exit status
What are your compiler flags?
I could add -fno-exceptions -fno-unwind-tables
-fno-asynchronous-unwind-tables to CFLAGS. Something like this?
diff --git a/elf/Makefile b/elf/Makefile
index 2a50b98f19..e6a8a3bffd 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -3379,7 +3379,8 @@ endif
# 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)
+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
Thanks,
Florian
More information about the Libc-alpha
mailing list