From: Doug Evans Date: Mon, 1 Jun 1998 04:44:48 +0000 (+0000) Subject: Implement .func/.endfunc pseudo-ops. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=082a41fc7ce534b95032a9c376240854a3dd0cc4;p=binutils-gdb.git Implement .func/.endfunc pseudo-ops. * read.h (stabs_generate_asm_func,stabs_generate_asm_endfunc): Declare. (s_func): Declare. * read.c (potable): Add .func,.endfunc. (s_func): New function. * stabs.c (stabs_generate_asm_func,stabs_generate_asm_endfunc): New functions. (in_doc_func_p,current_function_label): New static globals. (stabs_generate_asm_lineno): Emit function relative stabs if in .func. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 921be527292..825fa224212 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,6 +1,16 @@ -start-sanitize-sky Sun May 31 15:43:06 1998 Doug Evans + Implement .func/.endfunc pseudo-ops. + * read.h (stabs_generate_asm_func,stabs_generate_asm_endfunc): Declare. + (s_func): Declare. + * read.c (potable): Add .func,.endfunc. + (s_func): New function. + * stabs.c (stabs_generate_asm_func,stabs_generate_asm_endfunc): New + functions. + (in_doc_func_p,current_function_label): New static globals. + (stabs_generate_asm_lineno): Emit function relative stabs if in .func. + +start-sanitize-sky * config/tc-dvp.h (ELF_TC_SPECIAL_SECTIONS): Delete .vuoverlay_table. (VUOVERLAY_SECTION_PREFIX,VUOVERLAY_TABLE_SECTION_NAME): Delete. * config/tc-dvp.c (vuoverlay_string_section): New static global. diff --git a/gas/read.c b/gas/read.c index 5f63d3f5de1..f4746dc715f 100644 --- a/gas/read.c +++ b/gas/read.c @@ -296,6 +296,7 @@ static const pseudo_typeS potable[] = {"elsec", s_else, 0}, {"end", s_end, 0}, {"endc", s_endif, 0}, + {"endfunc", s_func, 1}, {"endif", s_endif, 0}, /* endef */ {"equ", s_set, 0}, @@ -311,6 +312,7 @@ static const pseudo_typeS potable[] = {"fill", s_fill, 0}, {"float", float_cons, 'f'}, {"format", s_ignore, 0}, + {"func", s_func, 0}, {"global", s_globl, 0}, {"globl", s_globl, 0}, {"hword", cons, 2}, @@ -4871,7 +4873,7 @@ add_include_dir (path) if (i > include_dir_maxlen) include_dir_maxlen = i; } /* add_include_dir() */ - + /* Output debugging information to denote the source file. */ static void @@ -4912,6 +4914,75 @@ generate_lineno_debug () #endif } +/* Output debugging information to mark a function entry point or end point. + END_P is zero for .func, and non-zero for .endfunc. */ + +void +s_func (end_p) + int end_p; +{ + /* Record the current function so that we can issue an error message for + misplaced .func,.endfunc, and also so that .endfunc needs no + arguments. */ + static char *current_name; + static char *current_label; + + if (end_p) + { + if (current_name == NULL) + { + as_bad (_("missing .func")); + ignore_rest_of_line (); + return; + } + + if (debug_type == DEBUG_STABS) + stabs_generate_asm_endfunc (current_name, current_label); + + current_name = current_label = NULL; + } + else /* ! end_p */ + { + char *name,*label; + char delim1,delim2; + + if (current_name != NULL) + { + as_bad (_(".endfunc missing for previous .func")); + ignore_rest_of_line (); + return; + } + + name = input_line_pointer; + delim1 = get_symbol_end (); + name = xstrdup (name); + *input_line_pointer = delim1; + SKIP_WHITESPACE (); + if (*input_line_pointer != ',') + { + /* Missing entry point, use function's name. */ + label = name; + } + else + { + ++input_line_pointer; + SKIP_WHITESPACE (); + label = input_line_pointer; + delim2 = get_symbol_end (); + label = xstrdup (label); + *input_line_pointer = delim2; + } + + if (debug_type == DEBUG_STABS) + stabs_generate_asm_func (name, label); + + current_name = name; + current_label = label; + } + + demand_empty_rest_of_line (); +} + void s_ignore (arg) int arg; diff --git a/gas/read.h b/gas/read.h index 674d50fc76e..feae295ecc6 100644 --- a/gas/read.h +++ b/gas/read.h @@ -1,5 +1,6 @@ /* read.h - of read.c - Copyright (C) 1986, 90, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + Copyright (C) 1986, 90, 92, 93, 94, 95, 96, 1997 + Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -58,6 +59,11 @@ extern const char comment_chars[]; extern const char line_comment_chars[]; extern const char line_separator_chars[]; +/* Table of -I directories. */ +extern char **include_dirs; +extern int include_dir_count; +extern int include_dir_maxlen; + /* The offset in the absolute section. */ extern addressT abs_section_offset; @@ -102,7 +108,10 @@ extern void read_a_source_file PARAMS ((char *name)); extern void read_begin PARAMS ((void)); extern void read_print_statistics PARAMS ((FILE *)); extern int sizeof_leb128 PARAMS ((valueT, int sign)); +extern void stabs_generate_asm_file PARAMS ((void)); extern void stabs_generate_asm_lineno PARAMS ((void)); +extern void stabs_generate_asm_func PARAMS ((const char *, const char *)); +extern void stabs_generate_asm_endfunc PARAMS ((const char *, const char *)); extern void s_abort PARAMS ((int)); extern void s_align_bytes PARAMS ((int arg)); @@ -119,6 +128,7 @@ extern void s_err PARAMS ((int)); extern void s_fail PARAMS ((int)); extern void s_fill PARAMS ((int)); extern void s_float_space PARAMS ((int mult)); +extern void s_func PARAMS ((int)); extern void s_globl PARAMS ((int arg)); extern void s_if PARAMS ((int arg)); extern void s_ifc PARAMS ((int arg)); @@ -128,6 +138,7 @@ extern void s_ignore PARAMS ((int arg)); extern void s_include PARAMS ((int arg)); extern void s_irp PARAMS ((int arg)); extern void s_lcomm PARAMS ((int needs_align)); +extern void s_lcomm_bytes PARAMS ((int needs_align)); extern void s_leb128 PARAMS ((int sign)); extern void s_linkonce PARAMS ((int)); extern void s_lsym PARAMS ((int));