aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/armcoff.em
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl/armcoff.em')
-rw-r--r--ld/emultempl/armcoff.em63
1 files changed, 30 insertions, 33 deletions
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 73828eb..1156658 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -4,7 +4,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* This file is is generated by a shell script. DO NOT EDIT! */
/* emulate the original gld for the given ${EMULATION_NAME}
- Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
@@ -43,8 +43,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
static void gld${EMULATION_NAME}_before_allocation PARAMS ((void));
static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
-static int gld${EMULATION_NAME}_parse_args PARAMS((int, char **));
+static void gld${EMULATION_NAME}_add_options
+ PARAMS ((int, char **, int, struct option **, int, struct option **));
static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *));
+static bfd_boolean gld${EMULATION_NAME}_handle_option PARAMS ((int));
static void gld${EMULATION_NAME}_finish PARAMS ((void));
static void gld${EMULATION_NAME}_after_open PARAMS ((void));
@@ -57,12 +59,25 @@ static char * thumb_entry_symbol = NULL;
#define OPTION_SUPPORT_OLD_CODE 300
#define OPTION_THUMB_ENTRY 301
-static struct option longopts[] =
+static void
+gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts)
+ int ns ATTRIBUTE_UNUSED;
+ char **shortopts ATTRIBUTE_UNUSED;
+ int nl;
+ struct option **longopts;
+ int nrl ATTRIBUTE_UNUSED;
+ struct option **really_longopts ATTRIBUTE_UNUSED;
{
- {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
- {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
- {NULL, no_argument, NULL, 0}
-};
+ static const struct option xtra_long[] = {
+ {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE},
+ {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY},
+ {NULL, no_argument, NULL, 0}
+ };
+
+ *longopts = (struct option *)
+ xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
+ memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
+}
static void
gld${EMULATION_NAME}_list_options (file)
@@ -72,34 +87,14 @@ gld${EMULATION_NAME}_list_options (file)
fprintf (file, _(" --thumb-entry=<sym> Set the entry point to be Thumb symbol <sym>\n"));
}
-static int
-gld${EMULATION_NAME}_parse_args (argc, argv)
- int argc;
- char ** argv;
+static bfd_boolean
+gld${EMULATION_NAME}_handle_option (optc)
+ int optc;
{
- int longind;
- int optc;
- int prevoptind = optind;
- int prevopterr = opterr;
- int wanterror;
- static int lastoptind = -1;
-
- if (lastoptind != optind)
- opterr = 0;
-
- wanterror = opterr;
- lastoptind = optind;
-
- optc = getopt_long_only (argc, argv, "-", longopts, & longind);
- opterr = prevopterr;
-
switch (optc)
{
default:
- if (wanterror)
- xexit (1);
- optind = prevoptind;
- return 0;
+ return FALSE;
case OPTION_SUPPORT_OLD_CODE:
support_old_code = 1;
@@ -110,7 +105,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
break;
}
- return 1;
+ return TRUE;
}
static void
@@ -286,7 +281,9 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
NULL, /* open dynamic archive */
NULL, /* place orphan */
NULL, /* set symbols */
- gld${EMULATION_NAME}_parse_args,
+ NULL, /* parse_args */
+ gld${EMULATION_NAME}_add_options,
+ gld${EMULATION_NAME}_handle_option,
NULL, /* unrecognised file */
gld${EMULATION_NAME}_list_options,
NULL, /* recognized file */