summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-06-02 00:53:57 +0000
committerChris Lattner <sabre@nondot.org>2004-06-02 00:53:57 +0000
commit681692da43091e71ccb857c1c1b2e3441100a9fe (patch)
treecee57b0e6ae3e5aff55cfb9031de81b0ef1c94a8 /tools
parent5bfac5d2edac78a0c0f91e751dc0c173158a4829 (diff)
downloadllvm-681692da43091e71ccb857c1c1b2e3441100a9fe.tar.gz
llvm-681692da43091e71ccb857c1c1b2e3441100a9fe.tar.bz2
llvm-681692da43091e71ccb857c1c1b2e3441100a9fe.tar.xz
Make gccld copy the llvm-stub program to be the execution wrapper for
bytecode files on win32 systems. We keep the shell script on unix systems because it is much more transparent for the users and supports -load options. This allows llvmgcc work correctly on win32 systems without the -native or -native-cbe options. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gccld/gccld.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index a9e91f9dc3..6f94ed51f4 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -35,7 +35,6 @@
#include "Support/SystemUtils.h"
#include <fstream>
#include <memory>
-
using namespace llvm;
namespace {
@@ -107,6 +106,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__)
+ // 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]);
+ if (llvmstub.empty()) {
+ std::cerr << "Could not find llvm-stub.exe executable!\n";
+ exit(1);
+ }
+ if (CopyFile(OutputFilename, llvmstub)) {
+ std::cerr << "Could not copy the llvm-stub.exe executable!\n";
+ exit(1);
+ }
+ return;
+#endif
+
// Output the script to start the program...
std::ofstream Out2(OutputFilename.c_str());
if (!Out2.good())