changeset 306:0baca2feb554 trunk

[svn r327] Fixed some more MinGW32 issues. It's now very close to working. Fixed problems with inline asm like: mov EAX, FS:4 , which incidentally is used in the runtime to get the stack bottom, on Windows.
author lindquist
date Fri, 27 Jun 2008 23:58:22 +0200
parents 2b72433d5c8c
children 7ade5e035beb
files bin/llvmdc.ini dmd/mars.c gen/d-asm-i386.h gen/linker.cpp gen/linker.h tango/lib/gc/basic/gcx.d test/arrays15.d
diffstat 7 files changed, 28 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/llvmdc.ini	Fri Jun 27 23:58:22 2008 +0200
@@ -0,0 +1,4 @@
+
+[Environment]
+
+DFLAGS=-I%@P%/../tango -L-L%@P%/../lib -R%@P%/../lib
--- a/dmd/mars.c	Fri Jun 27 22:04:35 2008 +0200
+++ b/dmd/mars.c	Fri Jun 27 23:58:22 2008 +0200
@@ -1066,7 +1066,7 @@
     {
 	if (global.params.link)
 	    //status = runLINK();
-        linkExecutable();
+        linkExecutable(argv[0]);
 
 	if (global.params.run)
 	{
--- a/gen/d-asm-i386.h	Fri Jun 27 22:04:35 2008 +0200
+++ b/gen/d-asm-i386.h	Fri Jun 27 23:58:22 2008 +0200
@@ -1929,7 +1929,7 @@
 		if (operand->constDisplacement) {
 		    if (operand->symbolDisplacement.dim)
 			insnTemplate->writebyte('+');
-		    addOperand2("${",":a}", Arg_Integer, newIntExp(operand->constDisplacement), asmcode);
+		    addOperand(fmt, Arg_Integer, newIntExp(operand->constDisplacement), asmcode);
 		    if (opInfo->operands[i] & Opr_Dest)
 			asmcode->clobbersMemory = 1;
 		}
--- a/gen/linker.cpp	Fri Jun 27 22:04:35 2008 +0200
+++ b/gen/linker.cpp	Fri Jun 27 23:58:22 2008 +0200
@@ -1,6 +1,9 @@
 #include "gen/llvm.h"
 #include "llvm/Linker.h"
 #include "llvm/System/Program.h"
+#if _WIN32
+#include "llvm/Support/SystemUtils.h"
+#endif
 
 #include "root.h"
 #include "mars.h"
@@ -35,7 +38,7 @@
 
 static llvm::sys::Path gExePath;
 
-int linkExecutable()
+int linkExecutable(const char* argv0)
 {
     Logger::println("*** Linking executable ***");
 
@@ -43,11 +46,10 @@
     std::string errstr;
 
     // find the llvm-ld program
-    llvm::sys::Path ldpath = llvm::sys::Program::FindProgramByName("llvm-ld");
+	llvm::sys::Path ldpath = llvm::sys::Program::FindProgramByName("llvm-ld");
     if (ldpath.isEmpty())
     {
-        error("linker program not found");
-        fatal();
+		ldpath.set("llvm-ld");
     }
 
     // build arguments
@@ -83,12 +85,15 @@
     // create path to exe
     llvm::sys::Path exedir(gExePath);
     exedir.set(gExePath.getDirname());
-    exedir.createDirectoryOnDisk(true, &errstr);
-    if (!errstr.empty())
+    if (!exedir.exists())
     {
-        error("failed to create path to linking output\n%s", errstr.c_str());
-        fatal();
-    }
+	    exedir.createDirectoryOnDisk(true, &errstr);
+	    if (!errstr.empty())
+	    {	
+	        error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str());
+	        fatal();
+	    }
+	}    
 
     // strip debug info
     if (!global.params.symdebug)
--- a/gen/linker.h	Fri Jun 27 22:04:35 2008 +0200
+++ b/gen/linker.h	Fri Jun 27 23:58:22 2008 +0200
@@ -17,9 +17,10 @@
 
 /**
  * Link an executable.
+ * @param argv0 the argv[0] value as passed to main
  * @return 0 on success.
  */
-int linkExecutable();
+int linkExecutable(const char* argv0);
 
 /**
  * Delete the executable that was previously linked with linkExecutable.
--- a/tango/lib/gc/basic/gcx.d	Fri Jun 27 22:04:35 2008 +0200
+++ b/tango/lib/gc/basic/gcx.d	Fri Jun 27 23:58:22 2008 +0200
@@ -54,7 +54,10 @@
 private import cstring = tango.stdc.string : memcpy, memmove, memset;
 
 private import tango.stdc.stdio;
-private import tango.stdc.posix.pthread;
+version(Posix)
+{
+	private import tango.stdc.posix.pthread;
+}
 
 version (GNU)
 {
--- a/test/arrays15.d	Fri Jun 27 22:04:35 2008 +0200
+++ b/test/arrays15.d	Fri Jun 27 23:58:22 2008 +0200
@@ -1,5 +1,5 @@
-module arrays;
-
+module arrays15;
+
 extern(C) int printf(char*, ...);
 
 void integer()