aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-02-28 01:32:31 +0000
committerAlan Modra <amodra@gmail.com>2003-02-28 01:32:31 +0000
commit3bcf55573d377355c73846cc0b819c7d878d8e19 (patch)
treebbe9a2d3302487029b4dbb711170df911a326c35 /ld/lexsup.c
parent2c4c2bc0a526e8e0c186cd7cb005e2947cac3b88 (diff)
downloadgdb-3bcf55573d377355c73846cc0b819c7d878d8e19.zip
gdb-3bcf55573d377355c73846cc0b819c7d878d8e19.tar.gz
gdb-3bcf55573d377355c73846cc0b819c7d878d8e19.tar.bz2
* ldemul.c (ldemul_add_options, ldemul_handle_option): New functions.
(ldemul_parse_args): Return bfd_boolean. Formatting. * ldemul.h (ldemul_add_options, ldemul_handle_option): Declare. (ldemul_parse_args): Adjust. (struct ld_emulation_xfer_struct): Add add_options and handle_option. Return bfd_boolean from parse_args. * lexsup.c (parse_args): Malloc shortopts, longopts and really_longopts. Call ldemul_add_options and ldemul_handle_option. * emultempl/aix.em (gld${EMULATION_NAME}_add_options): Split out from gld${EMULATION_NAME}_parse_args. (gld${EMULATION_NAME}_handle_option): Likewise. (ld_${EMULATION_NAME}_emulation): Adjust initializer. * emultempl/armcoff.em: As for aix.em, but remove parse_args. * emultempl/beos.em: Likewise. * emultempl/pe.em: Likewise. * emultempl/ticoff.em: Likewise. * emultempl/elf32.em: Likewise. Don't duplicate long options either. (gld${EMULATION_NAME}_add_sysroot): Prototype. * emultempl/armelf.em (PARSE_AND_LIST_LONGOPTS): Don't duplicate options. * emultempl/hppaelf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/ppc32elf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/ppc64elf.em (PARSE_AND_LIST_LONGOPTS): Likewise. * emultempl/armelf_oabi.em (ld_${EMULATION_NAME}_emulation): Adjust initializer. * emultempl/generic.em: Likewise. * emultempl/gld960.em: Likewise. * emultempl/gld960c.em: Likewise. * emultempl/linux.em: Likewise. * emultempl/lnk960.em: Likewise. * emultempl/m68kcoff.em: Likewise. * emultempl/mipsecoff.em: Likewise. * emultempl/sunos.em: Likewise. * emultempl/vanilla.em: Likewise. * emultempl/netbsd.em (gldnetbsd_before_parse): Prototype.
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 8102f4e..b6c2fd8 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -467,11 +467,17 @@ parse_args (argc, argv)
int is, il, irl;
int ingroup = 0;
char *default_dirlist = NULL;
- char shortopts[OPTION_COUNT * 3 + 2];
- struct option longopts[OPTION_COUNT + 1];
- struct option really_longopts[OPTION_COUNT + 1];
+ char *shortopts;
+ struct option *longopts;
+ struct option *really_longopts;
int last_optind;
+ shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
+ longopts = (struct option *) xmalloc (sizeof (*longopts)
+ * (OPTION_COUNT + 1));
+ really_longopts = (struct option *) xmalloc (sizeof (*really_longopts)
+ * (OPTION_COUNT + 1));
+
/* Starting the short option string with '-' is for programs that
expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
@@ -516,6 +522,8 @@ parse_args (argc, argv)
longopts[il].name = NULL;
really_longopts[irl].name = NULL;
+ ldemul_add_options (is, &shortopts, il, &longopts, irl, &really_longopts);
+
/* The -G option is ambiguous on different platforms. Sometimes it
specifies the largest data size to put into the small data
section. Sometimes it is equivalent to --shared. Unfortunately,
@@ -586,6 +594,9 @@ parse_args (argc, argv)
optc = getopt_long (argc, argv, "-", really_longopts, &longind);
}
+ if (ldemul_handle_option (optc))
+ continue;
+
if (optc == -1)
break;