Skip to content

Self-host M3: inventory driver phantom emit guard — require non-empty -o always #8709

Description

@PurHur

Category

bootstrap

Problem

The bootstrap inventory argv driver (bin/compile.php / native AOT driver invoked from script/bootstrap-inventory.php) can exit 0 after printing a compile-OK line while never writing the -o output file (or writing zero bytes). bootstrap_inventory_argv_emit_output_ok in the bootstrap scripts guards this (#3046), but the compiler should fail loudly itself so gen-0 / M3 gates cannot pass on phantom emits.

This blocks trustworthy M3 native compile verification and hides linker/driver bugs.

php-src reference

  • N/A (compiler bootstrap). Analogous to php-src build tools failing when -o is missing after successful compile.

Repro

# After implementing the guard, this synthetic failure mode must non-zero:
# (exact trigger depends on current driver — reproduce via bootstrap inventory emit step)

BOOTSTRAP_INVENTORY_EMIT=1 php script/bootstrap-inventory.php --emit-only 2>&1 | tee /tmp/inv-emit.log
test -s /tmp/bootstrap-inventory-driver.out || echo "MISSING OUTPUT"

# Stricter: force driver with -o pointing at unwritable path / dev-null discard and assert non-zero
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && make bootstrap-selfhost-inventory-emit-probe'

Today: driver may return success without a non-empty -o artifact; outer script catches some cases but not all native paths.

Scope (this repo)

  • bin/compile.php — post-compile stat on -o path (size > 0, regular file)
  • lib/AOT/ native driver emit path (shared helper with bin/compile.php)
  • script/bootstrap-inventory.php — tighten bootstrap_inventory_argv_emit_output_ok messages; keep as belt-and-suspenders
  • Tests: test/unit/BootstrapInventoryEmitTest.php — temp -o missing/empty → non-zero exit

Done when

  • Native + Zend fallback drivers return non-zero and stderr diagnostic when -o missing, empty, or not created after successful compile line
  • BOOTSTRAP_INVENTORY_EMIT=1 probe in make north-star5-verify-fast cannot pass with phantom emit
  • ./script/ci-fast.sh --filter BootstrapInventoryEmit green
  • No new C runtime logic — PHP driver checks only

Verify

make bootstrap-selfhost-vm-driver-execute-probe
make north-star5-verify-fast
./script/ci-fast.sh --filter BootstrapInventoryEmit

Links

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevEx

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions