[ros-dev] Re: [ros-diffs] [cwittich] 19765: added more correct linker flags (patch by brezenbak)

Alex Ionescu ionucu at videotron.ca
Wed Nov 30 06:40:45 CET 2005


cwittich at svn.reactos.com wrote:

>added more correct linker flags (patch by brezenbak)
>
>Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
>  
>
> ------------------------------------------------------------------------
> *Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp*
>
>--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp	2005-11-30 00:25:48 UTC (rev 19764)
>+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp	2005-11-30 00:26:51 UTC (rev 19765)
>@@ -330,8 +330,17 @@
>
> 			}
> 			else if ( exe )
> 			{
>  
>
>-				fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 );
>-				fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", module.baseaddress.c_str ());	
>  
>
>+				if ( module.type == Kernel || module.type == NativeCUI)
>+ 				{
>+ 					fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /SUBSYSTEM:NATIVE /SECTION:INIT,D /ALIGN:4096 /FORCE:MULTIPLE\"\r\n" );
>+ 					fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );
>+					fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint.c_str ());
>+					fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", module.baseaddress.c_str ());	
>+ 				}
>+				else if ( module.type == Win32CUI || module.type == Win32GUI )
>+ 				{
>+ 					fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 );
>+ 				}
>  
>
> 			}
> 			else if ( dll)
> 			{
>  
>
This still isn't fully correct.

First, the check should be widened to inculde Drivers.
Secondly, /SECTION:INIT,D should only be used for Kernel or Drivers, not 
Native apps. Thirdly, /ALIGN:4096 is irrelevant -- this is the default. 
Kernel should get 0x80, and drivers should get 0x20.
Fourthly, Kernel entrypoint should be hard-coded to KiSystemStartup, 
while Native apps shoudl be hardcoded to NtProcessStartup. This is 
especially important so that nt.lib will get used properly.
Also, NativeCUI is a bit repetitive. Native can only be CUI.
Drivers should also be compiled with /DRIVER.
Native, Kernel and Drivers should have /NODEFAULTLIB.
/FORCE:MULTIPLE is ugly and I don't know why it was added.

Best regards,
Alex Ionescu


More information about the Ros-dev mailing list