[clang] [HIP] Use linker wrapper for device-only code object links (PR #211675)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 13:18:22 PDT 2026
jhuber6 wrote:
> @jhuber6 Re: concrete reproducer
>
> A small reproducer is:
>
> `clang++ -### -x hip --offload-device-only --target=x86_64-unknown-linux --offload-arch=gfx90a -fprofile-generate -nogpuinc -nogpulib test.hip`
>
> For a driver-only lit test, the resource dir also needs fake `libclang_rt.profile.a` files so the driver gets past the runtime existence checks.
>
> Before this PR, this device-only link path did not go through `clang-linker-wrapper`, so the wrapper did not see `-fprofile-generate` and could not add the normal device profile runtime handling.
>
> With this PR, the same pipeline goes through `clang-linker-wrapper` with:
>
> `--device-compiler=amdgcn-amd-amdhsa=-fprofile-generate`
>
> The `--no-gpu-bundle-output` case still needs to return raw per-arch device output, so the PR has the wrapper emit a fatbin and then unbundles it back to the requested raw output form.
This looks like it's just the `HIPAMD.cpp` toolchain's `constructLldCommand` not working correctly. Seems this is the only case where we use it? I don't know why we can't just add `addProfileRTLibs` there and drop the questionable `-plugin-opt=-amdgpu-internalize-symbols` and avoid all of these changes.
https://github.com/llvm/llvm-project/pull/211675
More information about the cfe-commits
mailing list