aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-05-12 09:09:11 +0000
committerNick Clifton <nickc@redhat.com>2003-05-12 09:09:11 +0000
commite66c629e094cbd3923e2cd2962e07baa96ad7ee7 (patch)
tree91448349bc3f321c2f38d30c9e391923b2c29b36 /gas
parent9d29900bf7bbe2b1dead4ebec2352e8ccdc3fcb3 (diff)
downloadgdb-e66c629e094cbd3923e2cd2962e07baa96ad7ee7.zip
gdb-e66c629e094cbd3923e2cd2962e07baa96ad7ee7.tar.gz
gdb-e66c629e094cbd3923e2cd2962e07baa96ad7ee7.tar.bz2
Allow xstormy-elf-gas to handle "@fptr() - @fptr()" expressions.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-xstormy16.c25
2 files changed, 33 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 6ad7dbe..93718c0 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-12 Nick Clifton <nickc@redhat.com>
+
+ * config/tc-xstormy16.c (skipping_fptr): New local variable.
+ (md_assemble): Reset skipping_fptr.
+ (md_operand): If @fptr() is followed by a minus sign, set
+ skipping_fptr and ignore the fptr. If skipping_fptr is set and an
+ @fptr is detected, ignore it and reset skipping_fptr.
+
2003-05-11 Jason Eckhardt <jle@rice.edu>
* config/tc-i860.c (MAX_FIXUPS): Define.
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index 2c80b1a..0125856 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -104,6 +104,8 @@ md_begin ()
cgen_set_parse_operand_fn (gas_cgen_cpu_desc, gas_cgen_parse_operand);
}
+static bfd_boolean skipping_fptr = FALSE;
+
void
md_assemble (str)
char * str;
@@ -111,6 +113,10 @@ md_assemble (str)
xstormy16_insn insn;
char * errmsg;
+ /* Make sure that if we had an erroneous input line which triggered
+ the skipping_fptr boolean that it does not affect following lines. */
+ skipping_fptr = FALSE;
+
/* Initialize GAS's cgen interface for a new instruction. */
gas_cgen_init_parse ();
@@ -154,9 +160,28 @@ md_operand (e)
goto err;
}
input_line_pointer++;
+ SKIP_WHITESPACE ();
if (e->X_op != O_symbol)
as_bad ("Not a symbolic expression");
+ else if (* input_line_pointer == '-')
+ /* We are computing the difference of two function pointers
+ like this:
+
+ .hword @fptr (foo) - @fptr (bar)
+
+ In this situation we do not want to generate O_fptr_symbol
+ operands because the result is an absolute value, not a
+ function pointer.
+
+ We need to make the check here, rather than when the fixup
+ is generated as the function names (foo & bar in the above
+ example) might be local symbols and we want the expression
+ to be evaluated now. This kind of thing can happen when
+ gcc is generating computed gotos. */
+ skipping_fptr = TRUE;
+ else if (skipping_fptr)
+ skipping_fptr = FALSE;
else
e->X_op = O_fptr_symbol;
}