================
@@ -127,6 +128,25 @@ void SYCLToolChain::addClangTargetOptions(
     const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
     BoundArch BA, Action::OffloadKind DeviceOffloadingKind) const {
   HostTC.addClangTargetOptions(DriverArgs, CC1Args, BA, DeviceOffloadingKind);
+
+  // Only link device libraries when actually emitting device IR.
+  // Preprocessing (-E) and syntax-only (-fsyntax-only) actions do not produce
+  // IR so -mlink-builtin-bitcode would be unused, and requiring the builtins
+  // bitcode to exist would be a spurious fatal error on those code paths.
+  auto IsNonIRAction = [](const llvm::opt::ArgStringList &Args) {
+    for (const char *A : Args)
+      if (llvm::StringRef(A) == "-E" || llvm::StringRef(A) == "-fsyntax-only")
+        return true;
+    return false;
+  };
----------------
bader wrote:

Shouldn't spirv64 align with nvptx64/other targets in SYCL mode i.e. ignore 
missing device-libs?

It looks like the driver errors today only if libraries from third party 
library SDKs like ROCM/CUDA are missing.

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

Reply via email to