]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
2012-07-24 Sandra Loosemore <sandra@codesourcery.com>
authorSandra Loosemore <sandra@codesourcery.com>
Tue, 24 Jul 2012 16:38:31 +0000 (16:38 +0000)
committerSandra Loosemore <sandra@codesourcery.com>
Tue, 24 Jul 2012 16:38:31 +0000 (16:38 +0000)
    Jie Zhang  <jzhang918@gmail.com>

gas/
* config/tc-arm.c (md_apply_fix): Use encoding A2 of ADR
if offset is negative.

gas/testsuite/
* gas/arm/adr.d: New test.
* gas/arm/adr.s: New test.

gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/adr.d [new file with mode: 0644]
gas/testsuite/gas/arm/adr.s [new file with mode: 0644]

index ed60ccb353fc13072bb1f3d4ed2fe25378a7879c..f4bbc8d0fac5d0404999159779c33d6b0237af71 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-24  Sandra Loosemore  <sandra@codesourcery.com>
+           Jie Zhang  <jzhang918@gmail.com>
+
+       * config/tc-arm.c (md_apply_fix): Use encoding A2 of ADR
+       if offset is negative.
+
 2012-07-16  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>
 
        * config/tc-i386.c: Add ADX, RDSEED and PRFCHW asm directives.
index 004f7510341706dd50adc861e1bacb36939626bd..795a1b56173cf410f2d84dcb0bb46170d9375dbb 100644 (file)
@@ -20637,13 +20637,22 @@ md_apply_fix (fixS *  fixP,
            }
        }
 
-      newimm = encode_arm_immediate (value);
       temp = md_chars_to_number (buf, INSN_SIZE);
 
-      /* If the instruction will fail, see if we can fix things up by
-        changing the opcode.  */
-      if (newimm == (unsigned int) FAIL
-         && (newimm = negate_data_op (&temp, value)) == (unsigned int) FAIL)
+      /* If the offset is negative, we should use encoding A2 for ADR.  */
+      if ((temp & 0xfff0000) == 0x28f0000 && value < 0)
+       newimm = negate_data_op (&temp, value);
+      else
+       {
+         newimm = encode_arm_immediate (value);
+
+         /* If the instruction will fail, see if we can fix things up by
+            changing the opcode.  */
+         if (newimm == (unsigned int) FAIL)
+           newimm = negate_data_op (&temp, value);
+       }
+
+      if (newimm == (unsigned int) FAIL)
        {
          as_bad_where (fixP->fx_file, fixP->fx_line,
                        _("invalid constant (%lx) after fixup"),
index 756b9d2651b9ab108235c3dd95c24ba9e19af223..85968f89fc5417f7ef3f698f9ff899e02a916c63 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-24  Sandra Loosemore  <sandra@codesourcery.com>
+           Jie Zhang  <jzhang918@gmail.com>
+
+       * gas/arm/adr.d: New test.
+       * gas/arm/adr.s: New test.
+
 2012-07-16  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>
 
        * gas/i386/i386.exp: Run adx, rdseed and prefetchw tests.
diff --git a/gas/testsuite/gas/arm/adr.d b/gas/testsuite/gas/arm/adr.d
new file mode 100644 (file)
index 0000000..ee74154
--- /dev/null
@@ -0,0 +1,9 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: ADR
+
+# Test the `ADR' pseudo-op
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0+ <.*> 824ff203       subhi   pc, pc, #805306368      ; 0x30000000
diff --git a/gas/testsuite/gas/arm/adr.s b/gas/testsuite/gas/arm/adr.s
new file mode 100644 (file)
index 0000000..5d8ea2b
--- /dev/null
@@ -0,0 +1,5 @@
+       @ test ADR pseudo-op
+       .text
+       .global foo
+foo:
+       adrhi   pc, . - 0x2ffffff8