Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Driver][SYCL] Allow for SYCL defaultlibs to be added with clang-cl #13906

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/lib/Driver/ToolChains/MSVC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,15 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-defaultlib:oldnames");
}

if ((!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_fsycl) &&
if ((Args.hasArg(options::OPT_fsycl) &&
!Args.hasArg(options::OPT_nolibsycl)) ||
Args.hasArg(options::OPT_fsycl_host_compiler_EQ)) {
CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
TC.getDriver().Dir + "/../lib"));
// When msvcrtd is added via --dependent-lib, we add the sycld
// equivalent. Do not add the -defaultlib as it conflicts.
if (!isDependentLibAdded(Args, "msvcrtd")) {
if (!isDependentLibAdded(Args, "msvcrtd") &&
!Args.hasArg(options::OPT__SLASH_MDd)) {
if (Args.hasArg(options::OPT_fpreview_breaking_changes))
CmdArgs.push_back("-defaultlib:sycl" SYCL_MAJOR_VERSION "-preview.lib");
else
Expand Down
1 change: 1 addition & 0 deletions clang/test/Driver/sycl-device-lib-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,4 @@
// RUN: %clang_cl -fsycl %s /winsysroot=%S/Inputs/SYCL -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_HOST_LIB
// SYCL_DEVICE_HOST_LIB: {{.*}} "--dependent-lib=sycl-devicelib-host" {{.*}}
// SYCL_DEVICE_HOST_LIB: link{{.*}} "-defaultlib:sycl-devicelib-host.lib"
4 changes: 2 additions & 2 deletions clang/test/Driver/sycl-offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,9 @@

/// Check for default linking of syclN.lib with -fsycl usage
// RUN: %clang -fsycl -target x86_64-unknown-windows-msvc %s -o %t -### 2>&1 | FileCheck -check-prefix=CHECK-LINK-SYCL %s
// RUN: %clang_cl -fsycl %s -o %t -### 2>&1 | FileCheck -check-prefix=CHECK-LINK-SYCL-CL %s
// RUN: %clang_cl -fsycl %s -o %t -### 2>&1 \
// RUN: | FileCheck -check-prefixes=CHECK-LINK-SYCL-CL,CHECK-LINK-SYCL %s
// CHECK-LINK-SYCL-CL: "--dependent-lib=sycl{{[0-9]*}}"
// CHECK-LINK-SYCL-CL-NOT: "-defaultlib:sycl{{[0-9]*}}.lib"
// CHECK-LINK-SYCL: "-defaultlib:sycl{{[0-9]*}}.lib"

/// Check no SYCL runtime is linked with -nolibsycl
Expand Down
Loading