[PATCH] D126704: [HIP] Pass -Xoffload-linker option to device linker
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 31 08:21:15 PDT 2022
yaxunl created this revision.
yaxunl added a reviewer: tra.
Herald added a project: All.
yaxunl requested review of this revision.
Herald added a subscriber: MaskRay.
Reuse -Xoffload-linker option for HIP toolchain.
https://reviews.llvm.org/D126704
Files:
clang/lib/Driver/ToolChains/HIPAMD.cpp
clang/test/Driver/hip-options.hip
Index: clang/test/Driver/hip-options.hip
===================================================================
--- clang/test/Driver/hip-options.hip
+++ clang/test/Driver/hip-options.hip
@@ -106,3 +106,13 @@
// RUN: --offload-arch=gfx906 -fopenmp -fopenmp-targets=amdgcn %s 2>&1 \
// RUN: | FileCheck -check-prefix=OMPTGT %s
// OMPTGT: unsupported option '-fopenmp-targets=' for language mode 'HIP'
+
+// Check -Xoffload-linker option is passed to lld.
+
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
+// RUN: --cuda-gpu-arch=gfx906 -fgpu-rdc -Xoffload-linker --build-id=md5 %s 2>&1 \
+// RUN: | FileCheck -check-prefix=OFL-LINK %s
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
+// RUN: --cuda-gpu-arch=gfx906 -Xoffload-linker --build-id=md5 %s 2>&1 \
+// RUN: | FileCheck -check-prefix=OFL-LINK %s
+// OFL-LINK: lld{{.*}}"--build-id=md5"
Index: clang/lib/Driver/ToolChains/HIPAMD.cpp
===================================================================
--- clang/lib/Driver/ToolChains/HIPAMD.cpp
+++ clang/lib/Driver/ToolChains/HIPAMD.cpp
@@ -153,6 +153,9 @@
addLinkerCompressDebugSectionsOption(TC, Args, LldArgs);
+ for (auto *Arg : Args.filtered(options::OPT_Xoffload_linker))
+ LldArgs.push_back(Arg->getValue(1));
+
LldArgs.append({"-o", Output.getFilename()});
for (auto Input : Inputs)
LldArgs.push_back(Input.getFilename());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126704.433091.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220531/835654d7/attachment.bin>
More information about the cfe-commits
mailing list