================
@@ -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);
----------------
MaskRay wrote:

I believe adding a `-L` isn't appropriate. If you just need `libsycl.so`, you 
should detect it and add a path directly.
`clang ... path/to/libsycl.so` is equivalent to `clang ... -lsycl` (when the 
`-lsycl` resolves to `path/to/libsycl.so`; (when libsycl.so includes 
DT_SONAME)). This should be added near `addSanitizerRuntimes`.

https://github.com/llvm/llvm-project/pull/174877
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to