llvm / llvm/llvm-project

[ROCm] Offload flag temporary objects interfere with ld's `--dependency-file=` option

Open
#160,347 0 comments 0 reactions 0 assignees View on GitHub
new issue
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The `ld` GNU linker supports the `--dependency-file=` flag to report a `.d` dependency file so that build systems can relink if anything the linker uses changes. The ROCm support in `armclang` will generate temporary object files that are then reported by the linker in these dependency files. When the frontend then cleans up these temporary files, the build system gets "grumpy" and either complains that a dependency doesn't exist and cannot be made or gives up and just forces the command to rerun (therefore never having a "clean" build).

I have filed a [binutils RFE](https://sourceware.org/bugzilla/show_bug.cgi?id=33479) to support a new flag to suppress reporting of frontend-marked temporary object files in these dependency files but this requires detecting linker support for the flag in the first place. On the frontend side, we have a few possible mitigations until a suitable binutils is "everywhere":

- accept an `--offload-object-dir` flag to place the objects in and make them non-temporary (don't clean them up) so that the build system can at least make sure they're in a per-link unique place to avoid conflicts
- intercept `-Wl,--dependency-file=` and rewrite it to remove the temporary objects (blech, but mentioned for completeness)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.