You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unsupported assembly arguments silently select the host assembler #969
Confirmed forbidden silent fallback (audit finding BGO-007). Reproduced at 450733e with -O1 on 2026-09-03.
Source chain
build_graph_assemble_to_object (src/BuildGraphOps.w:162-172) reads only the first argument and sets a cross triple only when it begins triple= with a nonempty suffix. Unknown first arguments, bare triple=, and all additional arguments are silently ignored, selecting the host assembler. Both unsupported-option and triple= fixtures exited green and produced host x86-64 ELF relocatables — compiling for a different target than requested.
Repair boundary
Accept exactly zero args or exactly one nonempty canonical supported triple=<value> argument; reject every other spelling and extra argument before creating output; validate agreement with the target platform authority.
Verdict. Established on current main. CompileAsmObject inspects only args[0], and only when it starts with triple= and has a non-empty suffix. Every other spelling (an unknown first argument, a bare triple=, a triple= in the second slot, or trailing extra arguments) is silently ignored and the host assembler runs, producing an object for the wrong target with exit 0. This is the silent-fallback class AGENTS.md forbids.
Tested revision and compiler
item
value
source
main @ 5809ac1 (2026-09-14), contains the reported 450733e
compiler
out/release/bin/with, self-reports with v0.15.1.7-g66d9b27d8, built from this tree by the last battery (not the seed)
platform
macOS Darwin 25.6.0, arm64 (host objects are Mach-O arm64; the report's host produced x86-64 ELF, same defect)
Repro
f.s: .text / .globl _f / _f: / ret.
use std.build
pub fn build(ctx: BuildCtx) -> Build:
var out = ctx.new_build()
var a = target_new(.CompileAsmObject, "asm-unsupported", "f.s").output("out/unsupported.o")
a = a.arg("unsupported-option")
out = out.add_target(move a)
var b = target_new(.CompileAsmObject, "asm-bare-triple", "f.s").output("out/bare.o")
b = b.arg("triple=")
out = out.add_target(move b)
var c = target_new(.CompileAsmObject, "asm-second-slot", "f.s").output("out/second.o")
c = c.arg("x").arg("triple=aarch64-unknown-linux-gnu")
out = out.add_target(move c)
var d = target_new(.CompileAsmObject, "asm-linux", "f.s").output("out/linux.o")
d = d.arg("triple=aarch64-unknown-linux-gnu")
out = out.add_target(move d)
var e = target_new(.CompileAsmObject, "asm-extra", "f.s").output("out/extra.o")
e = e.arg("triple=aarch64-unknown-linux-gnu").arg("bogus")
out = out.add_target(move e)
out
target
rc
file out/*.o
expected
:asm-unsupported
0
Mach-O 64-bit object arm64 (host)
rejected: unknown argument
:asm-bare-triple
0
Mach-O arm64 (host)
rejected: empty triple
:asm-second-slot
0
Mach-O arm64 (host)
either honour the Linux triple or reject x; never silently host
:asm-linux (control)
0
ELF 64-bit relocatable, ARM aarch64
correct
:asm-extra
0
ELF aarch64
triple honoured, but bogus silently dropped; should be rejected
Root cause (read in source, confirmed by the runs)
src/BuildGraphOps.w:176-184: the op reads target.args.get(0), tests starts_with("triple="), and falls through to build_graph_rt_assemble_to_object (host) whenever the resulting asm_triple is empty. No branch diagnoses an unrecognised or extra argument. No decision-log entry sanctions a host fallback.
Spec / docs
docs/with-build.md line 549 documents the kind only as "Assemble source to an object file"; the triple= argument is documented only by the comment at :174-175 and by its use in build.w:141 and build/wo.w:274. AGENTS.md §No Silent Fallbacks: "'Simplifying' a construct into something that compiles but behaves differently from the source" is forbidden; an object for the wrong target is exactly that.
Related PRs
None since 450733e touch this op (git log -S"triple=" on the file is empty). No open PR touches it.
Would I champion a fix? Yes.
It is cheap and it guards the cross-target runtime lanes (cross/<tag>/fiber_asm.o), where a typo in build.w would today link a host object into a cross bundle. Acceptance criteria:
Accept exactly zero arguments or exactly one triple=<non-empty> argument; anything else fails before mkdir_p with a diagnostic naming the target and the offending argument.
The triple is validated against the target-platform authority (the same table Target.target(...) uses), so an unknown or unsupported triple is rejected rather than handed to LLVM.
A behaviour test covers the five spellings above and asserts object format for the accepted ones.
Untested
Linux and Windows hosts not executed. Whether build_graph_rt_assemble_to_object_for_triple itself rejects a malformed non-empty triple was not probed; criterion 2 covers it.
Correction to the compiler-identity line above. The binary I ran, out/release/bin/with reporting with v0.15.1.7-g66d9b27d8, was built from commit 66d9b27 (2026-09-05), not from the HEAD I inspected (5809ac1). The source I cited and the behaviour I observed are for the functions in this issue, which are unchanged between those two commits apart from PR #1082's swap of a POSIX path[0] == '/' test for the shared runtime_path_is_absolute predicate (identical for the inputs used here). I verified that with git diff 66d9b27d8 5809ac10 -- src/BuildGraphOps.w src/BuildGraphSupport.w before posting. The verdict stands; the identity line should read: binary built from 66d9b27, source links pinned to 5809ac1.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): reproduced. build_graph_assemble_to_object (src/BuildGraphOps.w:162) still reads only a nonempty triple= first argument.
Fixed on main by 47c3633 (#2707), merged through stack 7 whose seed-driven battery was green on its top (gate, uat and survey all green). Regression test: test/behavior/behav_969_asm_object_args_checked.w.
Activity
ehartford commentedon Sep 15, 2026
Review: reproduced
Verdict. Established on current
main.CompileAsmObjectinspects onlyargs[0], and only when it starts withtriple=and has a non-empty suffix. Every other spelling (an unknown first argument, a baretriple=, atriple=in the second slot, or trailing extra arguments) is silently ignored and the host assembler runs, producing an object for the wrong target with exit 0. This is the silent-fallback class AGENTS.md forbids.Tested revision and compiler
main@ 5809ac1 (2026-09-14), contains the reported 450733eout/release/bin/with, self-reportswith v0.15.1.7-g66d9b27d8, built from this tree by the last battery (not the seed)Repro
f.s:.text/.globl _f/_f:/ret.file out/*.o:asm-unsupported:asm-bare-triple:asm-second-slotx; never silently host:asm-linux(control):asm-extrabogussilently dropped; should be rejectedRoot cause (read in source, confirmed by the runs)
src/BuildGraphOps.w:176-184: the op readstarget.args.get(0), testsstarts_with("triple="), and falls through tobuild_graph_rt_assemble_to_object(host) whenever the resultingasm_tripleis empty. No branch diagnoses an unrecognised or extra argument. No decision-log entry sanctions a host fallback.Spec / docs
docs/with-build.mdline 549 documents the kind only as "Assemble source to an object file"; thetriple=argument is documented only by the comment at:174-175and by its use inbuild.w:141andbuild/wo.w:274. AGENTS.md §No Silent Fallbacks: "'Simplifying' a construct into something that compiles but behaves differently from the source" is forbidden; an object for the wrong target is exactly that.Related PRs
None since 450733e touch this op (
git log -S"triple="on the file is empty). No open PR touches it.Would I champion a fix? Yes.
It is cheap and it guards the cross-target runtime lanes (
cross/<tag>/fiber_asm.o), where a typo inbuild.wwould today link a host object into a cross bundle. Acceptance criteria:triple=<non-empty>argument; anything else fails beforemkdir_pwith a diagnostic naming the target and the offending argument.Target.target(...)uses), so an unknown or unsupported triple is rejected rather than handed to LLVM.Untested
Linux and Windows hosts not executed. Whether
build_graph_rt_assemble_to_object_for_tripleitself rejects a malformed non-empty triple was not probed; criterion 2 covers it.ehartford commentedon Sep 15, 2026
Correction to the compiler-identity line above. The binary I ran,
out/release/bin/withreportingwith v0.15.1.7-g66d9b27d8, was built from commit 66d9b27 (2026-09-05), not from the HEAD I inspected (5809ac1). The source I cited and the behaviour I observed are for the functions in this issue, which are unchanged between those two commits apart from PR #1082's swap of a POSIXpath[0] == '/'test for the sharedruntime_path_is_absolutepredicate (identical for the inputs used here). I verified that withgit diff 66d9b27d8 5809ac10 -- src/BuildGraphOps.w src/BuildGraphSupport.wbefore posting. The verdict stands; the identity line should read: binary built from 66d9b27, source links pinned to 5809ac1.ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced.build_graph_assemble_to_object(src/BuildGraphOps.w:162) still reads only a nonemptytriple=first argument.pre-release: a silent fallback that assembles for the wrong target; the fix is argument validation in one function.
build: a compile_asm_object target takes no argument or one triple=<l…
build: a compile_asm_object target takes no argument or one triple=<l…
ehartford commentedon Oct 26, 2026
Fixed on main by 47c3633 (#2707), merged through stack 7 whose seed-driven battery was green on its top (gate, uat and survey all green). Regression test:
test/behavior/behav_969_asm_object_args_checked.w.