Don't strip relocation information from DLLs
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-06 10:38:30 UTC (rev 15035)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler.cpp	2005-05-06 10:45:24 UTC (rev 15036)
@@ -1254,7 +1254,8 @@
 		target_folder.c_str () );
 	fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
 	string targetName ( module.GetTargetName () );
-	if ( module.importLibrary != NULL )
+
+	if ( module.IsDLL () )
 	{
 		string base_tmp = ros_temp + module.name + ".base.tmp";
 		CLEAN_FILE ( base_tmp );
@@ -1263,7 +1264,7 @@
 		string temp_exp = ros_temp + module.name + ".temp.exp";
 		CLEAN_FILE ( temp_exp );
 		string def_file = GetDefinitionFilename ();
-
+	
 		fprintf ( fMakefile,
 		          "\t%s %s -Wl,--base-file,%s -o %s %s %s %s\n",
 		          linker.c_str (),
@@ -1273,11 +1274,11 @@
 		          objectsMacro.c_str (),
 		          libsMacro.c_str (),
 		          GetLinkerMacro ().c_str () );
-
+	
 		fprintf ( fMakefile,
 		          "\t-@${rm} %s 2>$(NUL)\n",
 		          junk_tmp.c_str () );
-
+	
 		string killAt = module.mangledSymbols ? "" : "--kill-at";
 		fprintf ( fMakefile,
 		          "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s %s\n",
@@ -1286,11 +1287,11 @@
 		          def_file.c_str (),
 		          temp_exp.c_str (),
 		          killAt.c_str () );
-
+	
 		fprintf ( fMakefile,
 		          "\t-@${rm} %s 2>$(NUL)\n",
 		          base_tmp.c_str () );
-
+	
 		fprintf ( fMakefile,
 		          "\t%s %s %s -o %s %s %s %s\n",
 		          linker.c_str (),
@@ -1300,12 +1301,21 @@
 		          objectsMacro.c_str (),
 		          libsMacro.c_str (),
 		          GetLinkerMacro ().c_str () );
-
+	
 		fprintf ( fMakefile,
 		          "\t-@${rm} %s 2>$(NUL)\n",
 		          temp_exp.c_str () );
 		
 		GenerateCleanObjectsAsYouGoCode ();
+	
+		GenerateBuildMapCode ();
+	
+		GenerateBuildNonSymbolStrippedCode ();
+	
+		fprintf ( fMakefile,
+		          "\t$(ECHO_RSYM)\n" );
+		fprintf ( fMakefile,
+		          "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
 	}
 	else
 	{
@@ -1320,15 +1330,6 @@
 
 		GenerateCleanObjectsAsYouGoCode ();
 	}
-
-	GenerateBuildMapCode ();
-
-	GenerateBuildNonSymbolStrippedCode ();
-
-	fprintf ( fMakefile,
-	          "\t$(ECHO_RSYM)\n" );
-	fprintf ( fMakefile,
-	          "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
 }
 
 void
@@ -1790,12 +1791,17 @@
 string
 MingwModuleHandler::GetDefinitionFilename () const
 {
-	string defFilename = module.GetBasePath () + SSEP + module.importLibrary->definition;
-	if ( IsWineModule () )
-		return PassThruCacheDirectory ( NormalizeFilename ( defFilename ),
-		                                backend->intermediateDirectory );
+	if ( module.importLibrary != NULL )
+	{
+		string defFilename = module.GetBasePath () + SSEP + module.importLibrary->definition;
+		if ( IsWineModule () )
+			return PassThruCacheDirectory ( NormalizeFilename ( defFilename ),
+			                                backend->intermediateDirectory );
+		else
+			return defFilename;
+	}
 	else
-		return defFilename;
+		return "tools" SSEP "rbuild" SSEP "empty.def";
 }
 
 void
@@ -1954,7 +1960,7 @@
 	CLEAN_FILE ( junk_tmp );
 	string temp_exp = ros_temp + module.name + ".temp.exp";
 	CLEAN_FILE ( temp_exp );
-	string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",
+	string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll -Wl,--dll",
 	                              module.GetBasePath ().c_str (),
 	                              module.entrypoint.c_str (),
 	                              module.baseaddress.c_str () );
@@ -2076,7 +2082,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 -mdll",
+		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll --dll",
 		                                     module.entrypoint.c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
@@ -2123,7 +2129,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 -mdll",
+		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll -Wl,--dll",
 		                                     module.entrypoint.c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
@@ -2169,7 +2175,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 -mdll",
+		string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll -Wl,--dll",
 		                                     module.entrypoint.c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,
@@ -2291,7 +2297,7 @@
 		else
 			linker = "${gcc}";
 
-		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",
+		string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll -Wl,--dll",
 		                                     module.entrypoint.c_str (),
 		                                     module.baseaddress.c_str () );
 		GenerateLinkerCommand ( dependencies,

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-05-06 10:38:30 UTC (rev 15035)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp	2005-05-06 10:45:24 UTC (rev 15036)
@@ -40,7 +40,7 @@
 
 
 InvalidOperationException::InvalidOperationException ( const char* filename,
-	                                                   const int linenumber )
+                                                       const int linenumber )
 {
 	Message = ssprintf ( "%s:%d",
 	                     filename,
@@ -48,9 +48,9 @@
 }
 
 InvalidOperationException::InvalidOperationException ( const char* filename,
-	                                                   const int linenumber,
-	                                                   const char* message,
-	                                                   ... )
+                                                       const int linenumber,
+                                                       const char* message,
+                                                       ... )
 {
 	string errorMessage;
 	va_list args;

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-05-06 10:38:30 UTC (rev 15035)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp	2005-05-06 10:45:24 UTC (rev 15036)
@@ -523,7 +523,7 @@
 string
 Module::GetDefaultModuleEntrypoint () const
 {
-	switch (type)
+	switch ( type )
 	{
 		case Kernel:
 			return "_NtProcessStartup";
@@ -560,7 +560,7 @@
 string
 Module::GetDefaultModuleBaseaddress () const
 {
-	switch (type)
+	switch ( type )
 	{
 		case Kernel:
 			return "0xc0000000";
@@ -600,6 +600,36 @@
 	return importLibrary != NULL;
 }
 
+bool
+Module::IsDLL () const
+{
+	switch ( type )
+	{
+		case Kernel:
+		case KernelModeDLL:
+		case NativeDLL:
+		case Win32DLL:
+		case KernelModeDriver:
+			return true;
+		case NativeCUI:
+		case Win32CUI:
+		case Test:
+		case Win32GUI:
+		case BuildTool:
+		case StaticLibrary:
+		case ObjectLibrary:
+		case BootLoader:
+		case BootSector:
+		case Iso:
+		case LiveIso:
+		case RpcServer:
+		case RpcClient:
+			return false;
+	}
+	throw InvalidOperationException ( __FILE__,
+	                                  __LINE__ );
+}
+
 string
 Module::GetTargetName () const
 {

Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-05-06 10:38:30 UTC (rev 15035)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h	2005-05-06 10:45:24 UTC (rev 15036)
@@ -123,24 +123,24 @@
 
 enum ModuleType
 {
-	BuildTool,
-	StaticLibrary,
-	ObjectLibrary,
-	Kernel,
-	KernelModeDLL,
-	KernelModeDriver,
-	NativeDLL,
-	NativeCUI,
-	Win32DLL,
-	Win32CUI,
-	Win32GUI,
-	BootLoader,
-	BootSector,
-	Iso,
-	LiveIso,
-	Test,
-	RpcServer,
-	RpcClient
+	BuildTool = 0,
+	StaticLibrary = 1,
+	ObjectLibrary = 2,
+	Kernel = 3,
+	KernelModeDLL = 4,
+	KernelModeDriver = 5,
+	NativeDLL = 6,
+	NativeCUI = 7,
+	Win32DLL = 8,
+	Win32CUI = 9,
+	Win32GUI = 10,
+	BootLoader = 11,
+	BootSector = 12,
+	Iso = 13,
+	LiveIso = 14,
+	Test = 15,
+	RpcServer = 16,
+	RpcClient = 17
 };
 
 enum HostType
@@ -187,6 +187,7 @@
 	ModuleType GetModuleType ( const std::string& location,
 	                           const XMLAttribute& attribute );
 	bool HasImportLibrary () const;
+	bool IsDLL () const;
 	std::string GetTargetName () const;
 	std::string GetDependencyPath () const;
 	std::string GetBasePath () const;