changeset 567:aaba4f7c6d8a

Get rid of runtime path. Allow defaultlib and debuglib switches to be given multiple times.
author Christian Kamm <kamm incasoftware de>
date Tue, 02 Sep 2008 19:14:25 +0200
parents 1ada9c6865df
children f75b16f1e405
files bin/llvmdc.conf bin/llvmdc.ini dmd/mars.c dmd/mars.h gen/linker.cpp
diffstat 5 files changed, 35 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/bin/llvmdc.conf	Sat Aug 30 10:31:04 2008 +0200
+++ b/bin/llvmdc.conf	Tue Sep 02 19:14:25 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	Sat Aug 30 10:31:04 2008 +0200
+++ b/bin/llvmdc.ini	Tue Sep 02 19:14:25 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	Sat Aug 30 10:31:04 2008 +0200
+++ b/dmd/mars.c	Tue Sep 02 19:14:25 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");
@@ -551,10 +547,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:
@@ -635,11 +627,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;
@@ -694,6 +690,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	Sat Aug 30 10:31:04 2008 +0200
+++ b/dmd/mars.h	Tue Sep 02 19:14:25 2008 +0200
@@ -109,8 +109,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
 
@@ -145,7 +145,6 @@
     char disassemble;
     char llvmInline;
     char llvmAnnotate;
-    char *runtimePath;
     char useInlineAsm;
     char fqnPaths; // use fully qualified object names
 };
--- a/gen/linker.cpp	Sat Aug 30 10:31:04 2008 +0200
+++ b/gen/linker.cpp	Tue Sep 02 19:14:25 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)
     {