summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ld
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-15 13:48:12 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-06-15 13:48:12 +0000
commitcb16b095c5e9c1cbcd96f643d193f630e3ac6c49 (patch)
tree6609f0b022ca7098f874f1852d231a4d67899fc9 /llvm/tools/llvm-ld
parentbddf2fd6999c0d1e579c8ec7a8638ed81d9762c9 (diff)
downloadbcm5719-llvm-cb16b095c5e9c1cbcd96f643d193f630e3ac6c49.tar.gz
bcm5719-llvm-cb16b095c5e9c1cbcd96f643d193f630e3ac6c49.zip
Make sure all produced executable files have "exe" suffix on Windows.
With this more general way, -native and -native-cbe options are handled too. llvm-svn: 52287
Diffstat (limited to 'llvm/tools/llvm-ld')
-rw-r--r--llvm/tools/llvm-ld/llvm-ld.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/llvm/tools/llvm-ld/llvm-ld.cpp b/llvm/tools/llvm-ld/llvm-ld.cpp
index f15281dffdc..0b8269c7f24 100644
--- a/llvm/tools/llvm-ld/llvm-ld.cpp
+++ b/llvm/tools/llvm-ld/llvm-ld.cpp
@@ -403,11 +403,7 @@ static void EmitShellScript(char **argv) {
if (llvmstub.isEmpty())
PrintAndExit("Could not find llvm-stub.exe executable!");
- sys::Path OutPath(OutputFilename);
- if (OutPath.getSuffix() != "exe")
- OutPath.appendSuffix("exe");
-
- if (0 != sys::CopyFile(OutPath, llvmstub, &ErrMsg))
+ if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg))
PrintAndExit(ErrMsg);
return;
@@ -534,14 +530,24 @@ int main(int argc, char **argv, char **envp) {
// Optimize the module
Optimize(Composite.get());
- // 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";
+ if (!LinkAsLibrary) {
+ // Make sure the output executable has an "exe" suffix.
+ sys::Path ExeFile( OutputFilename );
+ if (ExeFile.getSuffix() != "exe") {
+ if (OutputFilename == "a.out") {
+ OutputFilename = "a.exe";
+ } else {
+ ExeFile.appendSuffix("exe");
+ OutputFilename = ExeFile.toString();
+ }
+ }
+ }
#endif
+ // Generate the bitcode for the optimized module.
+ std::string RealBitcodeOutput = OutputFilename;
+
if (!LinkAsLibrary) RealBitcodeOutput += ".bc";
GenerateBitcode(Composite.get(), RealBitcodeOutput);
OpenPOWER on IntegriCloud