Skip to content

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

@mathstuf

Description

@mathstuf

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 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions