Skip to content

Commit 4ce19d6

Browse files
authored
[Driver][SYCL] Improve library resolution for libsycl (#6625)
When using -print-file-name=libsycl.so, we were only emitting the proper location when -fsycl is being used. Update this to allow for finding the library just based on its existence in known locations.
1 parent 6636103 commit 4ce19d6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/Linux.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
317317
// TODO Remove once LLVM_ENABLE_PROJECTS=libcxx is unsupported.
318318
if (StringRef(D.Dir).startswith(SysRoot) &&
319319
(D.getVFS().exists(D.Dir + "/../lib/libc++.so") ||
320-
Args.hasArg(options::OPT_fsycl)))
320+
Args.hasArg(options::OPT_fsycl) ||
321+
D.getVFS().exists(D.Dir + "/../lib/libsycl.so")))
321322
addPathIfExists(D, D.Dir + "/../lib", Paths);
322323

323324
addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// UNSUPPORTED: system-windows
2+
3+
// -print-file-name=libsycl.so
4+
// RUN: %clangxx -print-file-name=libsycl.so 2>&1 | FileCheck %s --check-prefix=PRINT_LIBSYCL
5+
// RUN: %clangxx -fsycl -print-file-name=libsycl.so 2>&1 | FileCheck %s --check-prefix=PRINT_LIBSYCL
6+
// PRINT_LIBSYCL: {{.*}}lib{{(\\\\|/)}}libsycl.so

0 commit comments

Comments
 (0)