aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-12-11 19:23:10 +0000
committerIan Lance Taylor <ian@airs.com>1995-12-11 19:23:10 +0000
commit1b10f50d907cd4018cbbfecb752022896abdb85a (patch)
tree5d496872719947d7f7a114eba63513b486513eb0 /gas
parent32d067978fad2d73fb7e0010f5108b5262831bb4 (diff)
downloadgdb-1b10f50d907cd4018cbbfecb752022896abdb85a.zip
gdb-1b10f50d907cd4018cbbfecb752022896abdb85a.tar.gz
gdb-1b10f50d907cd4018cbbfecb752022896abdb85a.tar.bz2
* 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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-a29k.c68
-rw-r--r--gas/config/tc-a29k.h3
3 files changed, 78 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5a42610..2d14562 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+Mon Dec 11 14:14:08 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * 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 <ian@cygnus.com>
* 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 4c24f9e..4c3ede1 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 1c36f07..a63864f 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 */