2009-01-26 Andrew Stubbs <ams@codesourcery.com>
[deliverable/binutils-gdb.git] / gas / as.c
index c1315eb7685ae968f39261319404bf578661a8e5..246ee689205dab13ffad474884da6f6c95ae2b49 100644 (file)
--- a/gas/as.c
+++ b/gas/as.c
@@ -1,19 +1,19 @@
 /* as.c - GAS main program.
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
 /* as.c - GAS main program.
    Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    any later version.
 
-   GAS is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   GAS is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
 #ifdef HAVE_ITBL_CPU
 #include "itbl-ops.h"
 #else
 #ifdef HAVE_ITBL_CPU
 #include "itbl-ops.h"
 #else
-#define itbl_parse(itbl_file) 1
 #define itbl_init()
 #endif
 
 #ifdef HAVE_SBRK
 #ifdef NEED_DECLARATION_SBRK
 #define itbl_init()
 #endif
 
 #ifdef HAVE_SBRK
 #ifdef NEED_DECLARATION_SBRK
-extern PTR sbrk ();
+extern void *sbrk ();
 #endif
 #endif
 
 #endif
 #endif
 
@@ -60,13 +59,6 @@ extern PTR sbrk ();
 extern void gas_cgen_begin (void);
 #endif
 
 extern void gas_cgen_begin (void);
 #endif
 
-/* Keep a record of the itbl files we read in.  */
-struct itbl_file_list
-{
-  struct itbl_file_list *next;
-  char *name;
-};
-
 /* We build a list of defsyms as we read the options, and then define
    them after we have initialized everything.  */
 struct defsym_list
 /* We build a list of defsyms as we read the options, and then define
    them after we have initialized everything.  */
 struct defsym_list
@@ -117,7 +109,15 @@ static char *listing_filename = NULL;
 
 static struct defsym_list *defsyms;
 
 
 static struct defsym_list *defsyms;
 
+#ifdef HAVE_ITBL_CPU
+/* Keep a record of the itbl files we read in.  */
+struct itbl_file_list
+{
+  struct itbl_file_list *next;
+  char *name;
+};
 static struct itbl_file_list *itbl_files;
 static struct itbl_file_list *itbl_files;
+#endif
 
 static long start_time;
 
 
 static long start_time;
 
@@ -232,6 +232,7 @@ Options:\n\
                          Sub-options [default hls]:\n\
                          c      omit false conditionals\n\
                          d      omit debugging directives\n\
                          Sub-options [default hls]:\n\
                          c      omit false conditionals\n\
                          d      omit debugging directives\n\
+                         g      include general info\n\
                          h      include high-level source\n\
                          l      include assembly\n\
                          m      include macro expansions\n\
                          h      include high-level source\n\
                          l      include assembly\n\
                          m      include macro expansions\n\
@@ -244,6 +245,8 @@ Options:\n\
   fprintf (stream, _("\
   -D                      produce assembler debugging messages\n"));
   fprintf (stream, _("\
   fprintf (stream, _("\
   -D                      produce assembler debugging messages\n"));
   fprintf (stream, _("\
+  --debug-prefix-map OLD=NEW  Map OLD to NEW in debug information\n"));
+  fprintf (stream, _("\
   --defsym SYM=VAL        define symbol SYM to given value\n"));
 #ifdef USE_EMULATIONS
   {
   --defsym SYM=VAL        define symbol SYM to given value\n"));
 #ifdef USE_EMULATIONS
   {
@@ -321,9 +324,11 @@ Options:\n\
   --warn                  don't suppress warnings\n"));
   fprintf (stream, _("\
   --fatal-warnings        treat warnings as errors\n"));
   --warn                  don't suppress warnings\n"));
   fprintf (stream, _("\
   --fatal-warnings        treat warnings as errors\n"));
+#ifdef HAVE_ITBL_CPU
   fprintf (stream, _("\
   --itbl INSTTBL          extend instruction set to include instructions\n\
                           matching the specifications defined in file INSTTBL\n"));
   fprintf (stream, _("\
   --itbl INSTTBL          extend instruction set to include instructions\n\
                           matching the specifications defined in file INSTTBL\n"));
+#endif
   fprintf (stream, _("\
   -w                      ignored\n"));
   fprintf (stream, _("\
   fprintf (stream, _("\
   -w                      ignored\n"));
   fprintf (stream, _("\
@@ -390,8 +395,10 @@ parse_args (int * pargc, char *** pargv)
     'v',
 #endif
     'w', 'X',
     'v',
 #endif
     'w', 'X',
+#ifdef HAVE_ITBL_CPU
     /* New option for extending instruction set (see also --itbl below).  */
     't', ':',
     /* New option for extending instruction set (see also --itbl below).  */
     't', ':',
+#endif
     '\0'
   };
   struct option *longopts;
     '\0'
   };
   struct option *longopts;
@@ -407,8 +414,8 @@ parse_args (int * pargc, char *** pargv)
       OPTION_DUMPCONFIG,
       OPTION_VERBOSE,
       OPTION_EMULATION,
       OPTION_DUMPCONFIG,
       OPTION_VERBOSE,
       OPTION_EMULATION,
+      OPTION_DEBUG_PREFIX_MAP,
       OPTION_DEFSYM,
       OPTION_DEFSYM,
-      OPTION_INSTTBL,
       OPTION_LISTING_LHS_WIDTH,
       OPTION_LISTING_LHS_WIDTH2,
       OPTION_LISTING_RHS_WIDTH,
       OPTION_LISTING_LHS_WIDTH,
       OPTION_LISTING_LHS_WIDTH2,
       OPTION_LISTING_RHS_WIDTH,
@@ -445,6 +452,7 @@ parse_args (int * pargc, char *** pargv)
     ,{"a", optional_argument, NULL, 'a'}
     /* Handle -al=<FILE>.  */
     ,{"al", optional_argument, NULL, OPTION_AL}
     ,{"a", optional_argument, NULL, 'a'}
     /* Handle -al=<FILE>.  */
     ,{"al", optional_argument, NULL, OPTION_AL}
+    ,{"debug-prefix-map", required_argument, NULL, OPTION_DEBUG_PREFIX_MAP}
     ,{"defsym", required_argument, NULL, OPTION_DEFSYM}
     ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
     ,{"emulation", required_argument, NULL, OPTION_EMULATION}
     ,{"defsym", required_argument, NULL, OPTION_DEFSYM}
     ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}
     ,{"emulation", required_argument, NULL, OPTION_EMULATION}
@@ -462,13 +470,15 @@ parse_args (int * pargc, char *** pargv)
     ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}
     ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE}
     ,{"help", no_argument, NULL, OPTION_HELP}
     ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}
     ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE}
     ,{"help", no_argument, NULL, OPTION_HELP}
+#ifdef HAVE_ITBL_CPU
     /* New option for extending instruction set (see also -t above).
        The "-t file" or "--itbl file" option extends the basic set of
        valid instructions by reading "file", a text file containing a
        list of instruction formats.  The additional opcodes and their
        formats are added to the built-in set of instructions, and
        mnemonics for new registers may also be defined.  */
     /* New option for extending instruction set (see also -t above).
        The "-t file" or "--itbl file" option extends the basic set of
        valid instructions by reading "file", a text file containing a
        list of instruction formats.  The additional opcodes and their
        formats are added to the built-in set of instructions, and
        mnemonics for new registers may also be defined.  */
-    ,{"itbl", required_argument, NULL, OPTION_INSTTBL}
+    ,{"itbl", required_argument, NULL, 't'}
+#endif
     /* getopt allows abbreviations, so we do this to stop it from
        treating -k as an abbreviation for --keep-locals.  Some
        ports use -k to enable PIC assembly.  */
     /* getopt allows abbreviations, so we do this to stop it from
        treating -k as an abbreviation for --keep-locals.  Some
        ports use -k to enable PIC assembly.  */
@@ -590,10 +600,11 @@ parse_args (int * pargc, char *** pargv)
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
        case OPTION_VERSION:
          /* This output is intended to follow the GNU standards document.  */
          printf (_("GNU assembler %s\n"), BFD_VERSION_STRING);
-         printf (_("Copyright 2007 Free Software Foundation, Inc.\n"));
+         printf (_("Copyright 2008 Free Software Foundation, Inc.\n"));
          printf (_("\
 This program is free software; you may redistribute it under the terms of\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"));
+the GNU General Public License version 3 or later.\n\
+This program has absolutely no warranty.\n"));
          printf (_("This assembler was configured for a target of `%s'.\n"),
                  TARGET_ALIAS);
          exit (EXIT_SUCCESS);
          printf (_("This assembler was configured for a target of `%s'.\n"),
                  TARGET_ALIAS);
          exit (EXIT_SUCCESS);
@@ -619,6 +630,10 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
 #endif
          exit (EXIT_SUCCESS);
 
 #endif
          exit (EXIT_SUCCESS);
 
+       case OPTION_DEBUG_PREFIX_MAP:
+         add_debug_prefix_map (optarg);
+         break;
+
        case OPTION_DEFSYM:
          {
            char *s;
        case OPTION_DEFSYM:
          {
            char *s;
@@ -639,7 +654,7 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
          }
          break;
 
          }
          break;
 
-       case OPTION_INSTTBL:
+#ifdef HAVE_ITBL_CPU
        case 't':
          {
            /* optarg is the name of the file containing the instruction
        case 't':
          {
            /* optarg is the name of the file containing the instruction
@@ -667,6 +682,7 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
                        itbl_files->name);
          }
          break;
                        itbl_files->name);
          }
          break;
+#endif
 
        case OPTION_DEPFILE:
          start_dependencies (optarg);
 
        case OPTION_DEPFILE:
          start_dependencies (optarg);
@@ -810,6 +826,9 @@ the GNU General Public License.  This program has absolutely no warranty.\n"));
                    case 'd':
                      listing |= LISTING_NODEBUG;
                      break;
                    case 'd':
                      listing |= LISTING_NODEBUG;
                      break;
+                   case 'g':
+                     listing |= LISTING_GENERAL;
+                     break;
                    case 'h':
                      listing |= LISTING_HLL;
                      break;
                    case 'h':
                      listing |= LISTING_HLL;
                      break;
@@ -1062,6 +1081,8 @@ create_obj_attrs_section (void)
 int
 main (int argc, char ** argv)
 {
 int
 main (int argc, char ** argv)
 {
+  char ** argv_orig = argv;
+
   int macro_strip_at;
   int keep_it;
 
   int macro_strip_at;
   int keep_it;
 
@@ -1174,7 +1195,8 @@ main (int argc, char ** argv)
 #endif
 
 #ifdef OBJ_ELF
 #endif
 
 #ifdef OBJ_ELF
-  create_obj_attrs_section ();
+  if (IS_ELF)
+    create_obj_attrs_section ();
 #endif
 
 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
 #endif
 
 #if defined OBJ_ELF || defined OBJ_MAYBE_ELF
@@ -1213,8 +1235,10 @@ main (int argc, char ** argv)
   if (keep_it)
     write_object_file ();
 
   if (keep_it)
     write_object_file ();
 
+  fflush (stderr);
+
 #ifndef NO_LISTING
 #ifndef NO_LISTING
-  listing_print (listing_filename);
+  listing_print (listing_filename, argv_orig);
 #endif
 
   if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
 #endif
 
   if (flag_fatal_warnings && had_warnings () > 0 && had_errors () == 0)
This page took 0.026632 seconds and 4 git commands to generate.