[PATCH] D32109: [Driver] Limit .exe extension addition to Windows hosts

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 15 00:04:45 PDT 2017


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());
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32109.95374.patch
Type: text/x-patch
Size: 473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170415/091737e6/attachment.bin>


More information about the cfe-commits mailing list