Home | History | Annotate | Download | only in gas
      1 /* as.c - GAS main program.
      2    Copyright (C) 1987-2014 Free Software Foundation, Inc.
      3 
      4    This file is part of GAS, the GNU Assembler.
      5 
      6    GAS is free software; you can redistribute it and/or modify
      7    it under the terms of the GNU General Public License as published by
      8    the Free Software Foundation; either version 3, or (at your option)
      9    any later version.
     10 
     11    GAS is distributed in the hope that it will be useful, but WITHOUT
     12    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
     13    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
     14    License for more details.
     15 
     16    You should have received a copy of the GNU General Public License
     17    along with GAS; see the file COPYING.  If not, write to the Free
     18    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
     19    02110-1301, USA.  */
     20 
     21 /* Main program for AS; a 32-bit assembler of GNU.
     22    Understands command arguments.
     23    Has a few routines that don't fit in other modules because they
     24    are shared.
     25 
     26   			bugs
     27 
     28    : initialisers
     29   	Since no-one else says they will support them in future: I
     30    don't support them now.  */
     31 
     32 #define COMMON
     33 
     34 #include "as.h"
     35 #include "subsegs.h"
     36 #include "output-file.h"
     37 #include "sb.h"
     38 #include "macro.h"
     39 #include "dwarf2dbg.h"
     40 #include "dw2gencfi.h"
     41 #include "bfdver.h"
     42 
     43 #ifdef HAVE_ITBL_CPU
     44 #include "itbl-ops.h"
     45 #else
     46 #define itbl_init()
     47 #endif
     48 
     49 #ifdef HAVE_SBRK
     50 #ifdef NEED_DECLARATION_SBRK
     51 extern void *sbrk ();
     52 #endif
     53 #endif
     54 
     55 #ifdef USING_CGEN
     56 /* Perform any cgen specific initialisation for gas.  */
     57 extern void gas_cgen_begin (void);
     58 #endif
     59 
     60 /* We build a list of defsyms as we read the options, and then define
     61    them after we have initialized everything.  */
     62 struct defsym_list
     63 {
     64   struct defsym_list *next;
     65   char *name;
     66   valueT value;
     67 };
     68 
     69 
     70 /* True if a listing is wanted.  */
     71 int listing;
     72 
     73 /* Type of debugging to generate.  */
     74 enum debug_info_type debug_type = DEBUG_UNSPECIFIED;
     75 int use_gnu_debug_info_extensions = 0;
     76 
     77 #ifndef MD_DEBUG_FORMAT_SELECTOR
     78 #define MD_DEBUG_FORMAT_SELECTOR NULL
     79 #endif
     80 static enum debug_info_type (*md_debug_format_selector) (int *) = MD_DEBUG_FORMAT_SELECTOR;
     81 
     82 /* Maximum level of macro nesting.  */
     83 int max_macro_nest = 100;
     84 
     85 /* argv[0]  */
     86 static char * myname;
     87 
     88 /* The default obstack chunk size.  If we set this to zero, the
     89    obstack code will use whatever will fit in a 4096 byte block.  */
     90 int chunksize = 0;
     91 
     92 /* To monitor memory allocation more effectively, make this non-zero.
     93    Then the chunk sizes for gas and bfd will be reduced.  */
     94 int debug_memory = 0;
     95 
     96 /* Enable verbose mode.  */
     97 int verbose = 0;
     98 
     99 /* Enable incbin directive. */
    100 int allow_incbin_directive = 1;
    101 
    102 /* Keep the output file.  */
    103 static int keep_it = 0;
    104 
    105 segT reg_section;
    106 segT expr_section;
    107 segT text_section;
    108 segT data_section;
    109 segT bss_section;
    110 
    111 /* Name of listing file.  */
    112 static char *listing_filename = NULL;
    113 
    114 static struct defsym_list *defsyms;
    115 
    116 #ifdef HAVE_ITBL_CPU
    117 /* Keep a record of the itbl files we read in.  */
    118 struct itbl_file_list
    119 {
    120   struct itbl_file_list *next;
    121   char *name;
    122 };
    123 static struct itbl_file_list *itbl_files;
    124 #endif
    125 
    126 static long start_time;
    127 #ifdef HAVE_SBRK
    128 char *start_sbrk;
    129 #endif
    130 
    131 static int flag_macro_alternate;
    132 
    133 
    134 #ifdef USE_EMULATIONS
    136 #define EMULATION_ENVIRON "AS_EMULATION"
    137 
    138 extern struct emulation mipsbelf, mipslelf, mipself;
    139 extern struct emulation i386coff, i386elf, i386aout;
    140 extern struct emulation crisaout, criself;
    141 
    142 static struct emulation *const emulations[] = { EMULATIONS };
    143 static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]);
    144 
    145 static void
    146 select_emulation_mode (int argc, char **argv)
    147 {
    148   int i;
    149   char *p, *em = 0;
    150 
    151   for (i = 1; i < argc; i++)
    152     if (!strncmp ("--em", argv[i], 4))
    153       break;
    154 
    155   if (i == argc)
    156     goto do_default;
    157 
    158   p = strchr (argv[i], '=');
    159   if (p)
    160     p++;
    161   else
    162     p = argv[i + 1];
    163 
    164   if (!p || !*p)
    165     as_fatal (_("missing emulation mode name"));
    166   em = p;
    167 
    168  do_default:
    169   if (em == 0)
    170     em = getenv (EMULATION_ENVIRON);
    171   if (em == 0)
    172     em = DEFAULT_EMULATION;
    173 
    174   if (em)
    175     {
    176       for (i = 0; i < n_emulations; i++)
    177 	if (!strcmp (emulations[i]->name, em))
    178 	  break;
    179       if (i == n_emulations)
    180 	as_fatal (_("unrecognized emulation name `%s'"), em);
    181       this_emulation = emulations[i];
    182     }
    183   else
    184     this_emulation = emulations[0];
    185 
    186   this_emulation->init ();
    187 }
    188 
    189 const char *
    190 default_emul_bfd_name (void)
    191 {
    192   abort ();
    193   return NULL;
    194 }
    195 
    196 void
    197 common_emul_init (void)
    198 {
    199   this_format = this_emulation->format;
    200 
    201   if (this_emulation->leading_underscore == 2)
    202     this_emulation->leading_underscore = this_format->dfl_leading_underscore;
    203 
    204   if (this_emulation->default_endian != 2)
    205     target_big_endian = this_emulation->default_endian;
    206 
    207   if (this_emulation->fake_label_name == 0)
    208     {
    209       if (this_emulation->leading_underscore)
    210 	this_emulation->fake_label_name = "L0\001";
    211       else
    212 	/* What other parameters should we test?  */
    213 	this_emulation->fake_label_name = ".L0\001";
    214     }
    215 }
    216 #endif
    217 
    218 void
    219 print_version_id (void)
    220 {
    221   static int printed;
    222 
    223   if (printed)
    224     return;
    225   printed = 1;
    226 
    227   fprintf (stderr, _("GNU assembler version %s (%s) using BFD version %s\n"),
    228 	   VERSION, TARGET_ALIAS, BFD_VERSION_STRING);
    229 }
    230 
    231 static void
    232 show_usage (FILE * stream)
    233 {
    234   fprintf (stream, _("Usage: %s [option...] [asmfile...]\n"), myname);
    235 
    236   fprintf (stream, _("\
    237 Options:\n\
    238   -a[sub-option...]	  turn on listings\n\
    239                       	  Sub-options [default hls]:\n\
    240                       	  c      omit false conditionals\n\
    241                       	  d      omit debugging directives\n\
    242                       	  g      include general info\n\
    243                       	  h      include high-level source\n\
    244                       	  l      include assembly\n\
    245                       	  m      include macro expansions\n\
    246                       	  n      omit forms processing\n\
    247                       	  s      include symbols\n\
    248                       	  =FILE  list to FILE (must be last sub-option)\n"));
    249 
    250   fprintf (stream, _("\
    251   --alternate             initially turn on alternate macro syntax\n"));
    252 #ifdef HAVE_ZLIB_H
    253   fprintf (stream, _("\
    254   --compress-debug-sections\n\
    255                           compress DWARF debug sections using zlib\n"));
    256   fprintf (stream, _("\
    257   --nocompress-debug-sections\n\
    258                           don't compress DWARF debug sections\n"));
    259 #endif /* HAVE_ZLIB_H */
    260   fprintf (stream, _("\
    261   -D                      produce assembler debugging messages\n"));
    262   fprintf (stream, _("\
    263   --debug-prefix-map OLD=NEW\n\
    264                           map OLD to NEW in debug information\n"));
    265   fprintf (stream, _("\
    266   --defsym SYM=VAL        define symbol SYM to given value\n"));
    267 #ifdef USE_EMULATIONS
    268   {
    269     int i;
    270     char *def_em;
    271 
    272     fprintf (stream, "\
    273   --em=[");
    274     for (i = 0; i < n_emulations - 1; i++)
    275       fprintf (stream, "%s | ", emulations[i]->name);
    276     fprintf (stream, "%s]\n", emulations[i]->name);
    277 
    278     def_em = getenv (EMULATION_ENVIRON);
    279     if (!def_em)
    280       def_em = DEFAULT_EMULATION;
    281     fprintf (stream, _("\
    282                           emulate output (default %s)\n"), def_em);
    283   }
    284 #endif
    285 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
    286   fprintf (stream, _("\
    287   --execstack             require executable stack for this object\n"));
    288   fprintf (stream, _("\
    289   --noexecstack           don't require executable stack for this object\n"));
    290   fprintf (stream, _("\
    291   --size-check=[error|warning]\n\
    292 			  ELF .size directive check (default --size-check=error)\n"));
    293 #endif
    294   fprintf (stream, _("\
    295   -f                      skip whitespace and comment preprocessing\n"));
    296   fprintf (stream, _("\
    297   -g --gen-debug          generate debugging information\n"));
    298   fprintf (stream, _("\
    299   --gstabs                generate STABS debugging information\n"));
    300   fprintf (stream, _("\
    301   --gstabs+               generate STABS debug info with GNU extensions\n"));
    302   fprintf (stream, _("\
    303   --gdwarf-2              generate DWARF2 debugging information\n"));
    304   fprintf (stream, _("\
    305   --gdwarf-sections       generate per-function section names for DWARF line information\n"));
    306   fprintf (stream, _("\
    307   --hash-size=<value>     set the hash table size close to <value>\n"));
    308   fprintf (stream, _("\
    309   --help                  show this message and exit\n"));
    310   fprintf (stream, _("\
    311   --target-help           show target specific options\n"));
    312   fprintf (stream, _("\
    313   -I DIR                  add DIR to search list for .include directives\n"));
    314   fprintf (stream, _("\
    315   -J                      don't warn about signed overflow\n"));
    316   fprintf (stream, _("\
    317   -K                      warn when differences altered for long displacements\n"));
    318   fprintf (stream, _("\
    319   -L,--keep-locals        keep local symbols (e.g. starting with `L')\n"));
    320   fprintf (stream, _("\
    321   -M,--mri                assemble in MRI compatibility mode\n"));
    322   fprintf (stream, _("\
    323   --MD FILE               write dependency information in FILE (default none)\n"));
    324   fprintf (stream, _("\
    325   -nocpp                  ignored\n"));
    326   fprintf (stream, _("\
    327   -o OBJFILE              name the object-file output OBJFILE (default a.out)\n"));
    328   fprintf (stream, _("\
    329   -R                      fold data section into text section\n"));
    330   fprintf (stream, _("\
    331   --reduce-memory-overheads \n\
    332                           prefer smaller memory use at the cost of longer\n\
    333                           assembly times\n"));
    334   fprintf (stream, _("\
    335   --statistics            print various measured statistics from execution\n"));
    336   fprintf (stream, _("\
    337   --strip-local-absolute  strip local absolute symbols\n"));
    338   fprintf (stream, _("\
    339   --traditional-format    Use same format as native assembler when possible\n"));
    340   fprintf (stream, _("\
    341   --version               print assembler version number and exit\n"));
    342   fprintf (stream, _("\
    343   -W  --no-warn           suppress warnings\n"));
    344   fprintf (stream, _("\
    345   --warn                  don't suppress warnings\n"));
    346   fprintf (stream, _("\
    347   --fatal-warnings        treat warnings as errors\n"));
    348 #ifdef HAVE_ITBL_CPU
    349   fprintf (stream, _("\
    350   --itbl INSTTBL          extend instruction set to include instructions\n\
    351                           matching the specifications defined in file INSTTBL\n"));
    352 #endif
    353   fprintf (stream, _("\
    354   -w                      ignored\n"));
    355   fprintf (stream, _("\
    356   -X                      ignored\n"));
    357   fprintf (stream, _("\
    358   -Z                      generate object file even after errors\n"));
    359   fprintf (stream, _("\
    360   --listing-lhs-width     set the width in words of the output data column of\n\
    361                           the listing\n"));
    362   fprintf (stream, _("\
    363   --listing-lhs-width2    set the width in words of the continuation lines\n\
    364                           of the output data column; ignored if smaller than\n\
    365                           the width of the first line\n"));
    366   fprintf (stream, _("\
    367   --listing-rhs-width     set the max width in characters of the lines from\n\
    368                           the source file\n"));
    369   fprintf (stream, _("\
    370   --listing-cont-lines    set the maximum number of continuation lines used\n\
    371                           for the output data column of the listing\n"));
    372   fprintf (stream, _("\
    373   @FILE                   read options from FILE\n"));
    374 
    375   md_show_usage (stream);
    376 
    377   fputc ('\n', stream);
    378 
    379   if (REPORT_BUGS_TO[0] && stream == stdout)
    380     fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
    381 }
    382 
    383 /* Since it is easy to do here we interpret the special arg "-"
    384    to mean "use stdin" and we set that argv[] pointing to "".
    385    After we have munged argv[], the only things left are source file
    386    name(s) and ""(s) denoting stdin. These file names are used
    387    (perhaps more than once) later.
    388 
    389    check for new machine-dep cmdline options in
    390    md_parse_option definitions in config/tc-*.c.  */
    391 
    392 static void
    393 parse_args (int * pargc, char *** pargv)
    394 {
    395   int old_argc;
    396   int new_argc;
    397   char ** old_argv;
    398   char ** new_argv;
    399   /* Starting the short option string with '-' is for programs that
    400      expect options and other ARGV-elements in any order and that care about
    401      the ordering of the two.  We describe each non-option ARGV-element
    402      as if it were the argument of an option with character code 1.  */
    403   char *shortopts;
    404   extern const char *md_shortopts;
    405   static const char std_shortopts[] =
    406   {
    407     '-', 'J',
    408 #ifndef WORKING_DOT_WORD
    409     /* -K is not meaningful if .word is not being hacked.  */
    410     'K',
    411 #endif
    412     'L', 'M', 'R', 'W', 'Z', 'a', ':', ':', 'D', 'f', 'g', ':',':', 'I', ':', 'o', ':',
    413 #ifndef VMS
    414     /* -v takes an argument on VMS, so we don't make it a generic
    415        option.  */
    416     'v',
    417 #endif
    418     'w', 'X',
    419 #ifdef HAVE_ITBL_CPU
    420     /* New option for extending instruction set (see also --itbl below).  */
    421     't', ':',
    422 #endif
    423     '\0'
    424   };
    425   struct option *longopts;
    426   extern struct option md_longopts[];
    427   extern size_t md_longopts_size;
    428   /* Codes used for the long options with no short synonyms.  */
    429   enum option_values
    430     {
    431       OPTION_HELP = OPTION_STD_BASE,
    432       OPTION_NOCPP,
    433       OPTION_STATISTICS,
    434       OPTION_VERSION,
    435       OPTION_DUMPCONFIG,
    436       OPTION_VERBOSE,
    437       OPTION_EMULATION,
    438       OPTION_DEBUG_PREFIX_MAP,
    439       OPTION_DEFSYM,
    440       OPTION_LISTING_LHS_WIDTH,
    441       OPTION_LISTING_LHS_WIDTH2,
    442       OPTION_LISTING_RHS_WIDTH,
    443       OPTION_LISTING_CONT_LINES,
    444       OPTION_DEPFILE,
    445       OPTION_GSTABS,
    446       OPTION_GSTABS_PLUS,
    447       OPTION_GDWARF2,
    448       OPTION_GDWARF_SECTIONS,
    449       OPTION_STRIP_LOCAL_ABSOLUTE,
    450       OPTION_TRADITIONAL_FORMAT,
    451       OPTION_WARN,
    452       OPTION_TARGET_HELP,
    453       OPTION_EXECSTACK,
    454       OPTION_NOEXECSTACK,
    455       OPTION_SIZE_CHECK,
    456       OPTION_ALTERNATE,
    457       OPTION_AL,
    458       OPTION_HASH_TABLE_SIZE,
    459       OPTION_REDUCE_MEMORY_OVERHEADS,
    460       OPTION_WARN_FATAL,
    461       OPTION_COMPRESS_DEBUG,
    462       OPTION_NOCOMPRESS_DEBUG,
    463       OPTION_ALLOW_INCBIN,
    464       OPTION_NOALLOW_INCBIN
    465     /* When you add options here, check that they do
    466        not collide with OPTION_MD_BASE.  See as.h.  */
    467     };
    468 
    469   static const struct option std_longopts[] =
    470   {
    471     /* Note: commas are placed at the start of the line rather than
    472        the end of the preceding line so that it is simpler to
    473        selectively add and remove lines from this list.  */
    474     {"alternate", no_argument, NULL, OPTION_ALTERNATE}
    475     /* The entry for "a" is here to prevent getopt_long_only() from
    476        considering that -a is an abbreviation for --alternate.  This is
    477        necessary because -a=<FILE> is a valid switch but getopt would
    478        normally reject it since --alternate does not take an argument.  */
    479     ,{"a", optional_argument, NULL, 'a'}
    480     /* Handle -al=<FILE>.  */
    481     ,{"al", optional_argument, NULL, OPTION_AL}
    482     ,{"allow-incbin", optional_argument, NULL, OPTION_ALLOW_INCBIN}
    483     ,{"noallow-incbin", optional_argument, NULL, OPTION_NOALLOW_INCBIN}
    484     ,{"compress-debug-sections", no_argument, NULL, OPTION_COMPRESS_DEBUG}
    485     ,{"nocompress-debug-sections", no_argument, NULL, OPTION_NOCOMPRESS_DEBUG}
    486     ,{"debug-prefix-map", required_argument, NULL, OPTION_DEBUG_PREFIX_MAP}
    487     ,{"defsym", required_argument, NULL, OPTION_DEFSYM}
    488     ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
    489     ,{"emulation", required_argument, NULL, OPTION_EMULATION}
    490 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
    491     ,{"execstack", no_argument, NULL, OPTION_EXECSTACK}
    492     ,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}
    493     ,{"size-check", required_argument, NULL, OPTION_SIZE_CHECK}
    494 #endif
    495     ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
    496     ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2}
    497     /* GCC uses --gdwarf-2 but GAS uses to use --gdwarf2,
    498        so we keep it here for backwards compatibility.  */
    499     ,{"gdwarf2", no_argument, NULL, OPTION_GDWARF2}
    500     ,{"gdwarf-sections", no_argument, NULL, OPTION_GDWARF_SECTIONS}
    501     ,{"gen-debug", no_argument, NULL, 'g'}
    502     ,{"gstabs", no_argument, NULL, OPTION_GSTABS}
    503     ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}
    504     ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE}
    505     ,{"help", no_argument, NULL, OPTION_HELP}
    506 #ifdef HAVE_ITBL_CPU
    507     /* New option for extending instruction set (see also -t above).
    508        The "-t file" or "--itbl file" option extends the basic set of
    509        valid instructions by reading "file", a text file containing a
    510        list of instruction formats.  The additional opcodes and their
    511        formats are added to the built-in set of instructions, and
    512        mnemonics for new registers may also be defined.  */
    513     ,{"itbl", required_argument, NULL, 't'}
    514 #endif
    515     /* getopt allows abbreviations, so we do this to stop it from
    516        treating -k as an abbreviation for --keep-locals.  Some
    517        ports use -k to enable PIC assembly.  */
    518     ,{"keep-locals", no_argument, NULL, 'L'}
    519     ,{"keep-locals", no_argument, NULL, 'L'}
    520     ,{"listing-lhs-width", required_argument, NULL, OPTION_LISTING_LHS_WIDTH}
    521     ,{"listing-lhs-width2", required_argument, NULL, OPTION_LISTING_LHS_WIDTH2}
    522     ,{"listing-rhs-width", required_argument, NULL, OPTION_LISTING_RHS_WIDTH}
    523     ,{"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES}
    524     ,{"MD", required_argument, NULL, OPTION_DEPFILE}
    525     ,{"mri", no_argument, NULL, 'M'}
    526     ,{"nocpp", no_argument, NULL, OPTION_NOCPP}
    527     ,{"no-warn", no_argument, NULL, 'W'}
    528     ,{"reduce-memory-overheads", no_argument, NULL, OPTION_REDUCE_MEMORY_OVERHEADS}
    529     ,{"statistics", no_argument, NULL, OPTION_STATISTICS}
    530     ,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE}
    531     ,{"version", no_argument, NULL, OPTION_VERSION}
    532     ,{"verbose", no_argument, NULL, OPTION_VERBOSE}
    533     ,{"target-help", no_argument, NULL, OPTION_TARGET_HELP}
    534     ,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}
    535     ,{"warn", no_argument, NULL, OPTION_WARN}
    536   };
    537 
    538   /* Construct the option lists from the standard list and the target
    539      dependent list.  Include space for an extra NULL option and
    540      always NULL terminate.  */
    541   shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
    542   longopts = (struct option *) xmalloc (sizeof (std_longopts)
    543                                         + md_longopts_size + sizeof (struct option));
    544   memcpy (longopts, std_longopts, sizeof (std_longopts));
    545   memcpy (((char *) longopts) + sizeof (std_longopts), md_longopts, md_longopts_size);
    546   memset (((char *) longopts) + sizeof (std_longopts) + md_longopts_size,
    547 	  0, sizeof (struct option));
    548 
    549   /* Make a local copy of the old argv.  */
    550   old_argc = *pargc;
    551   old_argv = *pargv;
    552 
    553   /* Initialize a new argv that contains no options.  */
    554   new_argv = (char **) xmalloc (sizeof (char *) * (old_argc + 1));
    555   new_argv[0] = old_argv[0];
    556   new_argc = 1;
    557   new_argv[new_argc] = NULL;
    558 
    559   while (1)
    560     {
    561       /* getopt_long_only is like getopt_long, but '-' as well as '--' can
    562 	 indicate a long option.  */
    563       int longind;
    564       int optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,
    565 				   &longind);
    566 
    567       if (optc == -1)
    568 	break;
    569 
    570       switch (optc)
    571 	{
    572 	default:
    573 	  /* md_parse_option should return 1 if it recognizes optc,
    574 	     0 if not.  */
    575 	  if (md_parse_option (optc, optarg) != 0)
    576 	    break;
    577 	  /* `-v' isn't included in the general short_opts list, so check for
    578 	     it explicitly here before deciding we've gotten a bad argument.  */
    579 	  if (optc == 'v')
    580 	    {
    581 #ifdef VMS
    582 	      /* Telling getopt to treat -v's value as optional can result
    583 		 in it picking up a following filename argument here.  The
    584 		 VMS code in md_parse_option can return 0 in that case,
    585 		 but it has no way of pushing the filename argument back.  */
    586 	      if (optarg && *optarg)
    587 		new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
    588 	      else
    589 #else
    590 	      case 'v':
    591 #endif
    592 	      case OPTION_VERBOSE:
    593 		print_version_id ();
    594 		verbose = 1;
    595 	      break;
    596 	    }
    597 	  else
    598 	    as_bad (_("unrecognized option -%c%s"), optc, optarg ? optarg : "");
    599 	  /* Fall through.  */
    600 
    601 	case '?':
    602 	  exit (EXIT_FAILURE);
    603 
    604 	case 1:			/* File name.  */
    605 	  if (!strcmp (optarg, "-"))
    606 	    optarg = "";
    607 	  new_argv[new_argc++] = optarg;
    608 	  new_argv[new_argc] = NULL;
    609 	  break;
    610 
    611 	case OPTION_TARGET_HELP:
    612 	  md_show_usage (stdout);
    613 	  exit (EXIT_SUCCESS);
    614 
    615 	case OPTION_HELP:
    616 	  show_usage (stdout);
    617 	  exit (EXIT_SUCCESS);
    618 
    619 	case OPTION_NOCPP:
    620 	  break;
    621 
    622 	case OPTION_STATISTICS:
    623 	  flag_print_statistics = 1;
    624 	  break;
    625 
    626 	case OPTION_STRIP_LOCAL_ABSOLUTE:
    627 	  flag_strip_local_absolute = 1;
    628 	  break;
    629 
    630 	case OPTION_TRADITIONAL_FORMAT:
    631 	  flag_traditional_format = 1;
    632 	  break;
    633 
    634 	case OPTION_VERSION:
    635 	  /* This output is intended to follow the GNU standards document.  */
    636 	  printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
    637 	  printf (_("Copyright (C) 2014 Free Software Foundation, Inc.\n"));
    638 	  printf (_("\
    639 This program is free software; you may redistribute it under the terms of\n\
    640 the GNU General Public License version 3 or later.\n\
    641 This program has absolutely no warranty.\n"));
    642 	  printf (_("This assembler was configured for a target of `%s'.\n"),
    643 		  TARGET_ALIAS);
    644 	  exit (EXIT_SUCCESS);
    645 
    646 	case OPTION_EMULATION:
    647 #ifdef USE_EMULATIONS
    648 	  if (strcmp (optarg, this_emulation->name))
    649 	    as_fatal (_("multiple emulation names specified"));
    650 #else
    651 	  as_fatal (_("emulations not handled in this configuration"));
    652 #endif
    653 	  break;
    654 
    655 	case OPTION_DUMPCONFIG:
    656 	  fprintf (stderr, _("alias = %s\n"), TARGET_ALIAS);
    657 	  fprintf (stderr, _("canonical = %s\n"), TARGET_CANONICAL);
    658 	  fprintf (stderr, _("cpu-type = %s\n"), TARGET_CPU);
    659 #ifdef TARGET_OBJ_FORMAT
    660 	  fprintf (stderr, _("format = %s\n"), TARGET_OBJ_FORMAT);
    661 #endif
    662 #ifdef TARGET_FORMAT
    663 	  fprintf (stderr, _("bfd-target = %s\n"), TARGET_FORMAT);
    664 #endif
    665 	  exit (EXIT_SUCCESS);
    666 
    667 	case OPTION_COMPRESS_DEBUG:
    668 #ifdef HAVE_ZLIB_H
    669 	  flag_compress_debug = 1;
    670 #else
    671 	  as_warn (_("cannot compress debug sections (zlib not installed)"));
    672 #endif /* HAVE_ZLIB_H */
    673 	  break;
    674 
    675 	case OPTION_NOCOMPRESS_DEBUG:
    676 	  flag_compress_debug = 0;
    677 	  break;
    678 
    679 	case OPTION_ALLOW_INCBIN:
    680 	  allow_incbin_directive = 1;
    681 	  break;
    682 
    683 	case OPTION_NOALLOW_INCBIN:
    684 	  allow_incbin_directive = 0;
    685 	  break;
    686 
    687 	case OPTION_DEBUG_PREFIX_MAP:
    688 	  add_debug_prefix_map (optarg);
    689 	  break;
    690 
    691 	case OPTION_DEFSYM:
    692 	  {
    693 	    char *s;
    694 	    valueT i;
    695 	    struct defsym_list *n;
    696 
    697 	    for (s = optarg; *s != '\0' && *s != '='; s++)
    698 	      ;
    699 	    if (*s == '\0')
    700 	      as_fatal (_("bad defsym; format is --defsym name=value"));
    701 	    *s++ = '\0';
    702 	    i = bfd_scan_vma (s, (const char **) NULL, 0);
    703 	    n = (struct defsym_list *) xmalloc (sizeof *n);
    704 	    n->next = defsyms;
    705 	    n->name = optarg;
    706 	    n->value = i;
    707 	    defsyms = n;
    708 	  }
    709 	  break;
    710 
    711 #ifdef HAVE_ITBL_CPU
    712 	case 't':
    713 	  {
    714 	    /* optarg is the name of the file containing the instruction
    715 	       formats, opcodes, register names, etc.  */
    716 	    struct itbl_file_list *n;
    717 
    718 	    if (optarg == NULL)
    719 	      {
    720 		as_warn (_("no file name following -t option"));
    721 		break;
    722 	      }
    723 
    724 	    n = xmalloc (sizeof * n);
    725 	    n->next = itbl_files;
    726 	    n->name = optarg;
    727 	    itbl_files = n;
    728 
    729 	    /* Parse the file and add the new instructions to our internal
    730 	       table.  If multiple instruction tables are specified, the
    731 	       information from this table gets appended onto the existing
    732 	       internal table.  */
    733 	    itbl_files->name = xstrdup (optarg);
    734 	    if (itbl_parse (itbl_files->name) != 0)
    735 	      as_fatal (_("failed to read instruction table %s\n"),
    736 			itbl_files->name);
    737 	  }
    738 	  break;
    739 #endif
    740 
    741 	case OPTION_DEPFILE:
    742 	  start_dependencies (optarg);
    743 	  break;
    744 
    745 	case 'g':
    746 	  /* Some backends, eg Alpha and Mips, use the -g switch for their
    747 	     own purposes.  So we check here for an explicit -g and allow
    748 	     the backend to decide if it wants to process it.  */
    749 	  if (   old_argv[optind - 1][1] == 'g'
    750 	      && md_parse_option (optc, optarg))
    751 	    continue;
    752 
    753 	  if (md_debug_format_selector)
    754 	    debug_type = md_debug_format_selector (& use_gnu_debug_info_extensions);
    755 	  else if (IS_ELF)
    756 	    debug_type = DEBUG_DWARF2;
    757 	  else
    758 	    debug_type = DEBUG_STABS;
    759 	  break;
    760 
    761 	case OPTION_GSTABS_PLUS:
    762 	  use_gnu_debug_info_extensions = 1;
    763 	  /* Fall through.  */
    764 	case OPTION_GSTABS:
    765 	  debug_type = DEBUG_STABS;
    766 	  break;
    767 
    768 	case OPTION_GDWARF2:
    769 	  debug_type = DEBUG_DWARF2;
    770 	  break;
    771 
    772 	case OPTION_GDWARF_SECTIONS:
    773 	  flag_dwarf_sections = TRUE;
    774 	  break;
    775 
    776 	case 'J':
    777 	  flag_signed_overflow_ok = 1;
    778 	  break;
    779 
    780 #ifndef WORKING_DOT_WORD
    781 	case 'K':
    782 	  flag_warn_displacement = 1;
    783 	  break;
    784 #endif
    785 	case 'L':
    786 	  flag_keep_locals = 1;
    787 	  break;
    788 
    789 	case OPTION_LISTING_LHS_WIDTH:
    790 	  listing_lhs_width = atoi (optarg);
    791 	  if (listing_lhs_width_second < listing_lhs_width)
    792 	    listing_lhs_width_second = listing_lhs_width;
    793 	  break;
    794 	case OPTION_LISTING_LHS_WIDTH2:
    795 	  {
    796 	    int tmp = atoi (optarg);
    797 
    798 	    if (tmp > listing_lhs_width)
    799 	      listing_lhs_width_second = tmp;
    800 	  }
    801 	  break;
    802 	case OPTION_LISTING_RHS_WIDTH:
    803 	  listing_rhs_width = atoi (optarg);
    804 	  break;
    805 	case OPTION_LISTING_CONT_LINES:
    806 	  listing_lhs_cont_lines = atoi (optarg);
    807 	  break;
    808 
    809 	case 'M':
    810 	  flag_mri = 1;
    811 #ifdef TC_M68K
    812 	  flag_m68k_mri = 1;
    813 #endif
    814 	  break;
    815 
    816 	case 'R':
    817 	  flag_readonly_data_in_text = 1;
    818 	  break;
    819 
    820 	case 'W':
    821 	  flag_no_warnings = 1;
    822 	  break;
    823 
    824 	case OPTION_WARN:
    825 	  flag_no_warnings = 0;
    826 	  flag_fatal_warnings = 0;
    827 	  break;
    828 
    829 	case OPTION_WARN_FATAL:
    830 	  flag_no_warnings = 0;
    831 	  flag_fatal_warnings = 1;
    832 	  break;
    833 
    834 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
    835 	case OPTION_EXECSTACK:
    836 	  flag_execstack = 1;
    837 	  flag_noexecstack = 0;
    838 	  break;
    839 
    840 	case OPTION_NOEXECSTACK:
    841 	  flag_noexecstack = 1;
    842 	  flag_execstack = 0;
    843 	  break;
    844 
    845 	case OPTION_SIZE_CHECK:
    846 	  if (strcasecmp (optarg, "error") == 0)
    847 	    flag_size_check = size_check_error;
    848 	  else if (strcasecmp (optarg, "warning") == 0)
    849 	    flag_size_check = size_check_warning;
    850 	  else
    851 	    as_fatal (_("Invalid --size-check= option: `%s'"), optarg);
    852 	  break;
    853 #endif
    854 	case 'Z':
    855 	  flag_always_generate_output = 1;
    856 	  break;
    857 
    858  	case OPTION_AL:
    859 	  listing |= LISTING_LISTING;
    860 	  if (optarg)
    861 	    listing_filename = xstrdup (optarg);
    862 	  break;
    863 
    864  	case OPTION_ALTERNATE:
    865  	  optarg = old_argv [optind - 1];
    866  	  while (* optarg == '-')
    867  	    optarg ++;
    868 
    869  	  if (strcmp (optarg, "alternate") == 0)
    870  	    {
    871  	      flag_macro_alternate = 1;
    872  	      break;
    873  	    }
    874  	  optarg ++;
    875  	  /* Fall through.  */
    876 
    877 	case 'a':
    878 	  if (optarg)
    879 	    {
    880 	      if (optarg != old_argv[optind] && optarg[-1] == '=')
    881 		--optarg;
    882 
    883 	      if (md_parse_option (optc, optarg) != 0)
    884 		break;
    885 
    886 	      while (*optarg)
    887 		{
    888 		  switch (*optarg)
    889 		    {
    890 		    case 'c':
    891 		      listing |= LISTING_NOCOND;
    892 		      break;
    893 		    case 'd':
    894 		      listing |= LISTING_NODEBUG;
    895 		      break;
    896 		    case 'g':
    897 		      listing |= LISTING_GENERAL;
    898 		      break;
    899 		    case 'h':
    900 		      listing |= LISTING_HLL;
    901 		      break;
    902 		    case 'l':
    903 		      listing |= LISTING_LISTING;
    904 		      break;
    905 		    case 'm':
    906 		      listing |= LISTING_MACEXP;
    907 		      break;
    908 		    case 'n':
    909 		      listing |= LISTING_NOFORM;
    910 		      break;
    911 		    case 's':
    912 		      listing |= LISTING_SYMBOLS;
    913 		      break;
    914 		    case '=':
    915 		      listing_filename = xstrdup (optarg + 1);
    916 		      optarg += strlen (listing_filename);
    917 		      break;
    918 		    default:
    919 		      as_fatal (_("invalid listing option `%c'"), *optarg);
    920 		      break;
    921 		    }
    922 		  optarg++;
    923 		}
    924 	    }
    925 	  if (!listing)
    926 	    listing = LISTING_DEFAULT;
    927 	  break;
    928 
    929 	case 'D':
    930 	  /* DEBUG is implemented: it debugs different
    931 	     things from other people's assemblers.  */
    932 	  flag_debug = 1;
    933 	  break;
    934 
    935 	case 'f':
    936 	  flag_no_comments = 1;
    937 	  break;
    938 
    939 	case 'I':
    940 	  {			/* Include file directory.  */
    941 	    char *temp = xstrdup (optarg);
    942 
    943 	    add_include_dir (temp);
    944 	    break;
    945 	  }
    946 
    947 	case 'o':
    948 	  out_file_name = xstrdup (optarg);
    949 	  break;
    950 
    951 	case 'w':
    952 	  break;
    953 
    954 	case 'X':
    955 	  /* -X means treat warnings as errors.  */
    956 	  break;
    957 
    958 	case OPTION_REDUCE_MEMORY_OVERHEADS:
    959 	  /* The only change we make at the moment is to reduce
    960 	     the size of the hash tables that we use.  */
    961 	  set_gas_hash_table_size (4051);
    962 	  break;
    963 
    964 	case OPTION_HASH_TABLE_SIZE:
    965 	  {
    966 	    unsigned long new_size;
    967 
    968             new_size = strtoul (optarg, NULL, 0);
    969             if (new_size)
    970               set_gas_hash_table_size (new_size);
    971             else
    972               as_fatal (_("--hash-size needs a numeric argument"));
    973 	    break;
    974 	  }
    975 	}
    976     }
    977 
    978   free (shortopts);
    979   free (longopts);
    980 
    981   *pargc = new_argc;
    982   *pargv = new_argv;
    983 
    984 #ifdef md_after_parse_args
    985   md_after_parse_args ();
    986 #endif
    987 }
    988 
    989 static void
    990 dump_statistics (void)
    991 {
    992 #ifdef HAVE_SBRK
    993   char *lim = (char *) sbrk (0);
    994 #endif
    995   long run_time = get_run_time () - start_time;
    996 
    997   fprintf (stderr, _("%s: total time in assembly: %ld.%06ld\n"),
    998 	   myname, run_time / 1000000, run_time % 1000000);
    999 #ifdef HAVE_SBRK
   1000   fprintf (stderr, _("%s: data size %ld\n"),
   1001 	   myname, (long) (lim - start_sbrk));
   1002 #endif
   1003 
   1004   subsegs_print_statistics (stderr);
   1005   write_print_statistics (stderr);
   1006   symbol_print_statistics (stderr);
   1007   read_print_statistics (stderr);
   1008 
   1009 #ifdef tc_print_statistics
   1010   tc_print_statistics (stderr);
   1011 #endif
   1012 
   1013 #ifdef obj_print_statistics
   1014   obj_print_statistics (stderr);
   1015 #endif
   1016 }
   1017 
   1018 static void
   1019 close_output_file (void)
   1020 {
   1021   output_file_close (out_file_name);
   1022   if (!keep_it)
   1023     unlink_if_ordinary (out_file_name);
   1024 }
   1025 
   1026 /* The interface between the macro code and gas expression handling.  */
   1027 
   1028 static size_t
   1029 macro_expr (const char *emsg, size_t idx, sb *in, offsetT *val)
   1030 {
   1031   char *hold;
   1032   expressionS ex;
   1033 
   1034   sb_terminate (in);
   1035 
   1036   hold = input_line_pointer;
   1037   input_line_pointer = in->ptr + idx;
   1038   expression_and_evaluate (&ex);
   1039   idx = input_line_pointer - in->ptr;
   1040   input_line_pointer = hold;
   1041 
   1042   if (ex.X_op != O_constant)
   1043     as_bad ("%s", emsg);
   1044 
   1045   *val = ex.X_add_number;
   1046 
   1047   return idx;
   1048 }
   1049 
   1050 /* Here to attempt 1 pass over each input file.
   1052    We scan argv[*] looking for filenames or exactly "" which is
   1053    shorthand for stdin. Any argv that is NULL is not a file-name.
   1054    We set need_pass_2 TRUE if, after this, we still have unresolved
   1055    expressions of the form (unknown value)+-(unknown value).
   1056 
   1057    Note the un*x semantics: there is only 1 logical input file, but it
   1058    may be a catenation of many 'physical' input files.  */
   1059 
   1060 static void
   1061 perform_an_assembly_pass (int argc, char ** argv)
   1062 {
   1063   int saw_a_file = 0;
   1064 #ifndef OBJ_MACH_O
   1065   flagword applicable;
   1066 #endif
   1067 
   1068   need_pass_2 = 0;
   1069 
   1070 #ifndef OBJ_MACH_O
   1071   /* Create the standard sections, and those the assembler uses
   1072      internally.  */
   1073   text_section = subseg_new (TEXT_SECTION_NAME, 0);
   1074   data_section = subseg_new (DATA_SECTION_NAME, 0);
   1075   bss_section = subseg_new (BSS_SECTION_NAME, 0);
   1076   /* @@ FIXME -- we're setting the RELOC flag so that sections are assumed
   1077      to have relocs, otherwise we don't find out in time.  */
   1078   applicable = bfd_applicable_section_flags (stdoutput);
   1079   bfd_set_section_flags (stdoutput, text_section,
   1080 			 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
   1081 				       | SEC_CODE | SEC_READONLY));
   1082   bfd_set_section_flags (stdoutput, data_section,
   1083 			 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
   1084 				       | SEC_DATA));
   1085   bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
   1086   seg_info (bss_section)->bss = 1;
   1087 #endif
   1088   subseg_new (BFD_ABS_SECTION_NAME, 0);
   1089   subseg_new (BFD_UND_SECTION_NAME, 0);
   1090   reg_section = subseg_new ("*GAS `reg' section*", 0);
   1091   expr_section = subseg_new ("*GAS `expr' section*", 0);
   1092 
   1093 #ifndef OBJ_MACH_O
   1094   subseg_set (text_section, 0);
   1095 #endif
   1096 
   1097   /* This may add symbol table entries, which requires having an open BFD,
   1098      and sections already created.  */
   1099   md_begin ();
   1100 
   1101 #ifdef USING_CGEN
   1102   gas_cgen_begin ();
   1103 #endif
   1104 #ifdef obj_begin
   1105   obj_begin ();
   1106 #endif
   1107 
   1108   /* Skip argv[0].  */
   1109   argv++;
   1110   argc--;
   1111 
   1112   while (argc--)
   1113     {
   1114       if (*argv)
   1115 	{			/* Is it a file-name argument?  */
   1116 	  PROGRESS (1);
   1117 	  saw_a_file++;
   1118 	  /* argv->"" if stdin desired, else->filename.  */
   1119 	  read_a_source_file (*argv);
   1120 	}
   1121       argv++;			/* Completed that argv.  */
   1122     }
   1123   if (!saw_a_file)
   1124     read_a_source_file ("");
   1125 }
   1126 
   1127 
   1129 int
   1130 main (int argc, char ** argv)
   1131 {
   1132   char ** argv_orig = argv;
   1133 
   1134   int macro_strip_at;
   1135 
   1136   start_time = get_run_time ();
   1137 #ifdef HAVE_SBRK
   1138   start_sbrk = (char *) sbrk (0);
   1139 #endif
   1140 
   1141 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   1142   setlocale (LC_MESSAGES, "");
   1143 #endif
   1144 #if defined (HAVE_SETLOCALE)
   1145   setlocale (LC_CTYPE, "");
   1146 #endif
   1147   bindtextdomain (PACKAGE, LOCALEDIR);
   1148   textdomain (PACKAGE);
   1149 
   1150   if (debug_memory)
   1151     chunksize = 64;
   1152 
   1153 #ifdef HOST_SPECIAL_INIT
   1154   HOST_SPECIAL_INIT (argc, argv);
   1155 #endif
   1156 
   1157   myname = argv[0];
   1158   xmalloc_set_program_name (myname);
   1159 
   1160   expandargv (&argc, &argv);
   1161 
   1162   START_PROGRESS (myname, 0);
   1163 
   1164 #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
   1165 #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
   1166 #endif
   1167 
   1168   out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
   1169 
   1170   hex_init ();
   1171   bfd_init ();
   1172   bfd_set_error_program_name (myname);
   1173 
   1174 #ifdef USE_EMULATIONS
   1175   select_emulation_mode (argc, argv);
   1176 #endif
   1177 
   1178   PROGRESS (1);
   1179   /* Call parse_args before any of the init/begin functions
   1180      so that switches like --hash-size can be honored.  */
   1181   parse_args (&argc, &argv);
   1182   symbol_begin ();
   1183   frag_init ();
   1184   subsegs_begin ();
   1185   read_begin ();
   1186   input_scrub_begin ();
   1187   expr_begin ();
   1188 
   1189   /* It has to be called after dump_statistics ().  */
   1190   xatexit (close_output_file);
   1191 
   1192   if (flag_print_statistics)
   1193     xatexit (dump_statistics);
   1194 
   1195   macro_strip_at = 0;
   1196 #ifdef TC_I960
   1197   macro_strip_at = flag_mri;
   1198 #endif
   1199 
   1200   macro_init (flag_macro_alternate, flag_mri, macro_strip_at, macro_expr);
   1201 
   1202   PROGRESS (1);
   1203 
   1204   output_file_create (out_file_name);
   1205   gas_assert (stdoutput != 0);
   1206 
   1207   dot_symbol_init ();
   1208 
   1209 #ifdef tc_init_after_args
   1210   tc_init_after_args ();
   1211 #endif
   1212 
   1213   itbl_init ();
   1214 
   1215   dwarf2_init ();
   1216 
   1217   local_symbol_make (".gasversion.", absolute_section,
   1218 		     BFD_VERSION / 10000UL, &predefined_address_frag);
   1219 
   1220   /* Now that we have fully initialized, and have created the output
   1221      file, define any symbols requested by --defsym command line
   1222      arguments.  */
   1223   while (defsyms != NULL)
   1224     {
   1225       symbolS *sym;
   1226       struct defsym_list *next;
   1227 
   1228       sym = symbol_new (defsyms->name, absolute_section, defsyms->value,
   1229 			&zero_address_frag);
   1230       /* Make symbols defined on the command line volatile, so that they
   1231 	 can be redefined inside a source file.  This makes this assembler's
   1232 	 behaviour compatible with earlier versions, but it may not be
   1233 	 completely intuitive.  */
   1234       S_SET_VOLATILE (sym);
   1235       symbol_table_insert (sym);
   1236       next = defsyms->next;
   1237       free (defsyms);
   1238       defsyms = next;
   1239     }
   1240 
   1241   PROGRESS (1);
   1242 
   1243   /* Assemble it.  */
   1244   perform_an_assembly_pass (argc, argv);
   1245 
   1246   cond_finish_check (-1);
   1247 
   1248 #ifdef md_end
   1249   md_end ();
   1250 #endif
   1251 
   1252 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
   1253   if ((flag_execstack || flag_noexecstack)
   1254       && OUTPUT_FLAVOR == bfd_target_elf_flavour)
   1255     {
   1256       segT gnustack;
   1257 
   1258       gnustack = subseg_new (".note.GNU-stack", 0);
   1259       bfd_set_section_flags (stdoutput, gnustack,
   1260 			     SEC_READONLY | (flag_execstack ? SEC_CODE : 0));
   1261 
   1262     }
   1263 #endif
   1264 
   1265   /* If we've been collecting dwarf2 .debug_line info, either for
   1266      assembly debugging or on behalf of the compiler, emit it now.  */
   1267   dwarf2_finish ();
   1268 
   1269   /* If we constructed dwarf2 .eh_frame info, either via .cfi
   1270      directives from the user or by the backend, emit it now.  */
   1271   cfi_finish ();
   1272 
   1273   keep_it = 0;
   1274   if (seen_at_least_1_file ())
   1275     {
   1276       int n_warns, n_errs;
   1277       char warn_msg[50];
   1278       char err_msg[50];
   1279 
   1280       write_object_file ();
   1281 
   1282       n_warns = had_warnings ();
   1283       n_errs = had_errors ();
   1284 
   1285       if (n_warns == 1)
   1286 	sprintf (warn_msg, _("%d warning"), n_warns);
   1287       else
   1288 	sprintf (warn_msg, _("%d warnings"), n_warns);
   1289       if (n_errs == 1)
   1290 	sprintf (err_msg, _("%d error"), n_errs);
   1291       else
   1292 	sprintf (err_msg, _("%d errors"), n_errs);
   1293 
   1294       if (flag_fatal_warnings && n_warns != 0)
   1295 	{
   1296 	  if (n_errs == 0)
   1297 	    as_bad (_("%s, treating warnings as errors"), warn_msg);
   1298 	  n_errs += n_warns;
   1299 	}
   1300 
   1301       if (n_errs == 0)
   1302 	keep_it = 1;
   1303       else if (flag_always_generate_output)
   1304 	{
   1305 	  /* The -Z flag indicates that an object file should be generated,
   1306 	     regardless of warnings and errors.  */
   1307 	  keep_it = 1;
   1308 	  fprintf (stderr, _("%s, %s, generating bad object file\n"),
   1309 		   err_msg, warn_msg);
   1310 	}
   1311     }
   1312 
   1313   fflush (stderr);
   1314 
   1315 #ifndef NO_LISTING
   1316   listing_print (listing_filename, argv_orig);
   1317 #endif
   1318 
   1319   input_scrub_end ();
   1320 
   1321   END_PROGRESS (myname);
   1322 
   1323   /* Use xexit instead of return, because under VMS environments they
   1324      may not place the same interpretation on the value given.  */
   1325   if (had_errors () != 0)
   1326     xexit (EXIT_FAILURE);
   1327 
   1328   /* Only generate dependency file if assembler was successful.  */
   1329   print_dependencies ();
   1330 
   1331   xexit (EXIT_SUCCESS);
   1332 }
   1333