[PATCH v2 6/6] arm: Order the rtld link after libgcc-stubs.a
Sam James
sam@gentoo.org
Thu Aug 6 18:06:32 GMT 2026
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 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.
Reviewed-by: Sam James <sam@gentoo.org>
> ---
> 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 418 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260806/b838c7b9/attachment-0001.sig>
More information about the Libc-alpha
mailing list