]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Backport from trunk for PR gas/12269
authorArnold Metselaar <arnold.metselaar@planet.nl>
Mon, 6 Dec 2010 23:05:57 +0000 (23:05 +0000)
committerArnold Metselaar <arnold.metselaar@planet.nl>
Mon, 6 Dec 2010 23:05:57 +0000 (23:05 +0000)
 * config/tc-z80.c (emit_mx, emit_ldxhl): Do not use
   symbol_get_value_expression on a symbol that may not yet have
   a value.
 * testsuite/gas/z80/atend.s: New file, test case for bug 12269,
   provided by Chris Smith.
 * testsuite/gas/z80/atend.d: New file, expected results for atend.s.
 * testsuite/gas/z80/z80.exp: Run new test case.

gas/ChangeLog
gas/config/tc-z80.c
gas/testsuite/gas/z80/z80.exp

index 8038f762fd368b24b39cd5fb652569c9e3954c11..8cf8c147b14d1a94d07269fe88bde6cabbd7a315 100644 (file)
@@ -1,3 +1,14 @@
+2010-12-07  Arnold Metselaar  <arnold.metselaar@planet.nl>
+
+       Backport from trunk for PR gas/12269
+       * config/tc-z80.c (emit_mx, emit_ldxhl): Do not use
+        symbol_get_value_expression on a symbol that may not yet have
+        a value.
+        * testsuite/gas/z80/atend.s: New file, test case for bug 12269,
+        provided by Chris Smith.
+        * testsuite/gas/z80/atend.d: New file, expected results for atend.s.
+        * testsuite/gas/z80/z80.exp: Run new test case.
+
 2010-11-30  Joel Sherrill  <joel.sherrill@oarcorp.com>
 
        * configure.tgt: Add sparc64-rtems.
index e2ea462a52eb82bf2ecf20e78893249bcabe084b..7c13fa77886b158c004b654b149b55214e52eaa9 100644 (file)
@@ -769,8 +769,12 @@ emit_mx (char prefix, char opcode, int shift, expressionS * arg)
       q = frag_more (2);
       *q++ = (rnum & R_IX) ? 0xDD : 0xFD;
       *q = (prefix) ? prefix : (opcode + (6 << shift));
-      emit_byte (symbol_get_value_expression (arg->X_add_symbol),
-                BFD_RELOC_Z80_DISP8);
+      {
+       expressionS offset = *arg;
+       offset.X_op = O_symbol;
+       offset.X_add_number = 0;
+       emit_byte (&offset, BFD_RELOC_Z80_DISP8);
+      }
       if (prefix)
        {
          q = frag_more (1);
@@ -1598,8 +1602,13 @@ emit_ld (char prefix_in ATTRIBUTE_UNUSED, char opcode_in ATTRIBUTE_UNUSED,
   switch (dst.X_op)
     {
     case O_md1:
-      emit_ldxhl ((dst.X_add_number & R_IX) ? 0xDD : 0xFD, 0x70,
-                 &src, symbol_get_value_expression (dst.X_add_symbol));
+      {
+        expressionS dst_offset = dst;
+       dst_offset.X_op = O_symbol;
+       dst_offset.X_add_number = 0;
+       emit_ldxhl ((dst.X_add_number & R_IX) ? 0xDD : 0xFD, 0x70,
+                   &src, &dst_offset);
+      }
       break;
 
     case O_register:
index 0cb844031ae3c04f3b82ff4221e278772ba6188e..43a3360ea603ad2458f95b394b442f3fa6656795 100644 (file)
@@ -11,6 +11,8 @@ if [istarget z80-*-*] then {
     run_dump_test "suffix"
 # test assembling and disassembling instructions involving offsets
     run_dump_test "offset"
+# test assembling instruction with offset that is a label defined later
+    run_dump_test "atend"
 # test for data transfer instructions
     run_dump_test "ld-group"
 # test for block instructions