Skip to content

Commit 1c8a01d

Browse files
authored
[Driver][SYCL][clang-linker-wrapper] Fix sycl device library arguments (#12116)
Right now we use `--`, but in `clang-linker-wrapper` we use the clang Arg infrastructure to match them, and that requires `-`. At least for me every invocation of SYCL with the new offload model hits this problem. After this, at least `clang-linker-wrapper` gets further and we get some `sycl-post-link` error which I'll look at next. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent b0a2fb9 commit 1c8a01d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10573,7 +10573,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1057310573

1057410574
// Add any SYCL offloading specific options to the clang-linker-wrapper
1057510575
if (C.hasOffloadToolChain<Action::OFK_SYCL>()) {
10576-
// --sycl-device-libraries=<comma separated list> contains all of the SYCL
10576+
// -sycl-device-libraries=<comma separated list> contains all of the SYCL
1057710577
// device specific libraries that are needed. This provides the list of
1057810578
// files file only.
1057910579
// TODO: This generic list will be populated with only device binaries
@@ -10601,14 +10601,14 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1060110601
LibList += ",";
1060210602
LibList += AddLib;
1060310603
}
10604-
// --sycl-device-libraries=<libs> provides a comma separate list of
10604+
// -sycl-device-libraries=<libs> provides a comma separate list of
1060510605
// libraries to add to the device linking step.
1060610606
// SYCL device libraries can be found.
1060710607
if (LibList.size())
1060810608
CmdArgs.push_back(
10609-
Args.MakeArgString(Twine("--sycl-device-libraries=") + LibList));
10609+
Args.MakeArgString(Twine("-sycl-device-libraries=") + LibList));
1061010610

10611-
// --sycl-device-library-location=<dir> provides the location in which the
10611+
// -sycl-device-library-location=<dir> provides the location in which the
1061210612
// SYCL device libraries can be found.
1061310613
SmallString<128> DeviceLibDir(D.Dir);
1061410614
llvm::sys::path::append(DeviceLibDir, "..", "lib");
@@ -10630,7 +10630,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
1063010630
}
1063110631
}
1063210632
CmdArgs.push_back(Args.MakeArgString(
10633-
Twine("--sycl-device-library-location=") + DeviceLibDir));
10633+
Twine("-sycl-device-library-location=") + DeviceLibDir));
1063410634
}
1063510635

1063610636
auto appendOption = [](SmallString<128> &OptString, StringRef AddOpt) {

clang/test/Driver/sycl-offload-new-driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
// RUN: --sysroot=%S/Inputs/SYCL -### %s 2>&1 \
3939
// RUN: | FileCheck -check-prefix WRAPPER_OPTIONS %s
4040
// WRAPPER_OPTIONS: clang-linker-wrapper{{.*}} "--triple=spir64"
41-
// WRAPPER_OPTIONS-SAME: "--sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42-
// WRAPPER_OPTIONS-SAME: "--sycl-device-library-location={{.*}}/lib"
41+
// WRAPPER_OPTIONS-SAME: "-sycl-device-libraries=libsycl-crt.o,libsycl-complex.o,libsycl-complex-fp64.o,libsycl-cmath.o,libsycl-cmath-fp64.o,libsycl-imf.o,libsycl-imf-fp64.o,libsycl-imf-bf16.o,libsycl-itt-user-wrappers.o,libsycl-itt-compiler-wrappers.o,libsycl-itt-stubs.o"
42+
// WRAPPER_OPTIONS-SAME: "-sycl-device-library-location={{.*}}/lib"
4343

4444
// RUN: %clangxx --target=x86_64-unknown-linux-gnu -fsycl --offload-new-driver \
4545
// RUN: -Xspirv-translator -translator-opt -### %s 2>&1 \

0 commit comments

Comments
 (0)