From 5b90a7296cdf70e5b6eca9edf28fcda74f4551bf Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sun, 15 Jun 2008 12:01:16 +0000 Subject: [PATCH] Append "exe" suffix to executable files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52285 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-ld/llvm-ld.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 6657c7c7fd2..f15281dffdc 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -403,7 +403,11 @@ static void EmitShellScript(char **argv) { if (llvmstub.isEmpty()) PrintAndExit("Could not find llvm-stub.exe executable!"); - if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) + sys::Path OutPath(OutputFilename); + if (OutPath.getSuffix() != "exe") + OutPath.appendSuffix("exe"); + + if (0 != sys::CopyFile(OutPath, llvmstub, &ErrMsg)) PrintAndExit(ErrMsg); return; @@ -532,6 +536,12 @@ int main(int argc, char **argv, char **envp) { // Generate the bitcode for the optimized module. std::string RealBitcodeOutput = OutputFilename; + +#if defined(_WIN32) || defined(__CYGWIN__) + if (!LinkAsLibrary && sys::Path(OutputFilename).getSuffix() != "exe") + RealBitcodeOutput += ".exe"; +#endif + if (!LinkAsLibrary) RealBitcodeOutput += ".bc"; GenerateBitcode(Composite.get(), RealBitcodeOutput);