From 1b10f50d907cd4018cbbfecb752022896abdb85a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 11 Dec 1995 19:23:10 +0000 Subject: [PATCH] * read.c (read_a_source_file): If tc_unrecognized_line is defined, call it. * config/tc-a29k.h (tc_unrecognized_line): Define. * config/tc-a29k.c (a29k_unrecognized_line): New function. (md_operand): Handle a29k style local dollar labels. --- gas/ChangeLog | 8 ++++++ gas/config/tc-a29k.c | 68 +++++++++++++++++++++++++++++++++++++++++++- gas/config/tc-a29k.h | 3 ++ 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 5a4261039dc..2d14562b354 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +Mon Dec 11 14:14:08 1995 Ian Lance Taylor + + * read.c (read_a_source_file): If tc_unrecognized_line is defined, + call it. + * config/tc-a29k.h (tc_unrecognized_line): Define. + * config/tc-a29k.c (a29k_unrecognized_line): New function. + (md_operand): Handle a29k style local dollar labels. + Wed Dec 6 17:52:52 1995 Ian Lance Taylor * config/obj-multi.h: If OBJ_MAYBE_ELF, define OBJ_SYMFIELD_TYPE. diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c index 4c24f9e52a1..4c3ede1195b 100644 --- a/gas/config/tc-a29k.c +++ b/gas/config/tc-a29k.c @@ -1081,6 +1081,48 @@ md_show_usage (stream) { } +/* This is called when a line is unrecognized. This is used to handle + definitions of a29k style local labels. */ + +int +a29k_unrecognized_line (c) + int c; +{ + int lab; + char *s; + + if (c != '$' + || ! isdigit ((unsigned char) input_line_pointer[0])) + return 0; + + s = input_line_pointer; + + lab = 0; + while (isdigit ((unsigned char) *s)) + { + lab = lab * 10 + *s - '0'; + ++s; + } + + if (*s != ':') + { + /* Not a label definition. */ + return 0; + } + + if (dollar_label_defined (lab)) + { + as_bad ("label \"$%d\" redefined", lab); + return 0; + } + + define_dollar_label (lab); + colon (dollar_label_name (lab, 0)); + input_line_pointer = s + 1; + + return 1; +} + /* Default the values of symbols known that should be "predefined". We don't bother to predefine them unless you actually use one, since there are a lot of them. */ @@ -1158,6 +1200,31 @@ md_operand (expressionP) else expressionP->X_op = O_constant; } + else if (input_line_pointer[0] == '$' + && isdigit ((unsigned char) input_line_pointer[1])) + { + long lab; + char *name; + symbolS *sym; + + /* This is a local label. */ + ++input_line_pointer; + lab = (long) get_absolute_expression (); + if (dollar_label_defined (lab)) + { + name = dollar_label_name (lab, 0); + sym = symbol_find (name); + } + else + { + name = dollar_label_name (lab, 1); + sym = symbol_find_or_make (name); + } + + expressionP->X_op = O_symbol; + expressionP->X_add_symbol = sym; + expressionP->X_add_number = 0; + } else if (input_line_pointer[0] == '$') { char *s; @@ -1193,7 +1260,6 @@ md_operand (expressionP) } else { - /* FIXME: We should handle a29k local labels here. */ return; } diff --git a/gas/config/tc-a29k.h b/gas/config/tc-a29k.h index 1c36f07fc99..a63864f3013 100644 --- a/gas/config/tc-a29k.h +++ b/gas/config/tc-a29k.h @@ -23,6 +23,9 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #define LEX_DOLLAR 1 +#define tc_unrecognized_line(c) a29k_unrecognized_line (c) +extern int a29k_unrecognized_line PARAMS ((int)); + #define tc_headers_hook(a) ; /* not used */ #define tc_headers_hook(a) ; /* not used */ #define tc_crawl_symbol_chain(a) ; /* not used */ -- 2.30.2