[PATCH v2 6/6] arm: Order the rtld link after libgcc-stubs.a
Adhemerval Zanella
adhemerval.zanella@linaro.org
Thu Aug 6 17:08:00 GMT 2026
The librtld.map and librtld.os link recipes use $(gnulib), which on arm
contains libgcc-stubs.a through gnulib-arch. But the archive is only a
prerequisite of lib-noranlib so the rtld link can run before the archive
exists:
ld.bfd: cannot find .../elf/libgcc-stubs.a: No such file or directory
The race seems to predates the parallel subdirectory recursion, which
only made it observable.
Add the order-only dependency in sysdeps/arm/Makefile rather than in
elf/Makefile. Theprerequisite lists expand when the rule is parsed,
and gnulib-arch is only defined once Makerules includes the sysdeps
makefiles.
Verified with a build for arm-linux-gnueabihf.
---
sysdeps/arm/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
index 0bb1b6e05be..90423154925 100644
--- a/sysdeps/arm/Makefile
+++ b/sysdeps/arm/Makefile
@@ -10,6 +10,11 @@ shared-only-routines += aeabi_unwind_cpp_pr1
$(objpfx)libgcc-stubs.a: $(objpfx)aeabi_unwind_cpp_pr1.os
$(build-extra-lib)
+# The rtld link recipes in elf/Makefile use $(gnulib), which here
+# includes libgcc-stubs.a, but they cannot name it as a prerequisite:
+# gnulib-arch is only defined once this file is included from Makerules.
+$(objpfx)librtld.map $(objpfx)librtld.os: | $(objpfx)libgcc-stubs.a
+
lib-noranlib: $(objpfx)libgcc-stubs.a
ifeq ($(build-shared),yes)
--
2.53.0
More information about the Libc-alpha
mailing list