kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit d9a2df70ba7107d12724d4e08218c5d2a8d9c3af
parent 5f921ccf5d33c3f9022764988bd06e70d864a4f0
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Mon,  1 Jun 2026 10:10:28 -0700

rt: depend archive on rt/Makefile so a grown member list regenerates it

The rt archive rule listed only $(RT_OBJS) and $(BIN) as prereqs. `ar rcs`
only adds/updates members, so when RT_*_SRCS grew, an existing archive whose
objects happened to be newer than the archive would never re-fire the rule
and silently kept the old, smaller member set. The aarch64-linux variant had
gone stale this way: 11 of 18 members, missing clear_cache.c.o (the weak
__clear_cache provider) among others, so test-parse's builtin_clear_cache_01
failed to link on the D/E/J paths (undefined reference to '__clear_cache').
The state was self-perpetuating: with the archive newer than every object,
make's mtime logic considered it up to date and never healed it.

Add rt/Makefile (where the member list lives) as a prereq so any list edit
re-fires the existing `rm -f $@` + full re-archive, keeping the archive in
sync with RT_OBJS. Mirrors the main build, where every object deps on Makefile.
Same class of bug as cc08317.

Diffstat:
Mrt/Makefile | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/rt/Makefile b/rt/Makefile @@ -249,7 +249,14 @@ rt-$(1): $$(RT_BUILD_DIR)/$(1)/libcfree_rt.a # runtime, so a codegen or `ar` change in the compiler must rebuild the rt. # The archive lists $(RT_OBJS) explicitly rather than $^ so the cfree binary # (now a regular prereq) is not itself archived. -$$(RT_BUILD_DIR)/$(1)/libcfree_rt.a: $$(RT_OBJS_$(1)) $$(BIN) +# +# Depend on rt/Makefile too: the member list (RT_*_SRCS) lives here, and +# `ar rcs` only adds/updates members. When the list grows, an existing +# archive whose objects happen to be newer would otherwise never regenerate +# and would silently drop the new members (e.g. a missing __clear_cache +# breaking links). With the makefile as a prereq, any list edit re-fires the +# `rm -f` + full re-archive below so the archive always matches RT_OBJS. +$$(RT_BUILD_DIR)/$(1)/libcfree_rt.a: $$(RT_OBJS_$(1)) rt/Makefile $$(BIN) @mkdir -p $$(dir $$@) @rm -f $$@ $$(RT_AR) rcs $$@ $$(RT_OBJS_$(1))