[llvm-commits] CVS: llvm/tools/gccld/gccld.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jun 1 19:58:01 PDT 2004


Changes in directory llvm/tools/gccld:

gccld.cpp updated: 1.74 -> 1.75

---
Log message:

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.



---
Diffs of the changes:  (+16 -1)

Index: llvm/tools/gccld/gccld.cpp
diff -u llvm/tools/gccld/gccld.cpp:1.74 llvm/tools/gccld/gccld.cpp:1.75
--- llvm/tools/gccld/gccld.cpp:1.74	Tue Jun  1 19:22:24 2004
+++ llvm/tools/gccld/gccld.cpp	Tue Jun  1 19:53:57 2004
@@ -35,7 +35,6 @@
 #include "Support/SystemUtils.h"
 #include <fstream>
 #include <memory>
-
 using namespace llvm;
 
 namespace {
@@ -107,6 +106,22 @@
 /// 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())





More information about the llvm-commits mailing list