diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 21 | ||||
-rw-r--r-- | gas/NEWS | 3 | ||||
-rw-r--r-- | gas/as.c | 118 | ||||
-rw-r--r-- | gas/as.h | 166 | ||||
-rw-r--r-- | gas/config/tc-arm.c | 1 | ||||
-rw-r--r-- | gas/config/tc-m68k.c | 10 | ||||
-rw-r--r-- | gas/config/tc-pdp11.c | 2 | ||||
-rw-r--r-- | gas/config/tc-v850.c | 23 | ||||
-rw-r--r-- | gas/doc/as.texinfo | 12 | ||||
-rw-r--r-- | gas/doc/internals.texi | 28 | ||||
-rw-r--r-- | gas/tc.h | 78 |
11 files changed, 259 insertions, 203 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 08fc72a..16f46c8 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,24 @@ +2004-08-17 Nick Clifton <nickc@redhat.com> + + * as.c (MD_DEBUG_FORMAT_SELECTOR): Provide default definition. + (show_usage): Add -g. + (std_longopts): Add --gen-debug. Alpha sort the table. + (parse_args): Print an error message if a switch is not handled. + Handle the -g switch, calling md_debug_format_selector() if + necessary. + * NEWS: Mention new feature. + * doc/as.texinfo: Document new switch. + * doc/internals.texi: Document behaviour of md_parse_option. + + * config/tc-arm.c (md_parse_option): Do not issue an error message + if the switch is not recognised. + * config/tc-m68k.c (md_parse_option): Likewise. + * config/tc-pdp11.c (md_parse_option): Likewise. + * config/tc-v850.c (md_parse_option): Likewise. + + * as.h: Fix up formatting. + * tc.h: Likewise. + 2004-08-16 Nick Clifton <nickc@redhat.com> * macro.c (macro_set_alternate): Use ISO C90 formatting. @@ -1,5 +1,8 @@ -*- text -*- +* Add a -g command line option to generate debug information in the target's + preferred debug format. + * Support for the crx-elf target added. * Support for the sh-symbianelf target added. @@ -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; @@ -279,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, _("\ @@ -378,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. */ @@ -411,61 +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 - {"alternate", no_argument, NULL, OPTION_ALTERNATE}, - {"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 @@ -526,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 '?': @@ -654,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. */ @@ -686,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; } @@ -809,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; } @@ -1179,4 +1214,3 @@ main (int argc, char ** argv) xexit (EXIT_SUCCESS); } - @@ -23,19 +23,18 @@ #ifndef GAS #define GAS 1 /* I think this stuff is largely out of date. xoxorich. - * - * CAPITALISED names are #defined. - * "lowercaseH" is #defined if "lowercase.h" has been #include-d. - * "lowercaseT" is a typedef of "lowercase" objects. - * "lowercaseP" is type "pointer to object of type 'lowercase'". - * "lowercaseS" is typedef struct ... lowercaseS. - * - * #define DEBUG to enable all the "know" assertion tests. - * #define SUSPECT when debugging hash code. - * #define COMMON as "extern" for all modules except one, where you #define - * COMMON as "". - * If TEST is #defined, then we are testing a module: #define COMMON as "". - */ + + CAPITALISED names are #defined. + "lowercaseH" is #defined if "lowercase.h" has been #include-d. + "lowercaseT" is a typedef of "lowercase" objects. + "lowercaseP" is type "pointer to object of type 'lowercase'". + "lowercaseS" is typedef struct ... lowercaseS. + + #define DEBUG to enable all the "know" assertion tests. + #define SUSPECT when debugging hash code. + #define COMMON as "extern" for all modules except one, where you #define + COMMON as "". + If TEST is #defined, then we are testing a module: #define COMMON as "". */ #include "config.h" #include "bin-bugs.h" @@ -137,7 +136,7 @@ extern void *alloca (); #include "progress.h" /* This doesn't get taken care of anywhere. */ -#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ +#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ #if !defined (__GNUC__) && !defined (inline) #define inline #endif @@ -235,19 +234,19 @@ typedef addressT valueT; #ifndef COMMON #ifdef TEST -#define COMMON /* declare our COMMONs storage here. */ +#define COMMON /* Declare our COMMONs storage here. */ #else -#define COMMON extern /* our commons live elsewhere */ +#define COMMON extern /* Our commons live elsewhere. */ #endif #endif /* COMMON now defined */ #ifdef DEBUG #ifndef know -#define know(p) assert(p) /* Verify our assumptions! */ +#define know(p) assert(p) /* Verify our assumptions! */ #endif /* not yet defined */ #else -#define know(p) /* know() checks are no-op.ed */ +#define know(p) /* know() checks are no-op.ed */ #endif /* input_scrub.c */ @@ -277,31 +276,32 @@ typedef addressT valueT; #define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS #endif -typedef enum _segT { +typedef enum _segT +{ SEG_ABSOLUTE = 0, SEG_LIST, SEG_UNKNOWN, SEG_GOOF, /* Only happens if AS has a logic error. */ - /* Invented so we don't crash printing */ - /* error message involving weird segment. */ + /* Invented so we don't crash printing + error message involving weird segment. */ SEG_EXPR, /* Intermediate expression values. */ SEG_DEBUG, /* Debug segment */ - SEG_NTV, /* Transfert vector preload segment */ - SEG_PTV, /* Transfert vector postload segment */ - SEG_REGISTER /* Mythical: a register-valued expression */ + SEG_NTV, /* Transfert vector preload segment. */ + SEG_PTV, /* Transfert vector postload segment. */ + SEG_REGISTER /* Mythical: a register-valued expression. */ } segT; #define SEG_MAXIMUM_ORDINAL (SEG_REGISTER) #else typedef asection *segT; -#define SEG_NORMAL(SEG) ((SEG) != absolute_section \ +#define SEG_NORMAL(SEG) ( (SEG) != absolute_section \ && (SEG) != undefined_section \ && (SEG) != reg_section \ && (SEG) != expr_section) #endif typedef int subsegT; -/* What subseg we are accessing now? */ +/* What subseg we are accessing now? */ COMMON subsegT now_subseg; /* Segment our instructions emit to. */ @@ -334,9 +334,9 @@ extern segT text_section, data_section, bss_section; #define undefined_section SEG_UNKNOWN #endif -/* relax() */ -enum _relax_state { +enum _relax_state +{ /* Variable chars to be repeated fr_offset times. Fr_symbol unused. Used with fr_offset == 0 for a constant length frag. */ @@ -368,7 +368,7 @@ enum _relax_state { rs_broken_word, #endif - /* machine-specific relaxable (or similarly alterable) instruction */ + /* Machine specific relaxable (or similarly alterable) instruction. */ rs_machine_dependent, /* .space directive with expression operand that needs to be computed @@ -398,7 +398,7 @@ typedef unsigned int relax_substateT; Could be a problem, cross-assembling for 64-bit machines. */ typedef addressT relax_addressT; -/* main program "as.c" (command arguments etc) */ +/* main program "as.c" (command arguments etc). */ COMMON unsigned char flag_no_comments; /* -f */ COMMON unsigned char flag_debug; /* -D */ @@ -466,7 +466,8 @@ extern int listing; This is especially relevant to DWARF2, since the compiler may emit line number directives that the assembler resolves. */ -enum debug_info_type { +enum debug_info_type +{ DEBUG_UNSPECIFIED, DEBUG_NONE, DEBUG_STABS, @@ -488,7 +489,8 @@ extern int verbose; increase malloc calls for monitoring memory allocation. */ extern int chunksize; -struct _pseudo_type { +struct _pseudo_type +{ /* assembler mnemonic, lower case, no '.' */ const char *poc_name; /* Do the work */ @@ -553,57 +555,52 @@ PRINTF_LIKE (as_warn); PRINTF_WHERE_LIKE (as_bad_where); PRINTF_WHERE_LIKE (as_warn_where); -void as_assert (const char *, int, const char *); -void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; - -void fprint_value (FILE *file, addressT value); -void sprint_value (char *buf, addressT value); - -int had_errors (void); -int had_warnings (void); - -void as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); -void as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); - -void print_version_id (void); -char *app_push (void); -char *atof_ieee (char *str, int what_kind, LITTLENUM_TYPE * words); -char *input_scrub_include_file (char *filename, char *position); -extern void input_scrub_insert_line (const char *line); -extern void input_scrub_insert_file (char *path); -char *input_scrub_new_file (char *filename); -char *input_scrub_next_buffer (char **bufp); -int do_scrub_chars (int (*get) (char *, int), char *to, int tolen); -int gen_to_words (LITTLENUM_TYPE * words, int precision, - long exponent_bits); -int had_err (void); -int ignore_input (void); -void cond_finish_check (int); -void cond_exit_macro (int); -int seen_at_least_1_file (void); -void app_pop (char *arg); -void as_howmuch (FILE * stream); -void as_perror (const char *gripe, const char *filename); -void as_where (char **namep, unsigned int *linep); -void bump_line_counters (void); -void do_scrub_begin (int); -void input_scrub_begin (void); -void input_scrub_close (void); -void input_scrub_end (void); -int new_logical_line (char *fname, int line_number); -void subsegs_begin (void); -void subseg_change (segT seg, int subseg); -segT subseg_new (const char *name, subsegT subseg); -segT subseg_force_new (const char *name, subsegT subseg); -void subseg_set (segT seg, subsegT subseg); +void as_assert (const char *, int, const char *); +void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; +void fprint_value (FILE *, addressT); +void sprint_value (char *, addressT); +int had_errors (void); +int had_warnings (void); +void as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); +void as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned); +void print_version_id (void); +char * app_push (void); +char * atof_ieee (char *, int, LITTLENUM_TYPE *); +char * input_scrub_include_file (char *, char *); +void input_scrub_insert_line (const char *); +void input_scrub_insert_file (char *); +char * input_scrub_new_file (char *); +char * input_scrub_next_buffer (char **bufp); +int do_scrub_chars (int (*get) (char *, int), char *, int); +int gen_to_words (LITTLENUM_TYPE *, int, long); +int had_err (void); +int ignore_input (void); +void cond_finish_check (int); +void cond_exit_macro (int); +int seen_at_least_1_file (void); +void app_pop (char *); +void as_howmuch (FILE *); +void as_perror (const char *, const char *); +void as_where (char **, unsigned int *); +void bump_line_counters (void); +void do_scrub_begin (int); +void input_scrub_begin (void); +void input_scrub_close (void); +void input_scrub_end (void); +int new_logical_line (char *, int); +void subsegs_begin (void); +void subseg_change (segT, int); +segT subseg_new (const char *, subsegT); +segT subseg_force_new (const char *, subsegT); +void subseg_set (segT, subsegT); +int subseg_text_p (segT); +void start_dependencies (char *); +void register_dependency (char *); +void print_dependencies (void); #ifdef BFD_ASSEMBLER -segT subseg_get (const char *, int); +segT subseg_get (const char *, int); #endif -int subseg_text_p (segT); -void start_dependencies (char *); -void register_dependency (char *); -void print_dependencies (void); struct expressionS; struct fix; @@ -620,12 +617,11 @@ int check_eh_frame (struct expressionS *, unsigned int *); int eh_frame_estimate_size_before_relax (fragS *); int eh_frame_relax_frag (fragS *); void eh_frame_convert_frag (fragS *); - int generic_force_reloc (struct fix *); #include "expr.h" /* Before targ-*.h */ -/* this one starts the chain of target dependant headers */ +/* This one starts the chain of target dependant headers. */ #include "targ-env.h" #ifdef OBJ_MAYBE_ELF @@ -660,9 +656,9 @@ COMMON int flag_m68k_mri; #endif #ifdef WARN_COMMENTS -COMMON int warn_comment; -COMMON unsigned int found_comment; -COMMON char *found_comment_file; +COMMON int warn_comment; +COMMON unsigned int found_comment; +COMMON char * found_comment_file; #endif #ifndef NUMBERS_WITH_SUFFIX diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index f7eeca7..68faf13 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -13699,7 +13699,6 @@ md_parse_option (c, arg) } } - as_bad (_("unrecognized option `-%c%s'"), c, arg ? arg : ""); return 0; } diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 65987d0..d9a59ca 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -7095,18 +7095,15 @@ md_parse_option (int c, char *arg) if (!strcmp (arg, archs[i].name)) break; if (i == n_archs) - { - unknown: - as_bad (_("unrecognized option `%s'"), oarg); - return 0; - } + return 0; + arch = archs[i].arch; if (arch == m68881) no_68881 = 1; else if (arch == m68851) no_68851 = 1; else - goto unknown; + return 0; } else { @@ -7119,6 +7116,7 @@ md_parse_option (int c, char *arg) if (!strcmp (arg, archs[i].name)) { unsigned long arch = archs[i].arch; + if (cpu_of_arch (arch)) /* It's a cpu spec. */ { diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c index 92023d1..f34adf6 100644 --- a/gas/config/tc-pdp11.c +++ b/gas/config/tc-pdp11.c @@ -1347,8 +1347,6 @@ md_parse_option (c, arg) break; } - as_bad ("unrecognized option `-%c%s'", c, arg ? arg : ""); - return 0; } diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index b1085ac..ed208ee 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -1169,21 +1169,14 @@ md_parse_option (c, arg) char *arg; { if (c != 'm') - { - if (c != 'a') - /* xgettext:c-format */ - fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg); - return 0; - } + return 0; if (strcmp (arg, "warn-signed-overflow") == 0) - { - warn_signed_overflows = TRUE; - } + warn_signed_overflows = TRUE; + else if (strcmp (arg, "warn-unsigned-overflow") == 0) - { - warn_unsigned_overflows = TRUE; - } + warn_unsigned_overflows = TRUE; + else if (strcmp (arg, "v850") == 0) { machine = 0; @@ -1211,11 +1204,7 @@ md_parse_option (c, arg) else if (strcmp (arg, "relax") == 0) v850_relax = 1; else - { - /* xgettext:c-format */ - fprintf (stderr, _("unknown command line option: -%c%s\n"), c, arg); - return 0; - } + return 0; return 1; } diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 800d447..89868c2 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -227,8 +227,8 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}. @smallexample @c man begin SYNOPSIS @value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{--alternate}] [@b{-D}] - [@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{--gstabs}] [@b{--gstabs+}] - [@b{--gdwarf2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}] + [@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}] [@b{--gstabs+}] + [@b{--gdwarf-2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}] [@b{--listing-lhs-width}=@var{NUM}] [@b{--listing-lhs-width2}=@var{NUM}] [@b{--listing-rhs-width}=@var{NUM}] [@b{--listing-cont-lines}=@var{NUM}] [@b{--keep-locals}] [@b{-o} @var{objfile}] [@b{-R}] [@b{--statistics}] [@b{-v}] @@ -479,6 +479,12 @@ indicates a hexadecimal value, and a leading @samp{0} indicates an octal value. ``fast''---skip whitespace and comment preprocessing (assume source is compiler output). +@item -g +@itemx --gen-debug +Generate debugging information for each assembler source line using whichever +debug format is preferred by the target. This currently means either STABS, +ECOFF or DWARF2. + @item --gstabs Generate stabs debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. @@ -490,7 +496,7 @@ debuggers crash or refuse to read your program. This may help debugging assembler code. Currently the only GNU extension is the location of the current working directory at assembling time. -@item --gdwarf2 +@item --gdwarf-2 Generate DWARF2 debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. Note---this option is only supported by some targets, not all of them. diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 6719bbf..1c3ad97 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -858,13 +858,17 @@ independent string passed to @code{getopt}. @code{md_longopts} is a passed to @code{getopt}; you may use @code{OPTION_MD_BASE}, defined in @file{as.h}, as the start of a set of long option indices, if necessary. @code{md_longopts_size} is a @code{size_t} holding the size @code{md_longopts}. + GAS will call @code{md_parse_option} whenever @code{getopt} returns an unrecognized code, presumably indicating a special code value which appears in -@code{md_longopts}. GAS will call @code{md_show_usage} when a usage message is -printed; it should print a description of the machine specific options. -@code{md_after_pase_args}, if defined, is called after all options are -processed, to let the backend override settings done by the generic option -parsing. +@code{md_longopts}. This function should return non-zero if it handled the +option and zero otherwise. There is no need to print a message about an option +not being recognised. This will be handled by the generic code. + +GAS will call @code{md_show_usage} when a usage message is printed; it should +print a description of the machine specific options. @code{md_after_pase_args}, +if defined, is called after all options are processed, to let the backend +override settings done by the generic option parsing. @item md_begin @cindex md_begin @@ -1520,6 +1524,20 @@ It should return the size of an address, as it should be represented in debugging info. If you don't define this macro, the default definition uses the number of bits per address, as defined in @var{bfd}, divided by 8. +@item MD_DEBUG_FORMAT_SELECTOR +@cindex MD_DEBUG_FORMAT_SELECTOR +If defined this macro is the name of a function to be called when the +@samp{--gen-debug} switch is detected on the assembler's command line. The +prototype for the function looks like this: + +@smallexample + enum debug_info_type MD_DEBUG_FORMAT_SELECTOR (int * use_gnu_extensions) +@end smallexample + +The function should return the debug format that is preferred by the CPU +backend. This format will be used when generating assembler specific debug +information. + @end table @node Object format backend @@ -43,70 +43,64 @@ struct relax_type typedef struct relax_type relax_typeS; -extern const int md_reloc_size; /* Size of a relocation record */ +extern const int md_reloc_size; /* Size of a relocation record. */ + +char * md_atof (int, char *, int *); +int md_parse_option (int, char *); +void md_show_usage (FILE *); +short tc_coff_fix2rtype (fixS *); +void md_assemble (char *); +void md_begin (void); +void md_number_to_chars (char *, valueT, int); +void md_apply_fix3 (fixS *, valueT *, segT); + -char *md_atof (int what_statement_type, char *literalP, int *sizeP); -#ifndef md_estimate_size_before_relax -int md_estimate_size_before_relax (fragS * fragP, segT segment); -#endif -int md_parse_option (int c, char *arg); -void md_show_usage (FILE *); -#ifndef md_pcrel_from -long md_pcrel_from (fixS * fixP); -#endif -short tc_coff_fix2rtype (fixS * fixP); -void md_assemble (char *str); -void md_begin (void); #ifndef md_create_long_jump -void md_create_long_jump (char *ptr, addressT from_addr, - addressT to_addr, fragS * frag, - symbolS * to_symbol); +void md_create_long_jump (char *, addressT, addressT, fragS *, symbolS *); #endif #ifndef md_create_short_jump -void md_create_short_jump (char *ptr, addressT from_addr, - addressT to_addr, fragS * frag, - symbolS * to_symbol); +void md_create_short_jump (char *, addressT, addressT, fragS *, symbolS *); +#endif +#ifndef md_pcrel_from +long md_pcrel_from (fixS *); #endif -void md_number_to_chars (char *buf, valueT val, int n); - #ifndef md_operand -void md_operand (expressionS * expressionP); +void md_operand (expressionS *); +#endif +#ifndef md_estimate_size_before_relax +int md_estimate_size_before_relax (fragS * fragP, segT); +#endif +#ifndef md_section_align +valueT md_section_align (segT, valueT); +#endif +#ifndef md_undefined_symbol +symbolS *md_undefined_symbol (char *); #endif - -void md_apply_fix3 (fixS *, valueT *, segT); #ifdef BFD_ASSEMBLER + #ifndef md_convert_frag -void md_convert_frag (bfd * headers, segT sec, fragS * fragP); +void md_convert_frag (bfd *, segT, fragS *); #endif #ifndef tc_headers_hook -void tc_headers_hook (segT *, fixS *); +void tc_headers_hook (segT *, fixS *); #endif #ifndef RELOC_EXPANSION_POSSIBLE extern arelent *tc_gen_reloc (asection *, fixS *); #else extern arelent **tc_gen_reloc (asection *, fixS *); #endif + #else /* not BFD_ASSEMBLER */ + #ifndef md_convert_frag -void md_convert_frag (object_headers * headers, segT, fragS * fragP); +void md_convert_frag (object_headers *, segT, fragS *); #endif - #ifndef tc_crawl_symbol_chain -void tc_crawl_symbol_chain (object_headers * headers); -#endif /* tc_crawl_symbol_chain */ - -#ifndef tc_headers_hook -void tc_headers_hook (object_headers * headers); -#endif /* tc_headers_hook */ -#endif /* BFD_ASSEMBLER */ - -#ifndef md_section_align -valueT md_section_align (segT seg, valueT size); +void tc_crawl_symbol_chain (object_headers *); #endif - -#ifndef md_undefined_symbol -symbolS *md_undefined_symbol (char *name); +#ifndef tc_headers_hook +void tc_headers_hook (object_headers *); #endif -/* end of tc.h */ +#endif /* BFD_ASSEMBLER */ |