diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gccld/gccld.cpp | 15 | ||||
-rw-r--r-- | tools/llvm-ld/llvm-ld.cpp | 8 |
2 files changed, 17 insertions, 6 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp index c8ecde5..9401a8a 100644 --- a/tools/gccld/gccld.cpp +++ b/tools/gccld/gccld.cpp @@ -133,17 +133,22 @@ static int PrintAndReturn(const char *progname, const std::string &Message) { /// EmitShellScript - Output the wrapper file that invokes the JIT on the LLVM /// bytecode file for the program. static void EmitShellScript(char **argv) { -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) // Windows doesn't support #!/bin/sh style shell scripts in .exe files. To // support windows systems, we copy the llvm-stub.exe executable from the // build tree to the destination file. - std::string llvmstub = FindExecutable("llvm-stub.exe", argv[0]).toString(); - if (llvmstub.empty()) { + std::string ErrMsg; + sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); + if (llvmstub.isEmpty()) { std::cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } - sys::CopyFile(sys::Path(OutputFilename), sys::Path(llvmstub)); - return; + if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + exit(1); + } + + return; #endif // Output the script to start the program... diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 6b9adaf..ab7109f 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -345,12 +345,18 @@ static void EmitShellScript(char **argv) { // Windows doesn't support #!/bin/sh style shell scripts in .exe files. To // support windows systems, we copy the llvm-stub.exe executable from the // build tree to the destination file. + std::string ErrMsg; sys::Path llvmstub = FindExecutable("llvm-stub.exe", argv[0]); if (llvmstub.isEmpty()) { std::cerr << "Could not find llvm-stub.exe executable!\n"; exit(1); } - sys::CopyFile(sys::Path(OutputFilename), llvmstub); + + if (0 != sys::CopyFile(sys::Path(OutputFilename), llvmstub, &ErrMsg)) { + std::cerr << argv[0] << ": " << ErrMsg << "\n"; + exit(1); + } + return; #endif |