Re: [PATCH v2 6/6] arm: Order the rtld link after libgcc-stubs.a

Sam James <[email protected]> Thu, 06 Aug 2026 19:06:32 +0100
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo
Message-ID <[email protected]>
Adhemerval Zanella <[email protected]> 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 <[email protected]>

> ---
>  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)
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmp0zSgbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkKci
AQC9KPKPs3capURVB1fDE0bIAPUqgEfb6Ft4HXqoBKePewD/UTOS52bg4JCf5MM3
v0JnAV1Rxx+DKnYQZDL1x7CfJgc=
=7bAx
-----END PGP SIGNATURE-----