mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-06 08:23:19 +08:00
The kept LLVM text and IR are named after the entry (`<stem>.ll`, `<stem>.ir.json`) in the output directory, so two programs whose entries share a name and are built into one directory share those files. The executable cache published the translation unit by copying the shared `.ll` after the native build, so when the other program wrote it in between, the stamp recorded the other program's text, and a later cache hit relinked the wrong program without any error. A build now writes, compiles and caches private copies beside the shared names and renames them into place when it ends. A cache hit that relinks compiles a private copy of the cached translation unit, and leaves a shared file that already holds those bytes as it is. The native build reads the private copy and keeps the shared name as the spelling clang sees, so native cache keys and debug names do not change.