diff options
author | Siu Chi Chan <siuchi.chan@amd.com> | 2023-07-10 13:30:23 -0400 |
---|---|---|
committer | Siu Chi Chan <siuchi.chan@amd.com> | 2023-07-17 16:29:15 -0400 |
commit | cbc4bbb85c729f34bf0cba84ccd2e116af1454f5 (patch) | |
tree | 6eba641047ecdc726a7e73914b5a3469980bd29c /clang/lib/Driver/Driver.cpp | |
parent | 7f08f449621da737d3fa8e89b0e3022c0178f216 (diff) | |
download | llvm-cbc4bbb85c729f34bf0cba84ccd2e116af1454f5.zip llvm-cbc4bbb85c729f34bf0cba84ccd2e116af1454f5.tar.gz llvm-cbc4bbb85c729f34bf0cba84ccd2e116af1454f5.tar.bz2 |
[HIP] Ignore host linker flags for device-only
When compiling in device only mode (e.g. --offload-device-only), the
host linker phase would not happen and therefore, the driver should
ignore all the host linker flags.
Differential Revision: https://reviews.llvm.org/D154881
Change-Id: I8244acef5c33108cf15b1dbb188f974f30099718
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index b4a0705..211a65e 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4146,9 +4146,11 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args, // Queue linker inputs. if (Phase == phases::Link) { assert(Phase == PL.back() && "linking must be final compilation step."); - // We don't need to generate additional link commands if emitting AMD bitcode + // We don't need to generate additional link commands if emitting AMD + // bitcode or compiling only for the offload device if (!(C.getInputArgs().hasArg(options::OPT_hip_link) && - (C.getInputArgs().hasArg(options::OPT_emit_llvm)))) + (C.getInputArgs().hasArg(options::OPT_emit_llvm))) && + !offloadDeviceOnly()) LinkerInputs.push_back(Current); Current = nullptr; break; |