2000-07-19 H.J. Lu <hjl@gnu.org>
[deliverable/binutils-gdb.git] / gas / as.c
index 9bac61da19c353d4591af26bc23535088ed5b2aa..db21815035663b37c563af920679f96a037b3809 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -425,13 +425,18 @@ parse_args (pargc, pargv)
     {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
   };
 
-  /* Construct the option lists from the standard list and the
-     target dependent list.  */
+  /* Construct the option lists from the standard list and the target
+     dependent list.  Include space for an extra NULL option and
+     always NULL terminate. */
   shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
-  longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
+  longopts = (struct option *) xmalloc (sizeof (std_longopts)
+                                       + md_longopts_size
+                                       + sizeof (struct option));
   memcpy (longopts, std_longopts, sizeof (std_longopts));
   memcpy ((char *) longopts + sizeof (std_longopts),
          md_longopts, md_longopts_size);
+  memset ((char *) longopts + sizeof (std_longopts) + md_longopts_size,
+         0, sizeof (struct option));
 
   /* Make a local copy of the old argv.  */
   old_argc = *pargc;
@@ -514,7 +519,7 @@ parse_args (pargc, pargv)
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf (_("GNU assembler %s\n"), VERSION);
-         printf (_("Copyright 1997 Free Software Foundation, Inc.\n"));
+         printf (_("Copyright 2000 Free Software Foundation, Inc.\n"));
          printf (_("\
 This program is free software; you may redistribute it under the terms of\n\
 the GNU General Public License.  This program has absolutely no warranty.\n"));
@@ -546,7 +551,7 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
        case OPTION_DEFSYM:
          {
            char *s;
-           long i;
+           valueT i;
            struct defsym_list *n;
 
            for (s = optarg; *s != '\0' && *s != '='; s++)
@@ -554,7 +559,11 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
            if (*s == '\0')
              as_fatal (_("bad defsym; format is --defsym name=value"));
            *s++ = '\0';
+#ifdef BFD_ASSEMBLER
+           i = bfd_scan_vma (s, (const char **) NULL, 0);
+#else
            i = strtol (s, (char **) NULL, 0);
+#endif
            n = (struct defsym_list *) xmalloc (sizeof *n);
            n->next = defsyms;
            n->name = optarg;
@@ -672,6 +681,9 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
        case 'a':
          if (optarg)
            {
+             if (md_parse_option (optc, optarg) != 0)
+               break;
+
              while (*optarg)
                {
                  switch (*optarg)
This page took 0.075069 seconds and 4 git commands to generate.