Support for non-standard module base addresses
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
Added: branches/xmlbuildsystem/reactos/baseaddress.xml
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
_____
Modified: branches/xmlbuildsystem/reactos/ReactOS.xml
--- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-02-26 16:40:44 UTC
(rev 13754)
+++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-02-26 17:11:06 UTC
(rev 13755)
@@ -7,6 +7,8 @@
</xi:fallback>
</xi:include>
+ <xi:include href="baseaddress.xml" />
+
<define name="_M_IX86" />
<if property="DBG" value="1">
<define name="DBG" value="1" />
_____
Added: branches/xmlbuildsystem/reactos/baseaddress.xml
--- branches/xmlbuildsystem/reactos/baseaddress.xml 2005-02-26
16:40:44 UTC (rev 13754)
+++ branches/xmlbuildsystem/reactos/baseaddress.xml 2005-02-26
17:11:06 UTC (rev 13755)
@@ -0,0 +1,89 @@
+<property name="BASEADDRESS_DINPUT8" value="0x00400000" />
+<property name="BASEADDRESS_DXDIAGN" value="0x00400000" />
+<property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
+<property name="BASEADDRESS_SECURE32" value="0x10000000" />
+<property name="BASEADDRESS_DEVENUM" value="0x35680000" />
+<property name="BASEADDRESS_DSOUND" value="0x50000000" />
+<property name="BASEADDRESS_GLU32" value="0x50000000" />
+<property name="BASEADDRESS_OPENGL32" value="0x50000000" />
+<property name="BASEADDRESS_SLAYER" value="0x5C7E0000" />
+<property name="BASEADDRESS_DINPUT" value="0x5F580000" />
+<property name="BASEADDRESS_TIMEDATE" value="0x64DA0000" />
+<property name="BASEADDRESS_SYSDM" value="0x64DD0000" />
+<property name="BASEADDRESS_NCPL" value="0x64EA0000" />
+<property name="BASEADDRESS_MAIN" value="0x64F40000" />
+<property name="BASEADDRESS_INTL" value="0x64FB0000" />
+<property name="BASEADDRESS_DESK" value="0x65080000" />
+<property name="BASEADDRESS_APPWIZ" value="0x65100000" />
+<property name="BASEADDRESS_ACCESS" value="0x65180000" />
+<property name="BASEADDRESS_HID" value="0x688F0000" />
+<property name="BASEADDRESS_PSXDLL" value="0x68eb0000" />
+<property name="BASEADDRESS_PSAPI" value="0x68f70000" />
+<property name="BASEADDRESS_MSIMG32" value="0x69cc0000" />
+<property name="BASEADDRESS_NETPLWIZ" value="0x6a240000" />
+<property name="BASEADDRESS_UNICODE" value="0x6b200000" />
+<property name="BASEADDRESS_DISPLAY" value="DISPLAY" />
+<property name="BASEADDRESS_CARDS" value="0x701a0000" />
+<property name="BASEADDRESS_WININET" value="0x70200000" />
+<property name="BASEADDRESS_ACLUI" value="0x71550000" />
+<property name="BASEADDRESS_SHDOCVW" value="0x71700000" />
+<property name="BASEADDRESS_MSWSOCK" value="0x71a30000" />
+<property name="BASEADDRESS_WSOCK32" value="0x71ab0000" />
+<property name="BASEADDRESS_ACLEDIT" value="0x71b70000" />
+<property name="BASEADDRESS_NETAPI32" value="0x71c00000" />
+<property name="BASEADDRESS_WINFAX" value="0x722C0000" />
+<property name="BASEADDRESS_DEVMGR" value="0x72a90000" />
+<property name="BASEADDRESS_WINSCARD" value="0x723D0000" />
+<property name="BASEADDRESS_COREDLL" value="0x73d80000" />
+<property name="BASEADDRESS_LZEXPAND" value="0x73d80000" />
+<property name="BASEADDRESS_USERENV" value="0x74850000" />
+<property name="BASEADDRESS_SYSSETUP" value="0x74a30000" />
+<property name="BASEADDRESS_OLEDLG" value="0x74d00000" />
+<property name="BASEADDRESS_SAMLIB" value="0x750C0000" />
+<property name="BASEADDRESS_CABINET" value="0x75120000" />
+<property name="BASEADDRESS_MSGINA" value="0x75970000" />
+<property name="BASEADDRESS_COMMCTRL" value="0x75e60000" />
+<property name="BASEADDRESS_IMM32" value="0x75e60000" />
+<property name="BASEADDRESS_RPCRT4" value="0x76000000" />
+<property name="BASEADDRESS_MIDIMAP" value="0x76600000" />
+<property name="BASEADDRESS_SHLWAPI" value="0x76120000" />
+<property name="BASEADDRESS_COMCTL32" value="0x76160000" />
+<property name="BASEADDRESS_COMDLG32" value="0x76200000" />
+<property name="BASEADDRESS_OLEAUT32" value="0x76260000" />
+<property name="BASEADDRESS_D3D8THK" value="0x76340000" />
+<property name="BASEADDRESS_RICHEDIT" value="0x76340000" />
+<property name="BASEADDRESS_TWAIN_32" value="0x76380000" />
+<property name="BASEADDRESS_LSASRV" value="0x76540000" />
+<property name="BASEADDRESS_MPR" value="0x76620000" />
+<property name="BASEADDRESS_ODBC32" value="0x76660000" />
+<property name="BASEADDRESS_SETUPAPI" value="0x76660000" />
+<property name="BASEADDRESS_GDIPLUS" value="0x76a00000" />
+<property name="BASEADDRESS_IMAGEHLP" value="0x76c90000" />
+<property name="BASEADDRESS_FMIFS" value="0x76df0000" />
+<property name="BASEADDRESS_SHELL32" value="0x77260000" />
+<property name="BASEADDRESS_IPHLPAPI" value="0x77300000" />
+<property name="BASEADDRESS_MSACM" value="0x77400000" />
+<property name="BASEADDRESS_MMDRV" value="0x77500000" />
+<property name="BASEADDRESS_CRTDLL" value="0x77630000" />
+<property name="BASEADDRESS_PACKET" value="0x77780000" />
+<property name="BASEADDRESS_W2_32" value="0x77780000" />
+<property name="BASEADDRESS_MSAFD" value="0x777a0000" />
+<property name="BASEADDRESS_IPRTPRIO" value="0x777c0000" />
+<property name="BASEADDRESS_SNMPAPI" value="0x777c0000" />
+<property name="BASEADDRESS_WINMM" value="0x777c0000" />
+<property name="BASEADDRESS_WS2HELP" value="0x777c0000" />
+<property name="BASEADDRESS_WSHIRDA" value="0x777c0000" />
+<property name="BASEADDRESS_WSHTCPIP" value="0x777c0000" />
+<property name="BASEADDRESS_WINSPOOL" value="0x77800000" />
+<property name="BASEADDRESS_OLE32" value="0x77a50000" />
+<property name="BASEADDRESS_OLEPRO32" value="0x77a50000" />
+<property name="BASEADDRESS_VERSION" value="0x77a90000" />
+<property name="BASEADDRESS_ADVAPI32" value="0x77dc0000" />
+<property name="BASEADDRESS_USER32" value="0x77e60000" />
+<property name="BASEADDRESS_GDI32" value="0x77ed0000" />
+<property name="BASEADDRESS_DNSAPI" value="0x77f00000" />
+<property name="BASEADDRESS_MSVCRT" value="0x78000000" />
+<property name="BASEADDRESS_MSVCRT20" value="0x78500000" />
+<property name="BASEADDRESS_EXPAT" value="0x79000000" />
+<property name="BASEADDRESS_KERNEL32" value="0x7C800000" />
+<property name="BASEADDRESS_NTDLL" value="0x7C900000" />
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp
---
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-02-26 16:40:44 UTC (rev 13754)
+++
branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler
.cpp 2005-02-26 17:11:06 UTC (rev 13755)
@@ -1340,9 +1340,10 @@
string base_tmp = ros_junk + module.name + ".base.tmp";
string junk_tmp = ros_junk + module.name + ".junk.tmp";
string temp_exp = ros_junk + module.name + ".temp.exp";
- string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk
-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0xC0000000
-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",
module.GetBasePath ().c_str (),
- module.entrypoint.c_str () );
+ module.entrypoint.c_str (),
+ module.baseaddress.c_str () );
GenerateMacrosAndTargetsTarget ( module );
@@ -1466,8 +1467,9 @@
archiveFilename.c_str (),
importLibraryDependencies.c_str () );
- string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-mdll",
-
module.entrypoint.c_str () );
+ string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-mdll",
+
module.entrypoint.c_str (),
+
module.baseaddress.c_str () );
GenerateLinkerCommand ( module,
"${gcc}",
linkerParameters,
@@ -1523,8 +1525,9 @@
archiveFilename.c_str (),
importLibraryDependencies.c_str () );
- string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-mdll",
-
module.entrypoint.c_str () );
+ string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-mdll",
+
module.entrypoint.c_str (),
+
module.baseaddress.c_str () );
GenerateLinkerCommand ( module,
"${gcc}",
linkerParameters,
@@ -1576,8 +1579,9 @@
archiveFilename.c_str (),
importLibraryDependencies.c_str () );
- string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-nostdlib -mdll",
-
module.entrypoint.c_str () );
+ string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-nostdlib -mdll",
+
module.entrypoint.c_str (),
+
module.baseaddress.c_str () );
GenerateLinkerCommand ( module,
"${gcc}",
linkerParameters,
@@ -1633,8 +1637,9 @@
archiveFilename.c_str (),
importLibraryDependencies.c_str () );
- string linkerParameters = ssprintf (
"-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,0x10000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles
-nostdlib",
-
module.entrypoint.c_str () );
+ 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.baseaddress.c_str () );
GenerateLinkerCommand ( module,
"${gcc}",
linkerParameters,
@@ -1712,8 +1717,9 @@
else
linker = "${gcc}";
- string linkerParameters = ssprintf (
"-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,0x10000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",
-
module.entrypoint.c_str () );
+ string linkerParameters = ssprintf (
"-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",
+
module.entrypoint.c_str (),
+
module.baseaddress.c_str () );
GenerateLinkerCommand ( module,
linker,
linkerParameters,
@@ -1770,8 +1776,9 @@
else
linker = "${gcc}";
- string linkerParameters = ssprintf (
"-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,0x00400000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
-
module.entrypoint.c_str () );
+ 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.baseaddress.c_str () );
GenerateLinkerCommand ( module,
linker,
linkerParameters,
@@ -1828,8 +1835,9 @@
else
linker = "${gcc}";
- string linkerParameters = ssprintf (
"-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,0x00400000
-Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
-
module.entrypoint.c_str () );
+ 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.baseaddress.c_str () );
GenerateLinkerCommand ( module,
linker,
linkerParameters,
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
2005-02-26 16:40:44 UTC (rev 13754)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp
2005-02-26 17:11:06 UTC (rev 13755)
@@ -82,6 +82,12 @@
else
entrypoint = GetDefaultModuleEntrypoint ();
+ att = moduleNode.GetAttribute ( "baseaddress", false );
+ if ( att != NULL )
+ baseaddress = att->value;
+ else
+ baseaddress = GetDefaultModuleBaseaddress ();
+
att = moduleNode.GetAttribute ( "mangledsymbols", false );
if ( att != NULL )
mangledSymbols = att->value != "false";
@@ -365,6 +371,39 @@
__LINE__ );
}
+string
+Module::GetDefaultModuleBaseaddress () const
+{
+ switch (type)
+ {
+ case Kernel:
+ return "0xc0000000";
+ case KernelModeDLL:
+ return "0x10000";
+ case NativeDLL:
+ return "0x10000";
+ case NativeCUI:
+ return "0x10000";
+ case Win32DLL:
+ return "0x10000";
+ case Win32CUI:
+ return "0x00400000";
+ case Win32GUI:
+ return "0x00400000";
+ case KernelModeDriver:
+ return "0x10000";
+ case BuildTool:
+ case StaticLibrary:
+ case ObjectLibrary:
+ case BootLoader:
+ case BootSector:
+ case Iso:
+ return "";
+ }
+ throw InvalidOperationException ( __FILE__,
+ __LINE__ );
+}
+
bool
Module::HasImportLibrary () const
{
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
2005-02-26 16:40:44 UTC (rev 13754)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h
2005-02-26 17:11:06 UTC (rev 13755)
@@ -122,6 +122,7 @@
std::string name;
std::string extension;
std::string entrypoint;
+ std::string baseaddress;
std::string path;
ModuleType type;
ImportLibrary* importLibrary;
@@ -157,6 +158,7 @@
private:
std::string GetDefaultModuleExtension () const;
std::string GetDefaultModuleEntrypoint () const;
+ std::string GetDefaultModuleBaseaddress () const;
void ProcessXMLSubElement ( const XMLElement& e,
const std::string& path,
If* pIf = NULL );
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
--- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
2005-02-26 16:40:44 UTC (rev 13754)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.txt
2005-02-26 17:11:06 UTC (rev 13755)
@@ -3,21 +3,16 @@
Building ReactOS
----------------
-To generate GNU make makefiles for building ReactOS do the following:
+To generate GNU make makefiles and building ReactOS do the following:
1) Go to the top-level reactos directory
- 2) Run the command: mingw32-make -C tools\reactos
- 3) Run the command: tools\rbuild\rbuild mingw
+ 2) Run the command: mingw32-make
-This will generate Makefile.auto in the current directory. Now run the
following command:
-
- mingw32-make -f Makefile.auto
-
This will start building ReactOS.
To build a bootable CD run the following command:
- mingw32-make -f Makefile.auto bootcd
+ mingw32-make bootcd
This will create ReactOS.iso in the top-level reactos directory.
@@ -112,7 +107,7 @@
There can be zero or more modules per xml build file.
Syntax:
- <module name="msvcrt" type="win32dll" extension=".dll"
entrypoint="_DllMain@12" mangledsymbols="true">
+ <module name="msvcrt" type="win32dll" extension=".dll"
entrypoint="_DllMain@12" baseaddress="0x70000000"
mangledsymbols="true">
...
</module>
@@ -120,7 +115,8 @@
name - Name of the module. Also the base name of the generated
file if such file is generated for the particular module type.
type - Type of module. See below for an explanation of module
types.
extension - Extension of the generated file if such file is
generated for the particular module type.
- entrypoint - Entrypoint for the generated file if such file is
generated for the particular module type.
+ entrypoint - Entrypoint symbol of the generated file if such
file is generated for the particular module type.
+ baseaddress - Base address of the generated file if such file is
generated for the particular module type.
mangledsymbols - Controls wether or not to pass --kill-at to
dlltool. If this attribute has the value false then --kill-at is passed
to dlltool. If the value is true, then --kill-at is not passed to
dlltool. If the generated file exports C++ classes then this need to be
true.
Value:
@@ -133,18 +129,18 @@
Module types
------------
The module type determines the actions that is to be carried out to
process the module. The defined module types are seen below:
- buildtool - Builds a tool that can be run (invoked) when
building ReactOS. Default extension is .exe when building on Windows and
nothing when building on Linux. The entrypoint module attribute is not
applicable for this module type.
- staticlibrary - Builds a static library containing object files
that can be linked together with other modules. Default extension is .a.
The entrypoint module attribute is not applicable for this module type.
- objectlibrary - Builds object files that can be linked together
with other modules. Default extension is .o. The entrypoint module
attribute is not applicable for this module type.
+ buildtool - Builds a tool that can be run (invoked) when
building ReactOS. Default extension is .exe when building on Windows and
nothing when building on Linux. The entrypoint, baseaddress, and
mangledsymbols module attributes are not applicable for this module
type.
+ staticlibrary - Builds a static library containing object files
that can be linked together with other modules. Default extension is .a.
The entrypoint, baseaddress, and mangledsymbols module attributes are
not applicable for this module type.
+ objectlibrary - Builds object files that can be linked together
with other modules. Default extension is .o. The entrypoint,
baseaddress, and mangledsymbols module attributes are not applicable for
this module type.
kernel - Builds ntoskrnl.exe. Default extension is .exe. Default
entrypoint is _NtProcessStartup.
kernelmodedll - Builds a kernel-mode DLL. Default extension is
.dll. Default entrypoint is _DriverEntry@8.
kernelmodedriver - Builds a kernel-mode driver. Default
extension is .sys. Default entrypoint is _DriverEntry@8.
nativedll - Builds a native DLL. Default extension is .dll.
Default entrypoint is _DllMainCRTStartup@12.
win32dll - Builds a Win32 DLL. Default extension is .dll.
Default entrypoint is _DllMain@12.
- win32gui - Builds a Win32 GUI executable. Default extension is
.exe. Default entrypoint is _WinMainCRTStartup.
- bootloader - Builds a bootloader. The extension and entrypoint
module attributes are not applicable for this module type.
- bootsector - Builds one or more bootsector binaries. The
extension and entrypoint module attributes are not applicable for this
module type.
- iso - Builds a bootable CD. The extension and entrypoint module
attributes are not applicable for this module type
+ win32gui - Builds a Win32 GUI executable. Default extension is
.exe. Default entrypoint is _WinMainCRTStartup. The baseaddress module
attribute is not applicable for this module type.
+ bootloader - Builds a bootloader. The entrypoint, baseaddress,
and mangledsymbols module attributes are not applicable for this module
type.
+ bootsector - Builds one or more bootsector binaries. The
entrypoint, baseaddress, and mangledsymbols module attributes are not
applicable for this module type.
+ iso - Builds a bootable CD. The entrypoint, baseaddress, and
mangledsymbols module attributes are not applicable for this module
type.
Define element