Move some more linker args to temp file, so command line is not too long

Fix link of C++ kernel mode dlls/drivers

svn path=/trunk/; revision=34189
This commit is contained in:
Hervé Poussineau
2008-06-29 13:49:39 +00:00
parent 6a4e897e5c
commit 1772c969ed
@@ -1603,21 +1603,25 @@ MingwModuleHandler::GenerateLinkerCommand (
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
string targetName ( module.output->name );
fprintf ( fMakefile, "\t@echo $(subst $(SEP),/,%s) > %s\n",
/* HACK: if we have C++ in kernel, link it with some user mode dlls (kernel32 + msvcrt) ... */
static const string libsCppKernel = " \"$(shell ${TARGET_CC} -print-file-name=libkernel32.a)\" \"$(shell ${TARGET_CC} -print-file-name=libmsvcrt.a)\"";
fprintf ( fMakefile, "\t@echo $(subst $(SEP),/,%s)%s%s $(subst $(SEP),/,%s) > %s\n",
objectsMacro.c_str (),
module.cplusplus ? " $(PROJECT_LPPFLAGS)" : "",
module.cplusplus && (module.type == KernelModeDLL || module.type == KernelModeDriver) ? libsCppKernel.c_str () : "",
libsMacro.c_str (),
backend->GetFullName ( temp_obj ).c_str () );
CLEAN_FILE ( temp_obj );
if ( !module.IsDLL () )
{
fprintf ( fMakefile,
"\t%s %s%s @%s %s%s %s -o %s\n",
"\t%s %s%s @%s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
backend->GetFullName ( temp_obj ).c_str (),
module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
}
@@ -1637,14 +1641,12 @@ MingwModuleHandler::GenerateLinkerCommand (
module.underscoreSymbols ? " --add-underscore" : "" );
fprintf ( fMakefile,
"\t%s %s%s %s @%s %s%s %s -o %s\n",
"\t%s %s%s %s @%s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
backend->GetFullName ( temp_exp ).c_str (),
backend->GetFullName ( temp_obj ).c_str (),
module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
@@ -1666,13 +1668,11 @@ MingwModuleHandler::GenerateLinkerCommand (
//printf ( "%s will have all its functions exported\n",
// module.target->name.c_str () );
fprintf ( fMakefile,
"\t%s %s%s @%s %s%s %s -o %s\n",
"\t%s %s%s @%s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
backend->GetFullName ( temp_obj ).c_str (),
module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
}