Commit 8b79ff9
arch: gate x86_64 syscall_entry asm out of cfg(test)
What:
src/arch/x86_64/syscall.rs: the global_asm! defining `syscall_entry` was
gated `#[cfg(not(fuzzing))]`; widen to `#[cfg(not(any(fuzzing, test)))]`
so it matches its four sibling asm blocks and is excluded under
`cargo test`.
Why:
Under `cargo test` the crate already compiles a host shim,
`#[cfg(any(fuzzing, test))] mod fuzz_asm_stubs`, which provides a
`#[no_mangle] syscall_entry` stub. The real global_asm being gated only
`not(fuzzing)` meant it stayed compiled under test too, so `syscall_entry`
had two definitions. On Mach-O the leading-underscore symbol convention
separated them (`syscall_entry` asm vs `_syscall_entry` stub), so
`cargo test --target x86_64-apple-darwin` linked fine and the bug stayed
hidden. On ELF there is no underscore: the first CI run on a Linux runner
failed to link the lib-test binary with
`rust-lld: error: duplicate symbol: syscall_entry`.
The four sibling asm blocks (context_switch, timer_isr_stub,
yield_save_and_switch, gdt_reload_segments) were already
`not(any(fuzzing, test))`; this was the lone block missing `test`, which
is why the linker reported exactly one duplicate.
Behaviorally inert for the shipping kernel: in a real build (not test,
not fuzzing) the cfg still evaluates true and the asm is compiled,
identical to before. Only the test build changes -- it now defers to the
existing no-op stub, exactly as the other four symbols already do.
Out of scope:
No change to the syscall ABI, the asm body, or any SAFETY contract; only
the cfg predicate widens.
Verification:
- make check-all -> all three architectures build cleanly
- cargo test --lib --target x86_64-apple-darwin -> 892 passed; 0 failed
- the ELF lib-test link (the original CI failure) is confirmed by the
next CI run
Staged files:
src/arch/x86_64/syscall.rs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 159c06e commit 8b79ff9
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
0 commit comments