X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fas.c;h=7b95369eb4e00119d760b9b4aaddec20223b28c7;hb=329e276daf98fb4c8b3770a6c2f02fd22472a638;hp=20d1522dbca8a599410458f76ff7cc348f19b9b2;hpb=05da4302188949f1752cb1fa5def4b010450dbe4;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/as.c b/gas/as.c index 20d1522dbc..7b95369eb4 100644 --- a/gas/as.c +++ b/gas/as.c @@ -89,6 +89,11 @@ int listing; enum debug_info_type debug_type = DEBUG_UNSPECIFIED; int use_gnu_debug_info_extensions = 0; +#ifndef MD_DEBUG_FORMAT_SELECTOR +#define MD_DEBUG_FORMAT_SELECTOR NULL +#endif +static enum debug_info_type (*md_debug_format_selector) (int *) = MD_DEBUG_FORMAT_SELECTOR; + /* Maximum level of macro nesting. */ int max_macro_nest = 100; @@ -123,6 +128,8 @@ static struct itbl_file_list *itbl_files; static long start_time; +static int flag_macro_alternate; + #ifdef USE_EMULATIONS #define EMULATION_ENVIRON "AS_EMULATION" @@ -244,6 +251,8 @@ Options:\n\ s include symbols\n\ =FILE list to FILE (must be last sub-option)\n")); + fprintf (stream, _("\ + --alternate initially turn on alternate macro syntax\n")); fprintf (stream, _("\ -D produce assembler debugging messages\n")); fprintf (stream, _("\ @@ -275,11 +284,13 @@ Options:\n\ fprintf (stream, _("\ -f skip whitespace and comment preprocessing\n")); fprintf (stream, _("\ - --gstabs generate stabs debugging information\n")); + -g --gen-debug generate debugging information\n")); + fprintf (stream, _("\ + --gstabs generate STABS debugging information\n")); fprintf (stream, _("\ - --gstabs+ generate stabs debug info with GNU extensions\n")); + --gstabs+ generate STABS debug info with GNU extensions\n")); fprintf (stream, _("\ - --gdwarf2 generate DWARF2 debugging information\n")); + --gdwarf-2 generate DWARF2 debugging information\n")); fprintf (stream, _("\ --help show this message and exit\n")); fprintf (stream, _("\ @@ -374,7 +385,7 @@ parse_args (int * pargc, char *** pargv) /* -K is not meaningful if .word is not being hacked. */ 'K', #endif - 'L', 'M', 'R', 'W', 'Z', 'a', ':', ':', 'D', 'f', 'I', ':', 'o', ':', + 'L', 'M', 'R', 'W', 'Z', 'a', ':', ':', 'D', 'f', 'g', 'I', ':', 'o', ':', #ifndef VMS /* -v takes an argument on VMS, so we don't make it a generic option. */ @@ -407,59 +418,68 @@ parse_args (int * pargc, char *** pargv) OPTION_DEPFILE, OPTION_GSTABS, OPTION_GSTABS_PLUS, + OPTION_GDWARF2, OPTION_STRIP_LOCAL_ABSOLUTE, OPTION_TRADITIONAL_FORMAT, - OPTION_GDWARF2, OPTION_WARN, OPTION_TARGET_HELP, OPTION_EXECSTACK, OPTION_NOEXECSTACK, + OPTION_ALTERNATE, OPTION_WARN_FATAL + /* When you add options here, check that they do + not collide with OPTION_MD_BASE. See as.h. */ }; static const struct option std_longopts[] = { - {"help", no_argument, NULL, OPTION_HELP}, - /* 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. */ - {"keep-locals", no_argument, NULL, 'L'}, - {"keep-locals", no_argument, NULL, 'L'}, - {"mri", no_argument, NULL, 'M'}, - {"nocpp", no_argument, NULL, OPTION_NOCPP}, - {"statistics", no_argument, NULL, OPTION_STATISTICS}, - {"version", no_argument, NULL, OPTION_VERSION}, - {"dump-config", no_argument, NULL, OPTION_DUMPCONFIG}, - {"verbose", no_argument, NULL, OPTION_VERBOSE}, - {"emulation", required_argument, NULL, OPTION_EMULATION}, - {"defsym", required_argument, NULL, OPTION_DEFSYM}, + /* Note: commas are placed at the start of the line rather than + the end of the preceeding line so that it is simpler to + selectively add and remove lines from this list. */ + {"alternate", no_argument, NULL, OPTION_ALTERNATE} + ,{"defsym", required_argument, NULL, OPTION_DEFSYM} + ,{"dump-config", no_argument, NULL, OPTION_DUMPCONFIG} + ,{"emulation", required_argument, NULL, OPTION_EMULATION} +#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) + ,{"execstack", no_argument, NULL, OPTION_EXECSTACK} + ,{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK} +#endif + ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} + ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF2} + /* GCC uses --gdwarf-2 but GAS uses to use --gdwarf2, + so we keep it here for backwards compatibility. */ + ,{"gdwarf2", no_argument, NULL, OPTION_GDWARF2} + ,{"gen-debug", no_argument, NULL, 'g'} + ,{"gstabs", no_argument, NULL, OPTION_GSTABS} + ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS} + ,{"help", no_argument, NULL, OPTION_HELP} /* 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}, - {"listing-lhs-width", required_argument, NULL, OPTION_LISTING_LHS_WIDTH}, - {"listing-lhs-width2", required_argument, NULL, OPTION_LISTING_LHS_WIDTH2}, - {"listing-rhs-width", required_argument, NULL, OPTION_LISTING_RHS_WIDTH}, - {"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES}, - {"MD", required_argument, NULL, OPTION_DEPFILE}, - {"gstabs", no_argument, NULL, OPTION_GSTABS}, - {"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}, - {"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE}, - {"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT}, - {"gdwarf2", no_argument, NULL, OPTION_GDWARF2}, - {"no-warn", no_argument, NULL, 'W'}, - {"warn", no_argument, NULL, OPTION_WARN}, - {"target-help", no_argument, NULL, OPTION_TARGET_HELP}, -#if defined BFD_ASSEMBLER && (defined OBJ_ELF || defined OBJ_MAYBE_ELF) - {"execstack", no_argument, NULL, OPTION_EXECSTACK}, - {"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK}, -#endif - {"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} - /* When you add options here, check that they do not collide with - OPTION_MD_BASE. See as.h. */ + ,{"itbl", required_argument, NULL, OPTION_INSTTBL} + /* 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. */ + ,{"keep-locals", no_argument, NULL, 'L'} + ,{"keep-locals", no_argument, NULL, 'L'} + ,{"listing-lhs-width", required_argument, NULL, OPTION_LISTING_LHS_WIDTH} + ,{"listing-lhs-width2", required_argument, NULL, OPTION_LISTING_LHS_WIDTH2} + ,{"listing-rhs-width", required_argument, NULL, OPTION_LISTING_RHS_WIDTH} + ,{"listing-cont-lines", required_argument, NULL, OPTION_LISTING_CONT_LINES} + ,{"MD", required_argument, NULL, OPTION_DEPFILE} + ,{"mri", no_argument, NULL, 'M'} + ,{"nocpp", no_argument, NULL, OPTION_NOCPP} + ,{"no-warn", no_argument, NULL, 'W'} + ,{"statistics", no_argument, NULL, OPTION_STATISTICS} + ,{"strip-local-absolute", no_argument, NULL, OPTION_STRIP_LOCAL_ABSOLUTE} + ,{"version", no_argument, NULL, OPTION_VERSION} + ,{"verbose", no_argument, NULL, OPTION_VERBOSE} + ,{"target-help", no_argument, NULL, OPTION_TARGET_HELP} + ,{"traditional-format", no_argument, NULL, OPTION_TRADITIONAL_FORMAT} + ,{"warn", no_argument, NULL, OPTION_WARN} }; /* Construct the option lists from the standard list and the target @@ -501,7 +521,7 @@ parse_args (int * pargc, char *** pargv) if (md_parse_option (optc, optarg) != 0) break; /* `-v' isn't included in the general short_opts list, so check for - it explicity here before deciding we've gotten a bad argument. */ + it explicitly here before deciding we've gotten a bad argument. */ if (optc == 'v') { #ifdef VMS @@ -520,6 +540,8 @@ parse_args (int * pargc, char *** pargv) verbose = 1; break; } + else + as_bad (_("unrecognized option -%c%s"), optc, optarg ? optarg : ""); /* Fall through. */ case '?': @@ -648,6 +670,23 @@ the GNU General Public License. This program has absolutely no warranty.\n")); start_dependencies (optarg); break; + case 'g': + /* Some backends, eg Alpha, use the -g switch for their own + purposes. So we check here for an explicit -g and allow + the backend to decide if it wants to process it. */ + if ( old_argv[optind - 1][1] == 'g' + && old_argv[optind - 1][2] == 0 + && md_parse_option (optc, optarg)) + continue; + + if (md_debug_format_selector) + debug_type = md_debug_format_selector (& use_gnu_debug_info_extensions); + else if (IS_ELF) + debug_type = DEBUG_DWARF2; + else + debug_type = DEBUG_STABS; + break; + case OPTION_GSTABS_PLUS: use_gnu_debug_info_extensions = 1; /* Fall through. */ @@ -680,6 +719,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case OPTION_LISTING_LHS_WIDTH2: { int tmp = atoi (optarg); + if (tmp > listing_lhs_width) listing_lhs_width_second = tmp; } @@ -731,6 +771,19 @@ the GNU General Public License. This program has absolutely no warranty.\n")); flag_always_generate_output = 1; break; + case OPTION_ALTERNATE: + optarg = old_argv [optind - 1]; + while (* optarg == '-') + optarg ++; + + if (strcmp (optarg, "alternate") == 0) + { + flag_macro_alternate = 1; + break; + } + optarg ++; + /* Fall through. */ + case 'a': if (optarg) { @@ -790,6 +843,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case 'I': { /* Include file directory. */ char *temp = xstrdup (optarg); + add_include_dir (temp); break; } @@ -981,7 +1035,6 @@ perform_an_assembly_pass (int argc, char ** argv) int main (int argc, char ** argv) { - int macro_alternate; int macro_strip_at; int keep_it; @@ -1036,7 +1089,6 @@ main (int argc, char ** argv) if (flag_print_statistics) xatexit (dump_statistics); - macro_alternate = 0; macro_strip_at = 0; #ifdef TC_I960 macro_strip_at = flag_mri; @@ -1044,11 +1096,11 @@ main (int argc, char ** argv) #ifdef TC_A29K /* For compatibility with the AMD 29K family macro assembler specification. */ - macro_alternate = 1; + flag_macro_alternate = 1; macro_strip_at = 1; #endif - macro_init (macro_alternate, flag_mri, macro_strip_at, macro_expr); + macro_init (flag_macro_alternate, flag_mri, macro_strip_at, macro_expr); PROGRESS (1); @@ -1162,4 +1214,3 @@ main (int argc, char ** argv) xexit (EXIT_SUCCESS); } -