[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 19:38:49 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92a606f6de77: [HIP] Pass -Xoffload-linker option to device linker (authored by yaxunl).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126704/new/
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
@@ -147,6 +147,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.433274.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220601/791574d8/attachment.bin>
More information about the cfe-commits
mailing list