Skip to content

tests: Add --cross {ARCH} convenience flag#1747

Draft
hanno-becker wants to merge 1 commit into
mainfrom
test_cross
Draft

tests: Add --cross {ARCH} convenience flag#1747
hanno-becker wants to merge 1 commit into
mainfrom
test_cross

Conversation

@hanno-becker

@hanno-becker hanno-becker commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Add a --cross {ARCH} flag to scripts/tests that expands into the --cross-prefix, --cflags, --ldflags and --exec-wrapper settings for a given cross target, so local cross-compilation no longer requires remembering toolchain prefixes, MLK_FORCE_* defines and QEMU wrappers.

The presets (x86_64, aarch64, aarch64_be, ppc64le, riscv64, riscv32) mirror the per-arch settings in .github/actions/multi-functest, and are meant to be run inside the matching nix develop .#cross-{ARCH} shell. Explicit flags still win: cflags/ldflags are appended after the user's value, while cross-prefix and exec-wrapper are only set when unset (a conflicting explicit cross-prefix is an error). A non-fatal warning is printed when the cross toolchain is not on PATH, or when --no-auto would drop the ISA feature flags that the Makefile otherwise adds.

For now, no attempt is made to use this in CI.

BUILDING.md documents the flag and lists the per-target defaults.

Add a --cross {ARCH} flag to scripts/tests that expands into the
--cross-prefix, --cflags, --ldflags and --exec-wrapper settings for a
given cross target, so local cross-compilation no longer requires
remembering toolchain prefixes, MLK_FORCE_* defines and QEMU wrappers.

The presets (x86_64, aarch64, aarch64_be, ppc64le, riscv64, riscv32)
mirror the per-arch settings in .github/actions/multi-functest, and are
meant to be run inside the matching `nix develop .#cross-{ARCH}` shell.
Explicit flags still win: cflags/ldflags are appended after the user's
value, while cross-prefix and exec-wrapper are only set when unset (a
conflicting explicit cross-prefix is an error). A non-fatal warning is
printed when the cross toolchain is not on PATH, or when --no-auto would
drop the ISA feature flags that the Makefile otherwise adds.

BUILDING.md documents the flag and lists the per-target defaults.

Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
@hanno-becker hanno-becker requested a review from a team as a code owner June 14, 2026 04:17
@hanno-becker hanno-becker marked this pull request as draft June 14, 2026 04:18
@hanno-becker

Copy link
Copy Markdown
Contributor Author

@mkannwischer This has annoyed me for a while, but the present proposal is not yet ideal because it does not yet cover the baremetal platforms.

One could perhaps have --platform cross/{ARCH} and --platform baremetal/{PLATFORM}? WDYT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant