[clang] [LinkerWrapper] Use the correct empty file on Windows (PR #84322)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 05:59:57 PST 2024


https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/84322

>From 4a1e095d962e5b76d529fe579f2b449a36117c65 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 7 Mar 2024 07:48:38 -0600
Subject: [PATCH] [LinkerWrapper] Use the correct empty file on Windows

Summary:
The clang-offload-bundler uses an empty file to control the bundles made
for embedding. Previously this still used `/dev/null` by mistake even on
Windows.
---
 clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 576e8f2cd7f8fd..7bbdfc8bd8360e 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -410,7 +410,11 @@ fatbinary(ArrayRef<std::pair<StringRef, StringRef>> InputFiles,
     Targets.push_back(Saver.save("hipv4-amdgcn-amd-amdhsa--" + Arch));
   CmdArgs.push_back(Saver.save(llvm::join(Targets, ",")));
 
-  CmdArgs.push_back("-input=/dev/null");
+#ifdef _WIN32
+    CmdArgs.push_back("-input=NUL");
+#else
+    CmdArgs.push_back("-input=/dev/null");
+#endif
   for (const auto &[File, Arch] : InputFiles)
     CmdArgs.push_back(Saver.save("-input=" + File));
 



More information about the cfe-commits mailing list