Patch to GCC and Binutils to support the Xbox target

"asterisk" <asterisk-oTjUgWXsarvbrpumdhrUUwC/[email protected]> Wed, 6 Aug 2003 19:05:30 -0700
Newsgroups gmane.comp.gnu.mingw.patches
Message-ID <049e01c35c88$62ff44f0$42eb0544@CX535256D>
(We've already made one of the patches, but we'd like to add relocatable EXE
support first.)

I'm with a group of people that are starting an open-source development kit
for the native kernel of the Xbox to replace the inadequate OpenXDK.  The
native Xbox kernel is a very similar environment to ReactOS - we need a PE
compiler with support for NT kernel features such as #pragma pack and
__attribute__((fastcall)).  Both of these features are in MingW already, so
we have decided to use MingW's gcc and binutils in our development work.

However, there are 2 things we'd like to see added to MingW.  We have
already patched gcc and binutils for this, but it would be nice for the
standard MingW source tree include support for this.  (Binary distributions
shouldn't support Xbox).  These are our two changes:

1. We added "xbox" as an alias for i686-pc-mingw32 in config.sub of both GCC
and binutils.  This allows us to have a compiler named "xbox-gcc" that uses
separate include and lib directories from MingW.  It also allows i686 to be
the default CPU, since the Xbox has a Pentium 3.

2. We added support to ld for the option "--subsystem xbox".  Microsoft has
officially defined a subsystem ID for Xbox, IMAGE_SUBSYSTEM_XBOX, equal to
14.  A Platform SDK from the last 2 years should have this definition in
winnt.h.  We set this subsystem so we can recognize our Xbox file format
and, more importantly, prevent users from executing the .EXE files in
Windows with random results.

Patches to do this to gcc and binutils are attached.  We'd like to see it as
a last-minute addition for MingW version 3.0.0, but we're probably too late
for that anyway.

There are 3 more things we'd like to do, but are unsure how or can't do it.

1. We'd like to be able to cause "--subsystem xbox" to set the base address
to 00020000 if one is not already set.  I didn't feel comfortable messing
with what is essentially MingW's own code.

2. We think it would be nice for MingW's winnt.h to add the
IMAGE_SUBSYSTEM_XBOX definition.

3. We'd like to see a way to build an EXE without its relocation information
stripped, but we are not binutils experts that know how to do this.  In
other words, an EXE whose loading address can change.  An example EXE like
this is ntoskrnl.exe (Microsoft's anyway; I haven't checked ReactOS).
Currently, relocation information is retained if and only if the output is a
DLL.  Microsoft's linker supports this by specifying /FIXED:NO.

We just think it would be nice for MingW to have the same source tree as our
project, since they aren't different by much.  It won't be a problem at all
if these patches are redirected - it just means we'd maintain a modified
gcc.

koitsu



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01