|
| 1 | +`cargo-test` is green again on Linux. Four `perry-codegen` tests |
| 2 | +(`rs4gc_canonicalizes_construction_time_folds_before_root_liveness` and the |
| 3 | +three `native_emit` construction-path tests) assert that textual and native |
| 4 | +construction emit byte-identical output. The generated code had already |
| 5 | +converged; the objects differed only in the name LLVM records for the module. |
| 6 | + |
| 7 | +Nothing set `source_filename`, so LLVM fell back to whatever path reached the |
| 8 | +assembler: the textual pipeline writes each module to a per-call temp file, so |
| 9 | +its recorded name carried a random nonce (`perry_llvm_<nonce>.ll`), while |
| 10 | +native construction recorded its in-memory module id (`perry_native_module`). |
| 11 | +ELF stores that name as an `STT_FILE` symbol, so the two paths could never |
| 12 | +agree and neither was reproducible run to run. Mach-O records no such symbol, |
| 13 | +which is why all four passed on a macOS host and failed only on the Linux |
| 14 | +runner. |
| 15 | + |
| 16 | +All three module-header sites (`to_ir`, `skeleton_ir`, and the per-codegen-unit |
| 17 | +prologue) now emit an explicit `source_filename`, so the recorded name is the |
| 18 | +same constant on both paths and independent of the temp path. Emitted objects |
| 19 | +no longer embed a random temp filename, so they are reproducible across runs. |
| 20 | + |
| 21 | +The three `native_emit` tests only ever ran against the host triple, so on a |
| 22 | +macOS machine they exercised Mach-O exclusively — the one object format that |
| 23 | +does not record this name. `native_and_text_arms_agree_on_an_elf_target` now |
| 24 | +pins the comparison to `x86_64-unknown-linux-gnu` and asserts the bytes start |
| 25 | +with `\x7fELF` before comparing, so it cannot pass by testing the wrong format; |
| 26 | +it is sabotage-tested against the un-fixed emission. |
0 commit comments