[clang] [SYCL][Driver] Pass -lsycl by default for SYCL compilation. (PR #174877)
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 14 11:46:24 PST 2026
================
@@ -357,6 +357,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Generic_GCC::AddMultiarchPaths(D, SysRoot, OSLibDir, Paths);
+ // Add -L/path/to/sycl/lib when -fsycl is specified or when libsycl.so is
+ // available. The -lsycl option is added implicitly by -fsycl and links
+ // against the SYCL runtime library (libsycl.so), which is located in this
+ // directory.
+ if (StringRef(D.Dir).starts_with(SysRoot) &&
+ (Args.hasArg(options::OPT_fsycl) ||
+ D.getVFS().exists(D.Dir + "/../lib/libsycl.so")))
+ addPathIfExists(D, D.Dir + "/../lib", Paths);
----------------
jhuber6 wrote:
And attempt in https://github.com/llvm/llvm-project/pull/176019
https://github.com/llvm/llvm-project/pull/174877
More information about the cfe-commits
mailing list