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:
@@ -2,10 +2,11 @@
|
||||
#import "modules/build.sx";
|
||||
#import "modules/std/build.sx";
|
||||
|
||||
// P5.2 smoke test — the build-pipeline metadata queries (`c_object_paths` /
|
||||
// `link_libraries`) run on the comptime VM and return a `List(string)` the VM
|
||||
// builds in flat memory. Registered as a post-link callback (which runs on the
|
||||
// VM — core.invokeByFuncId), so the lists are live there.
|
||||
// P5.2 smoke test — the build-pipeline query primitives (`c_object_paths` /
|
||||
// `link_libraries` / `emit_object`) run on the comptime VM: the list queries
|
||||
// return a `List(string)` the VM builds in flat memory; `emit_object` returns
|
||||
// the compiler-emitted object path. Registered as a post-link callback (which
|
||||
// runs on the VM — core.invokeByFuncId), so the build state is live there.
|
||||
//
|
||||
// The `#import c` source compiles to one `.o`, so `c_object_paths()` must return
|
||||
// a one-element list whose single string is the (non-empty) object path. AOT
|
||||
@@ -21,6 +22,8 @@ c_marker :: () -> i64 extern;
|
||||
check :: () -> bool abi(.compiler) {
|
||||
objs := c_object_paths();
|
||||
libs := link_libraries();
|
||||
obj := emit_object(); // the compiler-emitted sx object path
|
||||
if obj.len == 0 { return false; }
|
||||
if objs.len != 1 { return false; }
|
||||
if objs.items[0].len == 0 { return false; }
|
||||
// `link_libraries` must be a well-formed (possibly empty) list — touch each
|
||||
|
||||
Reference in New Issue
Block a user