smeenai created this revision.

The driver should invoke lld as `lld-link` rather than `lld-link.exe`
when cross compiling.

The alternative would be to teach lld's build system to always produce
`lld-link.exe` even on non-Windows hosts, but I think it's cleaner to
change the driver to respect the host system's executable suffix (or
lack thereof).


https://reviews.llvm.org/D32109

Files:
  lib/Driver/ToolChains/MSVC.cpp


Index: lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -523,7 +523,8 @@
 #endif
   } else {
     linkPath = Linker;
-    llvm::sys::path::replace_extension(linkPath, "exe");
+    if (llvm::Triple(LLVM_HOST_TRIPLE).isOSWindows())
+      llvm::sys::path::replace_extension(linkPath, "exe");
     linkPath = TC.GetProgramPath(linkPath.c_str());
   }
 


Index: lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -523,7 +523,8 @@
 #endif
   } else {
     linkPath = Linker;
-    llvm::sys::path::replace_extension(linkPath, "exe");
+    if (llvm::Triple(LLVM_HOST_TRIPLE).isOSWindows())
+      llvm::sys::path::replace_extension(linkPath, "exe");
     linkPath = TC.GetProgramPath(linkPath.c_str());
   }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to