This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Xbox PE subsystem support

This simple patch adds support for --subsystem:xbox to the ix86-pe emulation of ld.

The OpenXDK project ( ) is a project to make an open-source development kit for the Microsoft Xbox native OS. Among the things needed, of course, is a compiler and linker. Due to the similarities between Xbox and Win32, the PE build tools would work well, with few changes.

This patch adds --subsystem:xbox, value 14, officially and publicly defined as IMAGE_SUBSYSTEM_XBOX in Microsoft's winnt.h header file. It is known that Microsoft's own Xbox Development Kit (XDK) compiles developers' games into standard PE format, with subsystem 14. The resulting PE file is later converted to the PE-like "XBE" format. We would like to continue with this tradition; in fact, the current OpenXDK does the same already.

In addition, this patch adds support for arbitrary subsystem numbers, like --subsystem=123. This is for future use so hopefully others in unforeseen projects will not have to modify binutils to use a different subsystem. When an arbitrary number is used that ld does not recognize, it assumes the entry point is mainCRTStartup. If, however, the number is known by ld, as in the user typing --subsystem:2 ("windows"), the entry point will be set to the proper default. The subsystem number is handled as a "0" base to strtoul, meaning it is decimal by default, and octal and hex can be used by prepending 0 or 0x.

Finally, "xbox" is recognized as a target, being equivalent to i686-pc-mingw32, whose settings are acceptable for OpenXDK. This gives the rather convenient --target=xbox setting as well as executable names xbox-ld, xbox-as, etc.

Full list of changes:

- /config.sub now recognizes "xbox" as an alias for i686-pc-mingw32
- ld now recognizes --subsystem:xbox as 14 with mainCRTStartup
- ld now allows numeric subsystem numbers like --subsystem:1234
- ld manpage and texinfo updated to note new --subsystem usages
- removed weird #if in pe.em that selected between 2 identical fragments

I'm new to this patch thing and binutils so I probably made a mistake somewhere... Also, some of you might not like this patch. Any comments would be appreciated. Thanks!

Melissa Mears

Attachment: binutils-xbox.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]