[clang] [LinkerWrapper] Fix temps being dumped to CWD instead of output path (PR #198679)
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon May 25 21:33:06 PDT 2026
yxsamliu wrote:
> > Would it be better to pass the full `--save-temps=cwd/--save-temps=obj` option through to the linker wrapper instead of collapsing it to a boolean, and then preserve the old (CWD) behavior for `--save-temps=cwd` while using the new (output-dir) behavior for `--save-temps=obj`? That would keep the linker wrapper consistent with how clang handles both modes. As a bonus, lld's intermediate files would follow automatically since they derive their location from the .img output path.
>
> I'm leaning towards using `lld`'s semantics just because these are both functionally the linker. This is a bit of a strange case because normal `-save-temps` doesn't imply LLD to emit temp files, but we do that with offloading just because it's the expected behavior.
Makes sense. Aligning with lld's semantics seems to be a consistent choice for the linker wrapper. In practice, saving to output directory is usually better than saving to CWD. We may want to document -save-temps behavior for device intermediate files in clang HIP support documentation but that could be done in a separate PR.
https://github.com/llvm/llvm-project/pull/198679
More information about the cfe-commits
mailing list