Use -of for object name when building executable with -singleobj.

This is what DMD does, and arguably the expected behavior – otherwise,
there would be no way other than using -od to prevent races if two
compiler instances could ever compile the same file(s) at the same
time (e.g. for debug/release configurations).

Should we transition to assuming -singleobj by default?
This commit is contained in:
David Nadlinger
2012-09-30 02:55:38 +02:00
parent b8e62b801b
commit e37cb50999

View File

@@ -1036,7 +1036,19 @@ int main(int argc, char** argv)
{
Module* m = static_cast<Module*>(modules.data[0]);
char* name = m->toChars();
char* filename = m->objfile->name->str;
char* oname;
char* filename;
if ((oname = global.params.exefile) || (oname = global.params.objname))
{
filename = FileName::forceExt(oname, global.obj_ext)->toChars();
if (global.params.objdir)
{
filename = FileName::combine(global.params.objdir, FileName::name(filename));
}
}
else
filename = m->objfile->name->str;
llvm::Linker linker(name, name, context);