This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] tc-h8300.c: Don't output a wrong warning.
- From: Kazu Hirata <kazu at hxi dot com>
- To: binutils at sources dot redhat dot com
- Subject: [patch] tc-h8300.c: Don't output a wrong warning.
Hi,
Attached is a patch to eliminate a wrong warning in h8300 port.
When the following line is assembled, h8300-hms-gas outputs "out of
range" warning.
mov.w r2,@0xff8000:16
In h8 assembly language, when address:16 is given, the effective
address is computed as follows.
0x000000 + address if 0x0000 <= address <= 0x7fff
0xff0000 + address if 0x8000 <= address <= 0xffff
People often give full 24-bit address like 0xff8000 and expect it to
be trancated to 0x8000. The patch eliminates the warning when the
trancation is done correctly.
Tested on the h8300 port. OK to apply?
Kazu Hirata
2002-01-18 Kazu Hirata <kazu@hxi.com>
* config/tc-h8300.c (check_operand): Don't print a warning
when a valid 24-bit address is given to a 16-bit address
operand.
Index: tc-h8300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-h8300.c,v
retrieving revision 1.18
diff -u -p -r1.18 tc-h8300.c
--- tc-h8300.c 2001/11/15 21:28:55 1.18
+++ tc-h8300.c 2002/01/18 16:34:19
@@ -813,6 +813,14 @@ check_operand (operand, width, string)
fit a 16 bit address truncated into an 8 bit address
of something like bset. */
}
+ else if (strcmp (string, "@") == 0
+ && width == 0xffff
+ && (operand->exp.X_add_number & 0xff8000) == 0xff8000)
+ {
+ /* Just ignore this one - which happens when trying to
+ fit a 24 bit address truncated into a 16 bit address
+ of something like mov.w. */
+ }
else
{
as_warn (_("operand %s0x%lx out of range."), string,