Don't strip relocation information from DLLs

svn path=/branches/xmlbuildsystem/; revision=15036
This commit is contained in:
Casper Hornstrup 2005-05-06 10:45:24 +00:00
parent ae18ba571a
commit 3dc17696df
4 changed files with 87 additions and 50 deletions

View file

@ -1254,7 +1254,8 @@ MingwModuleHandler::GenerateLinkerCommand (
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 );
@ -1306,6 +1307,15 @@ MingwModuleHandler::GenerateLinkerCommand (
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 @@ MingwModuleHandler::GenerateLinkerCommand (
GenerateCleanObjectsAsYouGoCode ();
}
GenerateBuildMapCode ();
GenerateBuildNonSymbolStrippedCode ();
fprintf ( fMakefile,
"\t$(ECHO_RSYM)\n" );
fprintf ( fMakefile,
"\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
}
void
@ -1790,12 +1791,17 @@ MingwModuleHandler::IsWineModule () const
string
MingwModuleHandler::GetDefinitionFilename () const
{
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 "tools" SSEP "rbuild" SSEP "empty.def";
}
void
@ -1954,7 +1960,7 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ()
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 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()
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 @@ MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ()
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 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()
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 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()
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,

View file

@ -523,7 +523,7 @@ Module::GetDefaultModuleExtension () const
string
Module::GetDefaultModuleEntrypoint () const
{
switch (type)
switch ( type )
{
case Kernel:
return "_NtProcessStartup";
@ -560,7 +560,7 @@ Module::GetDefaultModuleEntrypoint () const
string
Module::GetDefaultModuleBaseaddress () const
{
switch (type)
switch ( type )
{
case Kernel:
return "0xc0000000";
@ -600,6 +600,36 @@ Module::HasImportLibrary () const
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
{

View file

@ -123,24 +123,24 @@ private:
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 @@ public:
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;