aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-11-26 09:42:04 +0000
committerNick Clifton <nickc@redhat.com>2004-11-26 09:42:04 +0000
commit33f362e109d8c3c8604550bdc952edc1c67062fc (patch)
tree272c38249840ca005ca79bce54a3e3c7f4b311ae
parentf25861cde01186e2d355ec8ec46e2c0e7e3090f6 (diff)
downloadgdb-33f362e109d8c3c8604550bdc952edc1c67062fc.zip
gdb-33f362e109d8c3c8604550bdc952edc1c67062fc.tar.gz
gdb-33f362e109d8c3c8604550bdc952edc1c67062fc.tar.bz2
Add support for --subsystem:xbox as well as --subsystem:<number>.
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/emultempl/pe.em101
-rw-r--r--ld/ld.texinfo5
3 files changed, 71 insertions, 42 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a0fc07b..0a30bb1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-26 Melissa Mears <asterisk@graces.dricas.com>
+
+ * emultempl/pe.em: Add --subsystem:xbox as well as
+ --subsystem:%d.
+ * ld.texinfo: (ld_options): Document acceptance of subsystem xbox
+ and numeric subsystems.
+
2004-11-24 Alan Modra <amodra@bigpond.net.au>
* ldexp.c (fold_name): Correct PR 338 fix.
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 6451658..7152055 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -372,8 +372,13 @@ static void
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;
@@ -382,29 +387,23 @@ set_pe_subsystem (void)
}
v[] =
{
- { "native", 1, "NtProcessStartup" },
-#if defined TARGET_IS_mipspe || defined TARGET_IS_armpe
- { "windows", 2, "WinMainCRTStartup" },
-#else
+ { "native", 1, "NtProcessStartup" },
{ "windows", 2, "WinMainCRTStartup" },
-#endif
{ "console", 3, "mainCRTStartup" },
-#if 0
- /* The Microsoft linker does not recognize this. */
- { "os2", 5, "" },
-#endif
- { "posix", 7, "__PosixProcessStartup"},
- { "wince", 9, "_WinMainCRTStartup" },
- { 0, 0, 0 }
+ { "posix", 7, "__PosixProcessStartup"},
+ { "wince", 9, "_WinMainCRTStartup" },
+ { "xbox", 14, "mainCRTStartup" },
+ { NULL, 0, NULL }
};
+ /* 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 +414,62 @@ set_pe_subsystem (void)
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')
- {
- const char *initial_symbol_char;
- const char *entry;
-
- set_pe_name ("__subsystem__", v[i].value);
+ /* Search list for a numeric match to use its entry point. */
+ for (i = 0; v[i].name; i++)
+ if (v[i].value == (int) temp_subsystem)
+ break;
- initial_symbol_char = ${INITIAL_SYMBOL_CHAR};
- if (*initial_symbol_char == '\0')
- entry = v[i].entry;
- else
- {
- 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 (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;
+ }
+
+ 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;
}
- einfo (_("%P%F: invalid subsystem type %s\n"), optarg);
+ lang_add_entry (entry, TRUE);
+
+ return;
}
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index b21313a..3e80ac3 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -2197,8 +2197,9 @@ committed.
@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