kit

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

commit 18d3db836cc06be73a3fa41b7c0594780b2429d6
parent 68d27f53b730feff1ff4f9c6d7b122ec10197597
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Tue, 16 Jun 2026 18:51:45 -0700

arm32 Phase 2: flip cross lane to -O1, kit-ld-compatible smoke link.ld, auto-rt source sync

- scripts/cross_test.sh: arm32 cross lane now runs at -O1 (the -O1 known-frame
  path landed); drops the -O0 forcing.
- test/smoke/arm32.sh: assign _estack inside SECTIONS so both ld.lld and kit ld
  accept the script (kit ld has no top-level sym=expr directive) — fixes the
  kit-ld auto-rt smoke lane.
- driver/lib/runtime.c: kRtSrcArm32 drops the AEABI alias layer + coro asm to
  match mk/rt.mk, so kit-ld on-demand auto-rt builds the same C-only archive.

Diffstat:
Mdriver/lib/runtime.c | 17+++++++----------
Mscripts/cross_test.sh | 7+++----
Mtest/smoke/arm32.sh | 7+++++--
3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/driver/lib/runtime.c b/driver/lib/runtime.c @@ -176,12 +176,13 @@ static const char* const kRtSrcRv32Elf[] = { /* arm32 (ARMv7-M Thumb-2) freestanding runtime: the same ilp32 integer layout * (int32/int32.c for the 64-bit-on-32-bit helpers, int/int.c for i64 div/mod) - * and soft double (fp/fp.c) as rv32, plus the ARM EABI helper layer — the - * __aeabi_* div/mod/shift trampolines (arm/aeabi_thumb2.S over the generic - * compiler-rt bodies, arm/aeabi.c). coro/arm32.c replaces rv32's coro asm. This - * is the exact effective source set of `make rt-arm-eabi-thumb2` - * (RT_SRCS_arm-eabi-thumb2 in mk/rt.mk), so the on-demand archive carries the - * same symbols as the Makefile-built one. */ + * and soft double (fp/fp.c) as rv32. Kept in sync with the kit-self-built + * `make rt-arm-eabi-thumb2` set (RT_SRCS_arm-eabi-thumb2 in mk/rt.mk): the + * hand-written ARM AEABI alias layer (arm/aeabi_thumb2.S + arm/aeabi.c) and the + * coroutine register-switch asm (coro/arm32.c + coro/coro.c's file-scope asm) + * are EXCLUDED because the kit assembler does not yet cover those idioms (a + * follow-on); kit-compiled code references the libgcc-named helpers the C + * sources provide (__udivdi3 / __adddf3 / ...), not the __aeabi_* aliases. */ static const char* const kRtSrcArm32[] = { "assert/assert.c", "int/int.c", @@ -197,10 +198,6 @@ static const char* const kRtSrcArm32[] = { "cache/clear_cache.c", "kit/ifunc_init.c", "int32/int32.c", - "coro/arm32.c", - "coro/coro.c", - "arm/aeabi_thumb2.S", - "arm/aeabi.c", "stack/backtrace.c", "stack/print_backtrace.c", }; diff --git a/scripts/cross_test.sh b/scripts/cross_test.sh @@ -186,10 +186,9 @@ smoke_build_case() { # only the qemu boot for the execution phase. local obj="$cdir/$name.o" elf="$cdir/$name.elf" barch reason smopt barch="$(tok_arch "$t")" - # arm32 is a -O0-only Phase-1 walking skeleton (the -O1 known-frame path is - # a Phase-2 code-quality track, per doc/plan/ARM32.md); every other - # freestanding arch exercises the optimizer at -O1. - smopt=O1; [ "$barch" = arm32 ] && smopt=O0 + # Every freestanding arch (arm32 included, since Phase 2 landed the -O1 + # known-frame path) exercises the optimizer at -O1. + smopt=O1 if ! "$HOSTED" cc "$t" -$smopt -ffreestanding -c "$src" -o "$obj" \ >"$cdir/$name.cc.out" 2>"$cdir/$name.cc.err"; then kit_fail "$label:cc" "cc failed"; sed 's/^/ | /' "$cdir/$name.cc.err" | head; return diff --git a/test/smoke/arm32.sh b/test/smoke/arm32.sh @@ -122,10 +122,13 @@ MEMORY SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4M } -_estack = ORIGIN(SRAM) + LENGTH(SRAM); - SECTIONS { + /* _estack is assigned inside SECTIONS (not at top level) so BOTH ld.lld and + * kit ld accept it — kit ld's linker-script front end has no top-level + * `sym = expr` directive. */ + _estack = ORIGIN(SRAM) + LENGTH(SRAM); + .text : { KEEP(*(.vectors))