[PATCH v2 5/6] Makefile: Order the top-level stamp files before the subdirectory fan-out

Sam James sam@gentoo.org
Thu Aug 6 18:05:55 GMT 2026


Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> The archive rules in Makerules list every stamp file as a prerequisite,
> including the top level's own, and the elf sub-make evaluates them to
> build libc_pic.a for the librtld.map link.  A sub-make can only create
> the stamp files of its own directory, so when the top-level ones do not
> exist yet it fails with:
>
>   make[2]: *** No rule to make target '.../stamp.os', needed by
>   '.../libc_pic.a'.  Stop.
>
> The serial recursion created them before the subdirectories through the
> prerequisite order of subdir_lib; the parallel recursion (commit
> 7cac99621e96) does not.  Add them as prerequisites of the object-building
> per-subdirectory targets.

Reviewed-by: Sam James <sam@gentoo.org>

> ---
>  Makefile | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index b9fac6f47c6..d559c428736 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -575,6 +575,14 @@ $(foreach t,$(+elf_last_subdir_targets),$(eval \
>    elf/$(t): $(addsuffix /$(t),$(filter-out elf,$(subdirs)))))
>  endif
>  
> +# The archive rules in Makerules list every stamp file as a
> +# prerequisite of libc_pic.a, which the elf sub-make evaluates for the
> +# librtld.map link, but a sub-make can only create its own directory's
> +# stamps.  Create the top-level ones before the fan-out.
> +$(foreach t,$(+elf_last_subdir_targets),$(eval \
> +  $(addsuffix /$(t),$(subdirs)): \
> +    $(foreach o,$(object-suffixes-for-libc),$(common-objpfx)stamp$(o))))
> +
>  # Pass barriers: a subdirectory 'others' build links programs against
>  # the libraries, so the 'lib' pass (including the top-level libc.so
>  # link) must have completed.
-------------- 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/4bfa57e4/attachment.sig>


More information about the Libc-alpha mailing list