changeset 568:f75b16f1e405

Automated merge with http://hg.dsource.org/projects/llvmdc
author Christian Kamm <kamm incasoftware de>
date Tue, 02 Sep 2008 19:14:37 +0200
parents 68d7df3f9b05 (current diff) aaba4f7c6d8a (diff)
children 926a03711ca8 cbd6c8073a32
files dmd/mars.c dmd/mars.h
diffstat 5 files changed, 35 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/bin/llvmdc.conf	Sun Aug 31 18:51:14 2008 +0200
+++ b/bin/llvmdc.conf	Tue Sep 02 19:14:37 2008 +0200
@@ -1,4 +1,4 @@
 
 [Environment]
 
-DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib -R%@P%/../lib
+DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib
--- a/bin/llvmdc.ini	Sun Aug 31 18:51:14 2008 +0200
+++ b/bin/llvmdc.ini	Tue Sep 02 19:14:37 2008 +0200
@@ -1,2 +1,2 @@
 [Environment]
-DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib -R%@P%/../lib
+DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib
--- a/dmd/mars.c	Sun Aug 31 18:51:14 2008 +0200
+++ b/dmd/mars.c	Tue Sep 02 19:14:37 2008 +0200
@@ -223,11 +223,10 @@
   -ignore        ignore unsupported pragmas\n\
 \n\
 Path options:\n\
-  -R<path>       provide path to the directory containing the runtime library\n\
   -I<path>       where to look for imports\n\
   -J<path>       where to look for string imports\n\
-  -debuglib=name    set symbolic debug library to name (currently ignored)\n\
-  -defaultlib=name  set default library to name (currently ignored)\n\
+  -defaultlib=name  set default library for non-debug build\n\
+  -debuglib=name    set default library for debug build\n\
 \n\
 Misc options:\n\
   -v             verbose\n\
@@ -321,9 +320,6 @@
     global.params.runtimeImppath = 0;
     global.params.useInlineAsm = 1;
 
-    global.params.defaultlibname = "phobos";
-    global.params.debuglibname = global.params.defaultlibname;
-
     // Predefine version identifiers
 #if IN_LLVM
     VersionCondition::addPredefinedGlobalIdent("LLVM");
@@ -553,10 +549,6 @@
 		    global.params.fileImppath = new Array();
 		global.params.fileImppath->push(p + 2);
 	    }
-        else if (p[1] == 'R')
-        {
-        global.params.runtimePath = p+2;
-        }
 	    else if (memcmp(p + 1, "debug", 5) == 0 && p[6] != 'l')
 	    {
 		// Parse:
@@ -637,11 +629,15 @@
 	    }
 	    else if (memcmp(p + 1, "defaultlib=", 11) == 0)
 	    {
-		global.params.defaultlibname = p + 1 + 11;
+		if(!global.params.defaultlibnames)
+		    global.params.defaultlibnames = new Array();
+		global.params.defaultlibnames->push(p + 1 + 11);
 	    }
 	    else if (memcmp(p + 1, "debuglib=", 9) == 0)
 	    {
-		global.params.debuglibname = p + 1 + 9;
+		if(!global.params.debuglibnames)
+		    global.params.debuglibnames = new Array();
+		global.params.debuglibnames->push(p + 1 + 9);
 	    }
 	    else if (strcmp(p + 1, "run") == 0)
 	    {	global.params.run = 1;
@@ -696,6 +692,29 @@
 	return EXIT_FAILURE;
     }
 
+    Array* libs;
+    if (global.params.symdebug)
+	libs = global.params.debuglibnames;
+    else
+	libs = global.params.defaultlibnames;
+
+    if (libs)
+    {
+	for (int i = 0; i < libs->dim; i++)
+	{
+	    char *arg = (char *)mem.malloc(64);
+	    strcpy(arg, "-l");
+	    strncat(arg, (char *)libs->data[i], 64);
+	    global.params.linkswitches->push(arg);
+	}
+    }
+    else
+    {
+	char *arg = (char *)mem.malloc(64);
+	strcpy(arg, "-ltango-base-llvmdc-native");
+	global.params.linkswitches->push(arg);
+    }
+
     if (global.params.run)
 	global.params.quiet = 1;
 
--- a/dmd/mars.h	Sun Aug 31 18:51:14 2008 +0200
+++ b/dmd/mars.h	Tue Sep 02 19:14:37 2008 +0200
@@ -111,8 +111,8 @@
 
     bool dump_source;
 
-    char *defaultlibname;	// default library for non-debug builds
-    char *debuglibname;		// default library for debug builds
+    Array *defaultlibnames;	// default libraries for non-debug builds
+    Array *debuglibnames;	// default libraries for debug builds
 
     char *xmlname;		// filename for XML output
 
@@ -147,7 +147,6 @@
     char disassemble;
     char llvmInline;
     char llvmAnnotate;
-    char *runtimePath;
     char useInlineAsm;
     char fqnPaths; // use fully qualified object names
 };
--- a/gen/linker.cpp	Sun Aug 31 18:51:14 2008 +0200
+++ b/gen/linker.cpp	Tue Sep 02 19:14:37 2008 +0200
@@ -169,22 +169,6 @@
         args.push_back(p);
     }
 
-    // runtime library
-    // must be linked in last to null terminate the moduleinfo appending list
-    std::string runtime_path(global.params.runtimePath);
-
-    // path seperator can be \ on windows, but we check for /
-#if _WIN32
-    int i=0;
-    while ((i = runtime_path.find("\\", i)) > 0)
-        runtime_path.replace(i, 1, "/");
-#endif
-
-    if (*runtime_path.rbegin() != '/')
-        runtime_path.append("/");
-    runtime_path.append("libtango-base-llvmdc-native.a");
-    args.push_back(runtime_path.c_str());
-
     // print link command?
     if (!global.params.quiet || global.params.verbose)
     {