[ros-diffs] [hpoussin] 34189: Move some more linker args to temp file, so command line is not too long Fix link of C++ kernel mode dlls/drivers

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Sun Jun 29 15:49:39 CEST 2008


Author: hpoussin
Date: Sun Jun 29 08:49:39 2008
New Revision: 34189

URL: http://svn.reactos.org/svn/reactos?rev=34189&view=rev
Log:
Move some more linker args to temp file, so command line is not too long
Fix link of C++ kernel mode dlls/drivers

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/modulehandler.cpp?rev=34189&r1=34188&r2=34189&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Sun Jun 29 08:49:39 2008
@@ -1603,21 +1603,25 @@
 	fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
 	string targetName ( module.output->name );
 
-	fprintf ( fMakefile, "\t at 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 at 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 @@
 		          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 @@
 		//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 () );
 	}



More information about the Ros-diffs mailing list