Author: hpoussin
Date: Sun Sep 28 09:17:45 2008
New Revision: 36576
URL:
http://svn.reactos.org/svn/reactos?rev=36576&view=rev
Log:
Remove a hack, and link with C++ libraries only when required
Patch by Cecill Etheredge ( ijsf at gmx dot net )
Modified:
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Sun Sep 28
09:17:45 2008
@@ -1481,19 +1481,22 @@
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
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)'";
+ /* check if we need to add default C++ libraries, ie if we have
+ * a C++ user-mode module without the -nostdlib linker flag
+ */
+ bool link_defaultlibs = module.cplusplus &&
+ linkerParameters.find ("-nostdlib") == string::npos
&&
+ !(module.type == KernelModeDLL || module.type ==
KernelModeDriver);
if ( !module.HasImportLibrary() )
{
fprintf ( fMakefile,
- "\t%s %s%s %s %s%s %s %s -o %s\n",
+ "\t%s %s%s %s %s %s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
objectsMacro.c_str (),
- module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
- module.cplusplus && (module.type == KernelModeDLL || module.type ==
KernelModeDriver) ? libsCppKernel.c_str () : "",
+ link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
@@ -1514,14 +1517,14 @@
module.underscoreSymbols ? " --add-underscore" : "" );
fprintf ( fMakefile,
- "\t%s %s%s %s %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_exp ).c_str (),
objectsMacro.c_str (),
- module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
- module.cplusplus && (module.type == KernelModeDLL || module.type ==
KernelModeDriver) ? libsCppKernel.c_str () : "",
+ link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );