Get rid of runtime path. Allow defaultlib and debuglib switches to be given multiple times.

This commit is contained in:
Christian Kamm
2008-09-02 19:14:25 +02:00
parent 6916319f9f
commit 877da230a3
5 changed files with 35 additions and 33 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -223,11 +223,10 @@ Codegen control:\n\
-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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
}
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 @@ int main(int argc, char *argv[])
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;

View File

@@ -109,8 +109,8 @@ struct Param
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 @@ struct Param
char disassemble;
char llvmInline;
char llvmAnnotate;
char *runtimePath;
char useInlineAsm;
char fqnPaths; // use fully qualified object names
};

View File

@@ -169,22 +169,6 @@ int linkExecutable(const char* argv0)
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)
{