[Clang] Add options in LTO mode when cross compiling for AMDGPU
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 21 Feb 2023 17:42:22 +0000 (11:42 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 22 Feb 2023 16:14:05 +0000 (10:14 -0600)
commitc45d2df05e0e7b6f2517aa2933a24928b4942a3f
tree4dfe5b50476509d23046adb7263163f32c5ffd01
parent7753ae8da24cf16f380eff4eaac6d414937acf8e
[Clang] Add options in LTO mode when cross compiling for AMDGPU

The AMDGPU toolchain support directly compiling GPU images using
cross-compilation such as `clang --target=amdgcn-amd-amdhsa foo.c`.
However, when attempting to link bitcode this does not work because the
`-mcpu` options are not forwarded to the linker among others. This patch
simply adds them so that `clang --target=amdgcn-amd-amdhsa foo.c -flto`
works correctly.

Reviewed By: JonChesterfield

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