summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ld/llvm-ld.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-15 12:01:16 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-15 12:01:16 +0000
commit5037fe21aaa73942d70920752c54048eda125b69 (patch)
tree28ef883a4167181840e01791c1b41f92dd75d375 /llvm/tools/llvm-ld/llvm-ld.cpp
parent24f99985b8427eb222f5ba31c2fdd0272af93c40 (diff)
downloadbcm5719-llvm-5037fe21aaa73942d70920752c54048eda125b69.tar.gz
bcm5719-llvm-5037fe21aaa73942d70920752c54048eda125b69.zip
Append "exe" suffix to executable files.
llvm-svn: 52285
Diffstat (limited to 'llvm/tools/llvm-ld/llvm-ld.cpp')
-rw-r--r--llvm/tools/llvm-ld/llvm-ld.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp
index 6657c7c7fd2..f15281dffdc 100644
--- a/llvm/tools/llvm-ld/llvm-ld.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud