From 6844b2c2db8ce07c7f000d9bd132d6b9b83709b8 Mon Sep 17 00:00:00 2001 From: Matthew Gretton-Dann Date: Mon, 27 Sep 2010 09:47:05 +0000 Subject: [PATCH] 2010-09-27 Tejas Belagod * gas/config/tc-arm.c (do_neon_ldr_str): Deprecate ARM-mode PC-relative VSTR, issue an error in THUMB mode. * opcodes/arm_dis.c (print_insn_coprocessor): Apply off-by-alignment correction to unaligned PCs while printing comment. * gas/testsuite/gas/arm/vldr.s: New test for pc-relative VLDR disassembly comment. * gas/testsuite/gas/arm/vldr.d: Likewise. * gas/testsuite/gas/arm/vstr-bad.s: New test for PC-relative VSTR. * gas/testsuite/gas/arm/vstr-thumb-bad.l: Likewise. * gas/testsuite/gas/arm/vstr-thumb-bad.d: Likewise. * gas/testsuite/gas/arm/vstr-arm-bad.l: Likewise. * gas/testsuite/gas/arm/vstr-arm-bad.d: Likewise. --- gas/ChangeLog | 5 +++++ gas/config/tc-arm.c | 12 ++++++++++++ gas/testsuite/ChangeLog | 10 ++++++++++ gas/testsuite/gas/arm/vldr.d | 15 +++++++++++++++ gas/testsuite/gas/arm/vldr.s | 10 ++++++++++ gas/testsuite/gas/arm/vstr-arm-bad.d | 4 ++++ gas/testsuite/gas/arm/vstr-arm-bad.l | 3 +++ gas/testsuite/gas/arm/vstr-bad.s | 12 ++++++++++++ gas/testsuite/gas/arm/vstr-thumb-bad.d | 4 ++++ gas/testsuite/gas/arm/vstr-thumb-bad.l | 3 +++ opcodes/ChangeLog | 5 +++++ opcodes/arm-dis.c | 8 ++++++-- 12 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 gas/testsuite/gas/arm/vldr.d create mode 100644 gas/testsuite/gas/arm/vldr.s create mode 100644 gas/testsuite/gas/arm/vstr-arm-bad.d create mode 100644 gas/testsuite/gas/arm/vstr-arm-bad.l create mode 100644 gas/testsuite/gas/arm/vstr-bad.s create mode 100644 gas/testsuite/gas/arm/vstr-thumb-bad.d create mode 100644 gas/testsuite/gas/arm/vstr-thumb-bad.l diff --git a/gas/ChangeLog b/gas/ChangeLog index 2f1685a329c..b9d7363092d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2010-09-27 Tejas Belagod + + * config/tc-arm.c (do_neon_ldr_str): Deprecate ARM-mode PC-relative + VSTR, issue an error in THUMB mode. + 2010-09-23 Matthew Gretton-Dann * config/tc-arm.c (arm_ext_virt): New variable. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index e4bd9f1704e..fc3d63d5e52 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -14885,6 +14885,18 @@ do_neon_ldr_str (void) { int is_ldr = (inst.instruction & (1 << 20)) != 0; + /* Use of PC in vstr in ARM mode is deprecated in ARMv7. + And is UNPREDICTABLE in thumb mode. */ + if (!is_ldr + && inst.operands[1].reg == REG_PC + && ARM_CPU_HAS_FEATURE (selected_cpu, arm_ext_v7)) + { + if (!thumb_mode && warn_on_deprecated) + as_warn (_("Use of PC here is deprecated")); + else + inst.error = _("Use of PC here is UNPREDICTABLE"); + } + if (inst.operands[0].issingle) { if (is_ldr) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 038c561577a..14524c681e9 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2010-09-27 Tejas Belagod + + * gas/arm/vldr.s: New test for pc-relative VLDR disassembly comment. + * gas/arm/vldr.d: Likewise. + * gas/arm/vstr-bad.s: New test for PC-relative VSTR. + * gas/arm/vstr-thumb-bad.l: Likewise. + * gas/arm/vstr-thumb-bad.d: Likewise. + * gas/arm/vstr-arm-bad.l: Likewise. + * gas/arm/vstr-arm-bad.d: Likewise. + 2010-09-23 Matthew Gretton-Dann * gas/arm/armv7-a+virt.d: New test. diff --git a/gas/testsuite/gas/arm/vldr.d b/gas/testsuite/gas/arm/vldr.d new file mode 100644 index 00000000000..d5c93316671 --- /dev/null +++ b/gas/testsuite/gas/arm/vldr.d @@ -0,0 +1,15 @@ +# name: VFP VLDR +# as: -mfpu=vfp3 -mcpu=cortex-a8 -mthumb +# source: vldr.s +# objdump: -dr --prefix-addresses --show-raw-insn + +.*: +file format .*arm.* + +Disassembly of section .text: +0[0-9a-f]+ <[^>]+> bf00 nop +0[0-9a-f]+ <[^>]+> ed9f 0b03 vldr d0, \[pc, #12\] ; 00000010 +0[0-9a-f]+ <[^>]+> ed9f 0b02 vldr d0, \[pc, #8\] ; 00000010 +0[0-9a-f]+ <[^>]+> bf00 nop +0[0-9a-f]+ <[^>]+> bf00 nop +0[0-9a-f]+ <[^>]+> bf00 nop + ... diff --git a/gas/testsuite/gas/arm/vldr.s b/gas/testsuite/gas/arm/vldr.s new file mode 100644 index 00000000000..86bc82eb1bf --- /dev/null +++ b/gas/testsuite/gas/arm/vldr.s @@ -0,0 +1,10 @@ +.syntax unified +.text + nop + vldr d0, float + vldr d0, float + nop + nop + +.align +float: .double 0.0 diff --git a/gas/testsuite/gas/arm/vstr-arm-bad.d b/gas/testsuite/gas/arm/vstr-arm-bad.d new file mode 100644 index 00000000000..32a041f6445 --- /dev/null +++ b/gas/testsuite/gas/arm/vstr-arm-bad.d @@ -0,0 +1,4 @@ +# name: VFP PC-relative VSTR arm mode +# as: -mfpu=vfp3 -mcpu=cortex-a8 +# source: vstr-bad.s +# error-output: vstr-arm-bad.l diff --git a/gas/testsuite/gas/arm/vstr-arm-bad.l b/gas/testsuite/gas/arm/vstr-arm-bad.l new file mode 100644 index 00000000000..0d4832785a2 --- /dev/null +++ b/gas/testsuite/gas/arm/vstr-arm-bad.l @@ -0,0 +1,3 @@ +[^:]*: Assembler messages: +[^:]*:6: Warning: Use of PC here is deprecated +[^:]*:7: Warning: Use of PC here is deprecated diff --git a/gas/testsuite/gas/arm/vstr-bad.s b/gas/testsuite/gas/arm/vstr-bad.s new file mode 100644 index 00000000000..f5a136543e4 --- /dev/null +++ b/gas/testsuite/gas/arm/vstr-bad.s @@ -0,0 +1,12 @@ + +.syntax unified +.text + + nop + vstr d0, float + vstr d0, [pc, #4] + nop + nop + +.align +float: .double 0.0 diff --git a/gas/testsuite/gas/arm/vstr-thumb-bad.d b/gas/testsuite/gas/arm/vstr-thumb-bad.d new file mode 100644 index 00000000000..798f16d5bf0 --- /dev/null +++ b/gas/testsuite/gas/arm/vstr-thumb-bad.d @@ -0,0 +1,4 @@ +# name: VFP PC-relative VSTR thumb mode +# as: -mfpu=vfp3 -mthumb -mcpu=cortex-a8 +# source: vstr-bad.s +# error-output: vstr-thumb-bad.l diff --git a/gas/testsuite/gas/arm/vstr-thumb-bad.l b/gas/testsuite/gas/arm/vstr-thumb-bad.l new file mode 100644 index 00000000000..1660fbfd336 --- /dev/null +++ b/gas/testsuite/gas/arm/vstr-thumb-bad.l @@ -0,0 +1,3 @@ +[^:]*: Assembler messages: +[^:]*:6: Error: Use of PC here is UNPREDICTABLE -- `vstr d0,float' +[^:]*:7: Error: Use of PC here is UNPREDICTABLE -- `vstr d0,\[pc,#4\]' diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 8a23f7ec06b..76883575fca 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2010-09-27 Tejas Belagod + + * arm_dis.c (print_insn_coprocessor): Apply off-by-alignment + correction to unaligned PCs while printing comment. + 2010-09-23 Matthew Gretton-Dann * arm-dis.c (arm_opcodes): Add Virtualiztion Extensions support. diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 3dfbf5c5415..b8d02e55dce 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -1910,8 +1910,12 @@ print_insn_coprocessor (bfd_vma pc, if (rn == 15 && (PRE_BIT_SET || WRITEBACK_BIT_SET)) { func (stream, "\t; "); - info->print_address_func (offset + pc - + info->bytes_per_chunk * 2, info); + /* For unaligned PCs, apply off-by-alignment + correction. */ + info->print_address_func (offset + pc + + info->bytes_per_chunk * 2 + - (pc & 3), + info); } } break; -- 2.30.2