[PATCH] D126398: [Clang] Introduce `--offload-link` option to perform offload device linking
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 25 12:02:18 PDT 2022
jhuber6 updated this revision to Diff 432071.
jhuber6 added a comment.
Removing `-dlink`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126398/new/
https://reviews.llvm.org/D126398
Files:
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/test/Driver/cuda-openmp-driver.cu
Index: clang/test/Driver/cuda-openmp-driver.cu
===================================================================
--- clang/test/Driver/cuda-openmp-driver.cu
+++ clang/test/Driver/cuda-openmp-driver.cu
@@ -35,3 +35,8 @@
// RUN: %clang -### -target x86_64-linux-gnu -nocudalib --cuda-feature=+ptx61 --offload-arch=sm_70 %s 2>&1 | FileCheck -check-prefix MANUAL-FEATURE %s
// MANUAL-FEATURE: -cc1{{.*}}-target-feature{{.*}}+ptx61
+
+// RUN: %clang -### -target x86_64-linux-gnu -nocudalib -ccc-print-bindings --offload-link %s 2>&1 \
+// RUN: | FileCheck -check-prefix DEVICE-LINK %s
+
+// DEVICE-LINK: "x86_64-unknown-linux-gnu" - "Offload::Linker", inputs: ["[[INPUT:.+]]"], output: "a.out"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4158,7 +4158,8 @@
// Check if this Linker Job should emit a static library.
if (ShouldEmitStaticLibrary(Args)) {
LA = C.MakeAction<StaticLibJobAction>(LinkerInputs, types::TY_Image);
- } else if (UseNewOffloadingDriver) {
+ } else if (UseNewOffloadingDriver ||
+ Args.hasArg(options::OPT_offload_link)) {
LA = C.MakeAction<LinkerWrapperJobAction>(LinkerInputs, types::TY_Image);
LA->propagateHostOffloadInfo(C.getActiveOffloadKinds(),
/*BoundArch=*/nullptr);
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -820,6 +820,8 @@
def z : Separate<["-"], "z">, Flags<[LinkerInput, RenderAsInput]>,
HelpText<"Pass -z <arg> to the linker">, MetaVarName<"<arg>">,
Group<Link_Group>;
+def offload_link : Flag<["--"], "offload-link">, Group<Link_Group>,
+ HelpText<"Use the new offloading linker to perform the link job.">;
def Xlinker : Separate<["-"], "Xlinker">, Flags<[LinkerInput, RenderAsInput]>,
HelpText<"Pass <arg> to the linker">, MetaVarName<"<arg>">,
Group<Link_Group>;
Index: clang/docs/ClangCommandLineReference.rst
===================================================================
--- clang/docs/ClangCommandLineReference.rst
+++ clang/docs/ClangCommandLineReference.rst
@@ -4209,6 +4209,10 @@
Pass the comma separated arguments in <arg> to the linker
+.. option:: --offload-link
+
+Use the linker supporting offloading device linking.
+
.. option:: -X
.. option:: -Xlinker <arg>, --for-linker <arg>, --for-linker=<arg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126398.432071.patch
Type: text/x-patch
Size: 2555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220525/b695dd7a/attachment.bin>
More information about the cfe-commits
mailing list