[ros-diffs] [fireball] 22405: Change entrypoint to be a get-style method of class Module, having a boolean param which define if the entrypoint is to be returned with or without the leading underscore. Internal entrypoint string holds entrypoint without leading underscore. This makes both mingw and msvc backend happy about entry point names.

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Jun 18 22:30:52 CEST 2006


Author: fireball
Date: Mon Jun 19 00:30:52 2006
New Revision: 22405

URL: http://svn.reactos.ru/svn/reactos?rev=22405&view=rev
Log:
Change entrypoint to be a get-style method of class Module, having a boolean param which define if the entrypoint is to be returned with or without the leading underscore. Internal entrypoint string holds entrypoint without leading underscore.
This makes both mingw and msvc backend happy about entry point names.

Modified:
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
    trunk/reactos/tools/rbuild/module.cpp
    trunk/reactos/tools/rbuild/rbuild.h

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp?rev=22405&r1=22404&r2=22405&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Mon Jun 19 00:30:52 2006
@@ -2302,7 +2302,7 @@
 		string linkerParameters = ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
 		                                     module.GetBasePath ().c_str (),
                                                      cSep,
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        "${gcc}",
@@ -2389,7 +2389,7 @@
 		string dependencies = linkDepsMacro + " " + objectsMacro;
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        "${gcc}",
@@ -2437,7 +2437,7 @@
 		string dependencies = linkDepsMacro + " " + objectsMacro;
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        "${gcc}",
@@ -2484,7 +2484,7 @@
 		string dependencies = linkDepsMacro + " " + objectsMacro;
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -shared",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        "${gcc}",
@@ -2531,7 +2531,7 @@
 		string dependencies = linkDepsMacro + " " + objectsMacro;
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        "${gcc}",
@@ -2584,7 +2584,7 @@
 			linker = "${gcc}";
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -shared",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        linker,
@@ -2637,7 +2637,7 @@
 			linker = "${gcc}";
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        linker,
@@ -2690,7 +2690,7 @@
 			linker = "${gcc}";
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        linker,
@@ -3255,7 +3255,7 @@
 			linker = "${gcc}";
 
 		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
-		                                     module.entrypoint.c_str (),
+		                                     module.GetEntryPoint(true).c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
 		                        linker,

Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp?rev=22405&r1=22404&r2=22405&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp Mon Jun 19 00:30:52 2006
@@ -393,7 +393,7 @@
 				fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" );
 				fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 );
 				fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 );
-				fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DriverEntry" : module.entrypoint.c_str ());
+				fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DriverEntry" : module.GetEntryPoint(false).c_str ());
 				fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ());	
 			}
 			else if ( exe )
@@ -424,7 +424,7 @@
 			}
 			else if ( dll )
 			{
-				fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DllMain" : module.entrypoint.c_str ());
+				fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DllMain" : module.GetEntryPoint(false).c_str ());
 				fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ());
 			}
 			fprintf ( OUT, "\t\t\t\tTargetMachine=\"%d\"/>\r\n", 1 );

Modified: trunk/reactos/tools/rbuild/module.cpp
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?rev=22405&r1=22404&r2=22405&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Mon Jun 19 00:30:52 2006
@@ -825,29 +825,29 @@
 	switch ( type )
 	{
 		case Kernel:
-			return "_NtProcessStartup";
+			return "NtProcessStartup";
 		case KernelModeDLL:
         case KernelModeDriver:
         case ExportDriver:
-			return "_DriverEntry at 8";
+			return "DriverEntry at 8";
 		case NativeDLL:
-			return "_DllMainCRTStartup at 12";
+			return "DllMainCRTStartup at 12";
 		case NativeCUI:
-			return "_NtProcessStartup at 4";
+			return "NtProcessStartup at 4";
 		case Win32DLL:
-			return "_DllMain at 12";
+			return "DllMain at 12";
 		case Win32CUI:
 		case Test:
 			if ( isUnicode )
-				return "_wmainCRTStartup";
+				return "wmainCRTStartup";
 			else
-				return "_mainCRTStartup";
+				return "mainCRTStartup";
 		case Win32SCR:
 		case Win32GUI:
 			if ( isUnicode )
-				return "_wWinMainCRTStartup";
+				return "wWinMainCRTStartup";
 			else
-				return "_WinMainCRTStartup";
+				return "WinMainCRTStartup";
 		case BuildTool:
 		case StaticLibrary:
 		case ObjectLibrary:
@@ -1038,6 +1038,17 @@
 	                  index );
 }
 
+string
+Module::GetEntryPoint(bool leadingUnderscore) const
+{
+	string result = "";
+	if (leadingUnderscore)
+		result = "_";
+
+	result += entrypoint;
+	return result;
+}
+
 bool
 Module::HasFileWithExtension (
 	const IfableData& data,

Modified: trunk/reactos/tools/rbuild/rbuild.h
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=22405&r1=22404&r2=22405&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Mon Jun 19 00:30:52 2006
@@ -285,7 +285,6 @@
 	std::string name;
 	std::string guid;
 	std::string extension;
-	std::string entrypoint;
 	std::string baseaddress;
 	std::string payload;
 	std::string path;
@@ -328,6 +327,7 @@
 	std::string GetPath () const; // "path/foo.exe"
 	std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
 	std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
+	std::string GetEntryPoint(bool leadingUnderscore) const;
 	void GetTargets ( string_list& ) const;
 	std::string GetInvocationTarget ( const int index ) const;
 	bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
@@ -339,6 +339,7 @@
 	std::string GetDefaultModuleExtension () const;
 	std::string GetDefaultModuleEntrypoint () const;
 	std::string GetDefaultModuleBaseaddress () const;
+	std::string entrypoint;
 	void ProcessXMLSubElement ( const XMLElement& e,
 	                            const std::string& path,
 	                            ParseContext& parseContext );




More information about the Ros-diffs mailing list