kit

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

commit 81d88fcf49dea5f3f1d389ac360bf7c588c9d3ff
parent bad3d6b438f65e991b1aaa1845c0aeb7651158a0
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Fri,  5 Jun 2026 15:10:41 -0700

Add stack backtrace sources to driver rt manifest

The backtrace work (b3f14e4e) made rt/lib/assert/assert.c call
__kit_print_backtrace() and added stack/{backtrace,print_backtrace}.c,
updating the Makefile rt build (RT_BASE_SRCS) but not the driver's
on-demand rt manifest in driver/lib/runtime.c. So `kit cc`'s auto-built
rt archive carried assert.c without the two sources it now needs,
producing "undefined reference to '__kit_print_backtrace'" whenever a
link pulled assert.c (e.g. test-driver's cc-auto-builds-and-links-
libkit-rt-x64).

Add stack/backtrace.c + stack/print_backtrace.c to every full-libc
driver list (x64, aarch64-elf/darwin, rv64-elf, rv32-elf), realigning
with RT_BASE_SRCS. The compiler-rt-only Windows lists omit assert.c, so
they stay unchanged.

Diffstat:
Mdriver/lib/runtime.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/driver/lib/runtime.c b/driver/lib/runtime.c @@ -41,7 +41,8 @@ static const char* const kRtSrcX64[] = { "stdio/printf.c", "atomic/atomic_freestanding.c", "cache/clear_cache.c", "kit/ifunc_init.c", "int64/int64.c", "coro/x86_64.c", - "coro/coro.c", + "coro/coro.c", "stack/backtrace.c", + "stack/print_backtrace.c", }; static const char* const kRtSrcX64Windows[] = { @@ -67,6 +68,7 @@ static const char* const kRtSrcAarch64Elf[] = { "int64/int64.c", "coro/aarch64.c", "coro/coro.c", "fp_tf/fp_tf.c", "fp_ti/fp_ti.c", "coro/aarch64_elf.s", + "stack/backtrace.c", "stack/print_backtrace.c", }; static const char* const kRtSrcAarch64Darwin[] = { @@ -78,6 +80,7 @@ static const char* const kRtSrcAarch64Darwin[] = { "cache/clear_cache.c", "kit/ifunc_init.c", "int64/int64.c", "coro/aarch64.c", "coro/coro.c", "coro/aarch64_macho.s", + "stack/backtrace.c", "stack/print_backtrace.c", }; static const char* const kRtSrcAarch64Windows[] = { @@ -101,7 +104,8 @@ static const char* const kRtSrcRv64Elf[] = { "cache/clear_cache.c", "kit/ifunc_init.c", "int64/int64.c", "coro/riscv64.c", "coro/coro.c", "fp_tf/fp_tf.c", - "fp_ti/fp_ti.c", + "fp_ti/fp_ti.c", "stack/backtrace.c", + "stack/print_backtrace.c", }; /* rv32 freestanding runtime: ilp32 integer layout (int32/int32.c for the @@ -117,7 +121,8 @@ static const char* const kRtSrcRv32Elf[] = { "stdio/printf.c", "atomic/atomic_freestanding.c", "cache/clear_cache.c", "kit/ifunc_init.c", "int32/int32.c", "coro/riscv32.c", - "coro/coro.c", + "coro/coro.c", "stack/backtrace.c", + "stack/print_backtrace.c", }; static const RuntimeVariant kRtVariants[] = {