P5.2: emit_object() -> string query primitive

The compiler emits the sx object eagerly (the Zig driver, before the post-link
callback), so emit_object is a QUERY (not an action): it returns the path from
a new BuildConfig.object_path field main.zig forwards — no driver vtable. This
completes the build-pipeline QUERY primitives (emit_object / c_object_paths /
link_libraries); only link (the genuine action) remains for the vtable step.

Extended examples/1662 to also assert emit_object().len > 0. 703/0 both gates.
This commit is contained in:
agra
2026-06-19 07:58:59 +03:00
parent 44dfdcddf9
commit 83de0fa04d
8 changed files with 57 additions and 19 deletions

View File

@@ -66,6 +66,12 @@ pub const BuildConfig = struct {
c_object_paths: []const []const u8 = &.{},
link_libraries: []const []const u8 = &.{},
/// Path of the object file the compiler emitted for this build (`.sx-tmp/main.o`
/// or the cached `.o`). Forwarded by main.zig before the post-link callback so
/// the sx build driver can read it via the `emit_object()` compiler primitive
/// (the compiler emits the object eagerly; the primitive returns its path).
object_path: ?[]const u8 = null,
/// Frameworks the binary links against (`-framework` names) and
/// the search paths to look them up in (`-F` directories), forwarded
/// from the link step so the sx bundler can embed them into