This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][GAS] combine NUMBERS_WITH_SUFFIX with LOCAL_LABELS_FB (for z80)


hello,

The patch below allows the usage of backward references on 
targets with NUMBERS_WITH_SUFFIX. If NUMBERS_WITH_SUFFIX and 
LOCAL_LABELS_FB are both defined as 1, then suffix 'B' 
indicates a binary number and suffix 'b' indicates a backward 
reference to a local numeric label.
The Z80 target is currently the only one that has both 
NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB.

I added a testcase that covers all suffixes for Z80.

Arnold

ChangeLog:
* expr.c (integer_constant): Only match 'b' as binary suffix if 
LOCAL_LABELS_FB == 0.
* testsuite/gas/z80/z80.exp: Added "suffix" test.
* testsuite/gas/z80/suffix.s: New file.
* testsuite/gas/z80/suffix.d: New file.
Index: expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.60
diff -u -p -r1.60 expr.c
--- expr.c	11 Oct 2005 11:16:16 -0000	1.60
+++ expr.c	30 Oct 2005 19:10:24 -0000
@@ -301,7 +301,10 @@ integer_constant (int radix, expressionS
 	{
 	  c = *--suffix;
 	  c = TOUPPER (c);
-	  if (c == 'B')
+	  /* If we have both NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB,
+             we distinguish between 'B' and 'b'.  This is the case for
+             Z80.  */
+	  if ((LOCAL_LABELS_FB ? *suffix : c) == 'B')
 	    radix = 2;
 	  else if (c == 'D')
 	    radix = 10;
 
Index: testsuite/gas/z80/z80.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/z80/z80.exp,v
retrieving revision 1.2
diff -u -r1.2 z80.exp
--- testsuite/gas/z80/z80.exp	26 Oct 2005 01:32:25 -0000	1.2
+++ testsuite/gas/z80/z80.exp	30 Oct 2005 19:13:00 -0000
@@ -1,9 +1,10 @@
-# run targets for target Z80.
+# run tests for target Z80.
 
 if [istarget z80-*-*] then {
 # test redefinitions
     run_dump_test "redef"
 # test parsing of " and '
     run_dump_test "quotes"
-
+# test suffixes
+    run_dump_test "suffix"
 }

Attachment: testsuite/gas/z80/suffix.s
Description: Troff document

Attachment: testsuite/gas/z80/suffix.d
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]