diff -r -u binutils-041125/binutils/ChangeLog binutils-xbox/binutils/ChangeLog --- binutils-041125/binutils/ChangeLog 2004-11-10 08:10:15.000000000 -0800 +++ binutils-xbox/binutils/ChangeLog 2004-11-24 16:42:47.818721600 -0800 @@ -1,3 +1,7 @@ +2004-11-24 Melissa Mears + + * ../config.sub: Add "xbox" as alias for i686-pc-mingw32. + 2004-11-10 Ian Lance Taylor PR binutils/536 diff -r -u binutils-041125/config.sub binutils-xbox/config.sub --- binutils-041125/config.sub 2004-11-15 17:18:39.000000000 -0800 +++ binutils-xbox/config.sub 2004-11-24 16:17:03.758472000 -0800 @@ -1033,6 +1033,10 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; diff -r -u binutils-041125/ld/ChangeLog binutils-xbox/ld/ChangeLog --- binutils-041125/ld/ChangeLog 2004-11-19 11:28:39.000000000 -0800 +++ binutils-xbox/ld/ChangeLog 2004-11-24 16:40:22.079158400 -0800 @@ -1,3 +1,8 @@ +2004-11-24 Melissa Mears + + * emultempl/pe.em: Add --subsystem:xbox as well as --subsystem:%d. + (ld_options): Add --subsystem:xbox as well as --subsystem:%d. + 2004-11-19 Mark Mitchell * Makefile.am (ALL_EMULATIONS): Add earmelf_linux_eabi.o. diff -r -u binutils-041125/ld/emultempl/pe.em binutils-xbox/ld/emultempl/pe.em --- binutils-041125/ld/emultempl/pe.em 2004-10-19 13:07:32.000000000 -0700 +++ binutils-xbox/ld/emultempl/pe.em 2004-11-25 11:59:41.960664000 -0800 @@ -372,8 +372,13 @@ set_pe_subsystem (void) { const char *sver; + const char *entry; + const char *initial_symbol_char; + char *end; int len; int i; + int subsystem; + unsigned long temp_subsystem; static const struct { const char *name; @@ -383,11 +388,7 @@ v[] = { { "native", 1, "NtProcessStartup" }, -#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe - { "windows", 2, "WinMainCRTStartup" }, -#else { "windows", 2, "WinMainCRTStartup" }, -#endif { "console", 3, "mainCRTStartup" }, #if 0 /* The Microsoft linker does not recognize this. */ @@ -395,16 +396,18 @@ #endif { "posix", 7, "__PosixProcessStartup"}, { "wince", 9, "_WinMainCRTStartup" }, + { "xbox", 14, "mainCRTStartup" }, { 0, 0, 0 } }; + /* Entry point name for arbitrary subsystem numbers */ + static const char default_entry[] = "mainCRTStartup"; + /* Check for the presence of a version number */ sver = strchr (optarg, ':'); if (sver == NULL) len = strlen (optarg); else { - char *end; - len = sver - optarg; set_pe_name ("__major_subsystem_version__", strtoul (sver + 1, &end, 0)); @@ -415,40 +418,66 @@ einfo (_("%P: warning: bad version number in -subsystem option\n")); } - for (i = 0; v[i].name; i++) + /* Check for numeric subsystem */ + temp_subsystem = strtoul (optarg, &end, 0); + if ((*end == ':' || *end == '\0') && (temp_subsystem < 65536)) { - if (strncmp (optarg, v[i].name, len) == 0 - && v[i].name[len] == '\0') + /* Search list for a numeric match to use its entry point */ + for (i = 0; v[i].name; i++) { - const char *initial_symbol_char; - const char *entry; - - set_pe_name ("__subsystem__", v[i].value); - - initial_symbol_char = ${INITIAL_SYMBOL_CHAR}; - if (*initial_symbol_char == '\0') - entry = v[i].entry; - else - { - char *alc_entry; + if (v[i].value == (int) temp_subsystem) + break; + } - /* lang_add_entry expects its argument to be permanently - allocated, so we don't free this string. */ - alc_entry = xmalloc (strlen (initial_symbol_char) - + strlen (v[i].entry) - + 1); - strcpy (alc_entry, initial_symbol_char); - strcat (alc_entry, v[i].entry); - entry = alc_entry; - } + /* If no match, use the default */ + if (v[i].name != NULL) + entry = v[i].entry; + else + entry = default_entry; - lang_add_entry (entry, TRUE); + /* Use this subsystem */ + subsystem = (int) temp_subsystem; + } + else + { + /* Search for subsystem by name */ + for (i = 0; v[i].name; i++) + { + if (strncmp (optarg, v[i].name, len) == 0 + && v[i].name[len] == '\0') + break; + } + if (v[i].name == NULL) + { + einfo (_("%P%F: invalid subsystem type %s\n"), optarg); return; } + + entry = v[i].entry; + subsystem = v[i].value; } - einfo (_("%P%F: invalid subsystem type %s\n"), optarg); + set_pe_name ("__subsystem__", subsystem); + + initial_symbol_char = ${INITIAL_SYMBOL_CHAR}; + if (*initial_symbol_char != '\0') + { + char *alc_entry; + + /* lang_add_entry expects its argument to be permanently + allocated, so we don't free this string. */ + alc_entry = xmalloc (strlen (initial_symbol_char) + + strlen (entry) + + 1); + strcpy (alc_entry, initial_symbol_char); + strcat (alc_entry, entry); + entry = alc_entry; + } + + lang_add_entry (entry, TRUE); + + return; } diff -r -u binutils-041125/ld/ld.info binutils-xbox/ld/ld.info --- binutils-041125/ld/ld.info 2004-11-23 21:43:58.000000000 -0800 +++ binutils-xbox/ld/ld.info 2004-11-25 11:34:55.192796800 -0800 @@ -1669,10 +1669,10 @@ `--subsystem WHICH:MAJOR' `--subsystem WHICH:MAJOR.MINOR' Specifies the subsystem under which your program will execute. The - legal values for WHICH are `native', `windows', `console', and - `posix'. You may optionally set the subsystem version also. - [This option is specific to the i386 PE targeted port of the - linker] + legal values for WHICH are `native', `windows', `console', `posix', + and `xbox'. You may optionally set the subsystem version also. + Numeric values are also accepted for WHICH. [This option is + specific to the i386 PE targeted port of the linker]  diff -r -u binutils-041125/ld/ld.texinfo binutils-xbox/ld/ld.texinfo --- binutils-041125/ld/ld.texinfo 2004-11-19 01:38:04.000000000 -0800 +++ binutils-xbox/ld/ld.texinfo 2004-11-25 11:38:00.298966400 -0800 @@ -2197,8 +2197,9 @@ @itemx --subsystem @var{which}:@var{major}.@var{minor} Specifies the subsystem under which your program will execute. The legal values for @var{which} are @code{native}, @code{windows}, -@code{console}, and @code{posix}. You may optionally set the -subsystem version also. +@code{console}, @code{posix}, and @code{xbox}. You may optionally set +the subsystem version also. Numeric values are also accepted for +@var{which}. [This option is specific to the i386 PE targeted port of the linker] @end table