[AMDGPU] Always pass `-mcpu` to the `lld` linker
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 27 Jun 2023 19:17:20 +0000 (14:17 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 28 Jun 2023 13:52:37 +0000 (08:52 -0500)
commit765301183f58a28af65b112db44218dc224b9fec
tree55b631443e159441653ef4b53182ab5f4bb26fc0
parent8a2265189297e5b303712813c48e0f452d9f2bbd
[AMDGPU] Always pass `-mcpu` to the `lld` linker

Currently, AMDGPU more or less only supports linking with LTO. If the
user does not either pass `-flto` or `-Wl,-plugin-opt=mcpu=` manually
linking will fail because the architecture's aren't compatible. THis
patch simply passes `-mcpu` by default if it was specified. Should be a
no-op if it's not actually used.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D153909
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/test/Driver/amdgpu-toolchain.c