mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- Don't create a temporary batch file through "echo" commands and replace the double quotation marks by single quotation marks.
This way we are only bound to the CreateProcess limit (32767 characters) and not to the maximum cmd command line (8192 characters). Fixes the "Line too long" problems some people were experiencing. Thanks to Yury Sidorov on ros-dev for the hint. - Simplify the GenerateLinkerCommand code by removing a duplicated code path, which existed for a bug closed some time ago. Thanks to Hervé for the hint. svn path=/trunk/; revision=34218
This commit is contained in:
parent
0feca9ed45
commit
1f305e171d
2 changed files with 15 additions and 36 deletions
|
@ -526,9 +526,8 @@ MingwBackend::GenerateGlobalVariables () const
|
|||
|
||||
fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS) $(PROJECT_CDEFINES)\n" );
|
||||
fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS) $(PROJECT_CDEFINES)\n" );
|
||||
fprintf ( fMakefile, "PROJECT_LFLAGS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\" %s\n",
|
||||
GenerateProjectLFLAGS ().c_str () );
|
||||
fprintf ( fMakefile, "PROJECT_LPPFLAGS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libgcc.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\"\n" );
|
||||
fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () );
|
||||
fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)'\n" );
|
||||
fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
|
||||
fprintf ( fMakefile, "ifneq ($(OARCH),)\n" );
|
||||
fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
|
||||
|
|
|
@ -1580,7 +1580,6 @@ MingwModuleHandler::GenerateLinkerCommand (
|
|||
{
|
||||
const FileLocation *target_file = GetTargetFilename ( module, NULL );
|
||||
const FileLocation *definitionFilename = GetDefinitionFilename ();
|
||||
const FileLocation temp_obj ( TemporaryDirectory, "", module.name + ".temp.ld" );
|
||||
string linker = "${ld}";
|
||||
string objectsMacro = GetObjectsMacro ( module );
|
||||
string libsMacro = GetLibsMacro ();
|
||||
|
@ -1604,28 +1603,23 @@ MingwModuleHandler::GenerateLinkerCommand (
|
|||
string targetName ( module.output->name );
|
||||
|
||||
/* 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)\"";
|
||||
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 () )
|
||||
if ( !module.HasImportLibrary() )
|
||||
{
|
||||
fprintf ( fMakefile,
|
||||
"\t%s %s%s @%s %s -o %s\n",
|
||||
"\t%s %s%s %s %s%s%s %s -o %s\n",
|
||||
linker.c_str (),
|
||||
linkerParameters.c_str (),
|
||||
linkerScriptArgument.c_str (),
|
||||
backend->GetFullName ( temp_obj ).c_str (),
|
||||
objectsMacro.c_str (),
|
||||
module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
|
||||
module.cplusplus && (module.type == KernelModeDLL || module.type == KernelModeDriver) ? libsCppKernel.c_str () : "",
|
||||
libsMacro.c_str (),
|
||||
GetLinkerMacro ().c_str (),
|
||||
target_macro.c_str () );
|
||||
}
|
||||
else if ( module.HasImportLibrary () )
|
||||
else
|
||||
{
|
||||
FileLocation temp_exp ( TemporaryDirectory,
|
||||
"",
|
||||
|
@ -1641,12 +1635,15 @@ MingwModuleHandler::GenerateLinkerCommand (
|
|||
module.underscoreSymbols ? " --add-underscore" : "" );
|
||||
|
||||
fprintf ( fMakefile,
|
||||
"\t%s %s%s %s @%s %s -o %s\n",
|
||||
"\t%s %s%s %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 (),
|
||||
objectsMacro.c_str (),
|
||||
module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
|
||||
module.cplusplus && (module.type == KernelModeDLL || module.type == KernelModeDriver) ? libsCppKernel.c_str () : "",
|
||||
libsMacro.c_str (),
|
||||
GetLinkerMacro ().c_str (),
|
||||
target_macro.c_str () );
|
||||
|
||||
|
@ -1659,23 +1656,6 @@ MingwModuleHandler::GenerateLinkerCommand (
|
|||
"\t-@${rm} %s 2>$(NUL)\n",
|
||||
backend->GetFullName ( temp_exp ).c_str () );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XXX: need to workaround binutils bug, which exports
|
||||
* all functions in a dll if no .def file or an empty
|
||||
* one has been provided... */
|
||||
/* See bug 1244 */
|
||||
//printf ( "%s will have all its functions exported\n",
|
||||
// module.target->name.c_str () );
|
||||
fprintf ( fMakefile,
|
||||
"\t%s %s%s @%s %s -o %s\n",
|
||||
linker.c_str (),
|
||||
linkerParameters.c_str (),
|
||||
linkerScriptArgument.c_str (),
|
||||
backend->GetFullName ( temp_obj ).c_str (),
|
||||
GetLinkerMacro ().c_str (),
|
||||
target_macro.c_str () );
|
||||
}
|
||||
|
||||
GenerateBuildMapCode ();
|
||||
GenerateBuildNonSymbolStrippedCode ();
|
||||
|
|
Loading…
Reference in a new issue