From 4755303e509dc866cb7fd26e9a27c159acffe30d Mon Sep 17 00:00:00 2001 From: Will Newton Date: Thu, 21 Mar 2013 18:39:35 +0000 Subject: [PATCH] gas/ChangeLog: 2013-03-21 Will Newton * config/tc-arm.c (encode_thumb32_addr_mode): Emit an error for all pc-relative str instructions in Thumb mode. gas/testsuite/ChangeLog: 2013-03-21 Will Newton * gas/arm/thumb2_relax.d: Strip out invalid pc-relative strs. * gas/arm/thumb2_relax.s: Likewise. * gas/arm/thumb32.d: Likewise. * gas/arm/thumb32.l: Likewise. * gas/arm/thumb32.s: Likewise. * gas/arm/thumb2_str-bad.d: New file. * gas/arm/thumb2_str-bad.l: Likewise. * gas/arm/thumb2_str-bad.s: Likewise. --- gas/ChangeLog | 5 ++ gas/config/tc-arm.c | 4 +- gas/testsuite/ChangeLog | 11 +++++ gas/testsuite/gas/arm/thumb2_relax.d | 73 +++++----------------------- gas/testsuite/gas/arm/thumb2_relax.s | 6 --- gas/testsuite/gas/arm/thumb32.d | 41 ++++++++-------- gas/testsuite/gas/arm/thumb32.l | 8 +-- gas/testsuite/gas/arm/thumb32.s | 1 - 8 files changed, 53 insertions(+), 96 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index c36941ae7eb..f60fd45f422 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2013-03-21 Will Newton + + * config/tc-arm.c (encode_thumb32_addr_mode): Emit an error for all + pc-relative str instructions in Thumb mode. + 2013-03-21 Michael Schewe * config/tc-h8300.c (do_a_fix_imm): Add relaxation of mov diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index ee09e1472b8..f883b8692b7 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -9471,8 +9471,8 @@ encode_thumb32_addr_mode (int i, bfd_boolean is_t, bfd_boolean is_d) constraint (is_pc && inst.operands[i].writeback, BAD_PC_WRITEBACK); constraint (is_t && inst.operands[i].writeback, _("cannot use writeback with this instruction")); - constraint (is_pc && ((inst.instruction & THUMB2_LOAD_BIT) == 0) - && !inst.reloc.pc_rel, BAD_PC_ADDRESSING); + constraint (is_pc && ((inst.instruction & THUMB2_LOAD_BIT) == 0), + BAD_PC_ADDRESSING); if (is_d) { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 622037e7ab1..29fe5cdec7b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2013-03-21 Will Newton + + * gas/arm/thumb2_relax.d: Strip out invalid pc-relative strs. + * gas/arm/thumb2_relax.s: Likewise. + * gas/arm/thumb32.d: Likewise. + * gas/arm/thumb32.l: Likewise. + * gas/arm/thumb32.s: Likewise. + * gas/arm/thumb2_str-bad.d: New file. + * gas/arm/thumb2_str-bad.l: Likewise. + * gas/arm/thumb2_str-bad.s: Likewise. + 2013-03-20 Alexis Deruelle PR gas/15082 diff --git a/gas/testsuite/gas/arm/thumb2_relax.d b/gas/testsuite/gas/arm/thumb2_relax.d index e99d55c839f..53483a7873f 100644 --- a/gas/testsuite/gas/arm/thumb2_relax.d +++ b/gas/testsuite/gas/arm/thumb2_relax.d @@ -91,65 +91,14 @@ Disassembly of section .text: 0+12e <[^>]+> f85f 1036 ldr.w r1, \[pc, #-54\] ; 0+0fa <[^>]+> 0+132 <[^>]+> bf00 nop 0+134 <[^>]+> bf00 nop -0+136 <[^>]+> 7029 strb r1, \[r5, #0\] -0+138 <[^>]+> f885 1023 strb.w r1, \[r5, #35\].* -0+13c <[^>]+> 77e9 strb r1, \[r5, #31\] -0+13e <[^>]+> f885 101f strb.w r1, \[r5, #31\] -0+142 <[^>]+> f805 1c1f strb.w r1, \[r5, #-31\] -0+146 <[^>]+> f805 1b1f strb.w r1, \[r5\], #31 -0+14a <[^>]+> f805 1b1f strb.w r1, \[r5\], #31 -0+14e <[^>]+> f805 1f1f strb.w r1, \[r5, #31\]! -0+152 <[^>]+> f805 1d1f strb.w r1, \[r5, #-31\]! -0+156 <[^>]+> 5529 strb r1, \[r5, r4\] -0+158 <[^>]+> f809 100c strb.w r1, \[r9, ip\] -0+15c <[^>]+> f88f 1010 strb.w r1, \[pc, #16\] ; 0+170 <[^>]+> -0+160 <[^>]+> f88f 100c strb.w r1, \[pc, #12\] ; 0+170 <[^>]+> -0+164 <[^>]+> f88f 8008 strb.w r8, \[pc, #8\] ; 0+170 <[^>]+> -0+168 <[^>]+> f88f 1006 strb.w r1, \[pc, #6\] ; 0+172 <[^>]+> -0+16c <[^>]+> f80f 103a strb.w r1, \[pc, #-58\] ; 0+136 <[^>]+> -0+170 <[^>]+> bf00 nop -0+172 <[^>]+> 8029 strh r1, \[r5, #0\] -0+174 <[^>]+> f8a5 1042 strh.w r1, \[r5, #66\].* -0+178 <[^>]+> 87e9 strh r1, \[r5, #62\].* -0+17a <[^>]+> f8a5 103e strh.w r1, \[r5, #62\].* -0+17e <[^>]+> f825 1c3e strh.w r1, \[r5, #-62\].* -0+182 <[^>]+> f825 1b3e strh.w r1, \[r5\], #62.* -0+186 <[^>]+> f825 1b3e strh.w r1, \[r5\], #62.* -0+18a <[^>]+> f825 1f3e strh.w r1, \[r5, #62\]!.* -0+18e <[^>]+> f825 1d3e strh.w r1, \[r5, #-62\]!.* -0+192 <[^>]+> 5329 strh r1, \[r5, r4\] -0+194 <[^>]+> f829 100c strh.w r1, \[r9, ip\] -0+198 <[^>]+> f8af 1010 strh.w r1, \[pc, #16\] ; 0+1ac <[^>]+> -0+19c <[^>]+> f8af 100c strh.w r1, \[pc, #12\] ; 0+1ac <[^>]+> -0+1a0 <[^>]+> f8af 8008 strh.w r8, \[pc, #8\] ; 0+1ac <[^>]+> -0+1a4 <[^>]+> f8af 1006 strh.w r1, \[pc, #6\] ; 0+1ae <[^>]+> -0+1a8 <[^>]+> f82f 103a strh.w r1, \[pc, #-58\] ; 0+172 <[^>]+> -0+1ac <[^>]+> bf00 nop -0+1ae <[^>]+> 6029 str r1, \[r5, #0\] -0+1b0 <[^>]+> f8c5 1080 str.w r1, \[r5, #128\].* -0+1b4 <[^>]+> 67e9 str r1, \[r5, #124\].* -0+1b6 <[^>]+> f8c5 107c str.w r1, \[r5, #124\].* -0+1ba <[^>]+> f845 1c7c str.w r1, \[r5, #-124\].* -0+1be <[^>]+> f845 1b7c str.w r1, \[r5\], #124.* -0+1c2 <[^>]+> f845 1b7c str.w r1, \[r5\], #124.* -0+1c6 <[^>]+> f845 1f7c str.w r1, \[r5, #124\]!.* -0+1ca <[^>]+> f845 1d7c str.w r1, \[r5, #-124\]!.* -0+1ce <[^>]+> 5129 str r1, \[r5, r4\] -0+1d0 <[^>]+> f849 100c str.w r1, \[r9, ip\] -0+1d4 <[^>]+> f8cf 1010 str.w r1, \[pc, #16\] ; 0+1e8 <[^>]+> -0+1d8 <[^>]+> f8cf 100c str.w r1, \[pc, #12\] ; 0+1e8 <[^>]+> -0+1dc <[^>]+> f8cf 8008 str.w r8, \[pc, #8\] ; 0+1e8 <[^>]+> -0+1e0 <[^>]+> f8cf 1006 str.w r1, \[pc, #6\] ; 0+1ea <[^>]+> -0+1e4 <[^>]+> f84f 103a str.w r1, \[pc, #-58\] ; 0+1ae <[^>]+> -0+1e8 <[^>]+> bf00 nop -0+1ea <[^>]+> a104 add r1, pc, #16 ; \(adr r1, 0+1fc <[^>]+>\) -0+1ec <[^>]+> f20f 010c addw r1, pc, #12 -0+1f0 <[^>]+> f20f 0808 addw r8, pc, #8 -0+1f4 <[^>]+> f20f 0106 addw r1, pc, #6 -0+1f8 <[^>]+> f2af 0112 subw r1, pc, #18 -0+1fc <[^>]+> bf00 nop -0+1fe <[^>]+> bf00 nop -0+200 <[^>]+> f20f 0104 addw r1, pc, #4 -0+204 <[^>]+> f20f 0102 addw r1, pc, #2 -0+208 <[^>]+> bf00 nop -0+20a <[^>]+> bf00 nop +0+136 <[^>]+> a104 add r1, pc, #16 ; \(adr r1, 0+148 <[^>]+>\) +0+138 <[^>]+> f20f 010c addw r1, pc, #12 +0+13c <[^>]+> f20f 0808 addw r8, pc, #8 +0+140 <[^>]+> f20f 0106 addw r1, pc, #6 +0+144 <[^>]+> f2af 0112 subw r1, pc, #18 +0+148 <[^>]+> bf00 nop +0+14a <[^>]+> bf00 nop +0+14c <[^>]+> f20f 0104 addw r1, pc, #4 +0+150 <[^>]+> f20f 0102 addw r1, pc, #2 +0+154 <[^>]+> bf00 nop +0+156 <[^>]+> bf00 nop diff --git a/gas/testsuite/gas/arm/thumb2_relax.s b/gas/testsuite/gas/arm/thumb2_relax.s index 428e6ff55ba..60661e80ba6 100644 --- a/gas/testsuite/gas/arm/thumb2_relax.s +++ b/gas/testsuite/gas/arm/thumb2_relax.s @@ -30,17 +30,11 @@ thumb2_relax: .equ far_ldrh, 0x3e .equ far_ldrsh, 0x3e .equ far_ldr, 0x7c -.equ far_strb, 0x1f -.equ far_strh, 0x3e -.equ far_str, 0x7c ls ldrb ls ldrsb ls ldrh ls ldrsh ls ldr - ls strb - ls strh - ls str .purgem ls 1: adr r1, 1f diff --git a/gas/testsuite/gas/arm/thumb32.d b/gas/testsuite/gas/arm/thumb32.d index e446b9ed8d3..9fd5f242088 100644 --- a/gas/testsuite/gas/arm/thumb32.d +++ b/gas/testsuite/gas/arm/thumb32.d @@ -539,7 +539,6 @@ Disassembly of section .text: 0[0-9a-f]+ <[^>]+> e9c5 2300 strd r2, r3, \[r5\] 0[0-9a-f]+ <[^>]+> e9c5 230c strd r2, r3, \[r5, #48\].* 0[0-9a-f]+ <[^>]+> e945 230c strd r2, r3, \[r5, #-48\].* -0[0-9a-f]+ <[^>]+> e94f 2308 strd r2, r3, \[pc, #-32\] ; 0+5f0 0[0-9a-f]+ <[^>]+> f815 1e00 ldrbt r1, \[r5\] 0[0-9a-f]+ <[^>]+> f815 1e30 ldrbt r1, \[r5, #48\].* 0[0-9a-f]+ <[^>]+> f915 1e00 ldrsbt r1, \[r5\] @@ -948,26 +947,26 @@ Disassembly of section .text: 0[0-9a-f]+ <[^>]+> fa52 f183 uxtab r1, r2, r3 0[0-9a-f]+ <[^>]+> fa32 f183 uxtab16 r1, r2, r3 0[0-9a-f]+ <[^>]+> fa12 f183 uxtah r1, r2, r3 -0[0-9a-f]+ <[^>]+> f89f 12aa ldrb\.w r1, \[pc, #682\] ; 0+e8a <[^>]+> -0[0-9a-f]+ <[^>]+> f89f 1155 ldrb\.w r1, \[pc, #341\] ; 0+d39 <[^>]+> -0[0-9a-f]+ <[^>]+> f81f 12aa ldrb\.w r1, \[pc, #-682\] ; 0+93e <[^>]+> -0[0-9a-f]+ <[^>]+> f81f 1155 ldrb\.w r1, \[pc, #-341\] ; 0+a97 <[^>]+> -0[0-9a-f]+ <[^>]+> f99f 12aa ldrsb\.w r1, \[pc, #682\] ; 0+e9a <[^>]+> -0[0-9a-f]+ <[^>]+> f99f 1155 ldrsb\.w r1, \[pc, #341\] ; 0+d49 <[^>]+> -0[0-9a-f]+ <[^>]+> f91f 12aa ldrsb\.w r1, \[pc, #-682\] ; 0+94e <[^>]+> -0[0-9a-f]+ <[^>]+> f91f 1155 ldrsb\.w r1, \[pc, #-341\] ; 0+aa7 <[^>]+> -0[0-9a-f]+ <[^>]+> f8bf 12aa ldrh\.w r1, \[pc, #682\] ; 0+eaa <[^>]+> -0[0-9a-f]+ <[^>]+> f8bf 1155 ldrh\.w r1, \[pc, #341\] ; 0+d59 <[^>]+> -0[0-9a-f]+ <[^>]+> f83f 12aa ldrh\.w r1, \[pc, #-682\] ; 0+95e <[^>]+> -0[0-9a-f]+ <[^>]+> f83f 1155 ldrh\.w r1, \[pc, #-341\] ; 0+ab7 <[^>]+> -0[0-9a-f]+ <[^>]+> f9bf 12aa ldrsh\.w r1, \[pc, #682\] ; 0+eba <[^>]+> -0[0-9a-f]+ <[^>]+> f9bf 1155 ldrsh\.w r1, \[pc, #341\] ; 0+d69 <[^>]+> -0[0-9a-f]+ <[^>]+> f93f 12aa ldrsh\.w r1, \[pc, #-682\] ; 0+96e <[^>]+> -0[0-9a-f]+ <[^>]+> f93f 1155 ldrsh\.w r1, \[pc, #-341\] ; 0+ac7 <[^>]+> -0[0-9a-f]+ <[^>]+> f8df 12aa ldr\.w r1, \[pc, #682\] ; 0+eca <[^>]+> -0[0-9a-f]+ <[^>]+> f8df 1155 ldr\.w r1, \[pc, #341\] ; 0+d79 <[^>]+> -0[0-9a-f]+ <[^>]+> f85f 12aa ldr\.w r1, \[pc, #-682\] ; 0+97e <[^>]+> -0[0-9a-f]+ <[^>]+> f85f 1155 ldr\.w r1, \[pc, #-341\] ; 0+ad7 <[^>]+> +0[0-9a-f]+ <[^>]+> f89f 12aa ldrb\.w r1, \[pc, #682\] ; 0+e86 <[^>]+> +0[0-9a-f]+ <[^>]+> f89f 1155 ldrb\.w r1, \[pc, #341\] ; 0+d35 <[^>]+> +0[0-9a-f]+ <[^>]+> f81f 12aa ldrb\.w r1, \[pc, #-682\] ; 0+93a <[^>]+> +0[0-9a-f]+ <[^>]+> f81f 1155 ldrb\.w r1, \[pc, #-341\] ; 0+a93 <[^>]+> +0[0-9a-f]+ <[^>]+> f99f 12aa ldrsb\.w r1, \[pc, #682\] ; 0+e96 <[^>]+> +0[0-9a-f]+ <[^>]+> f99f 1155 ldrsb\.w r1, \[pc, #341\] ; 0+d45 <[^>]+> +0[0-9a-f]+ <[^>]+> f91f 12aa ldrsb\.w r1, \[pc, #-682\] ; 0+94a <[^>]+> +0[0-9a-f]+ <[^>]+> f91f 1155 ldrsb\.w r1, \[pc, #-341\] ; 0+aa3 <[^>]+> +0[0-9a-f]+ <[^>]+> f8bf 12aa ldrh\.w r1, \[pc, #682\] ; 0+ea6 <[^>]+> +0[0-9a-f]+ <[^>]+> f8bf 1155 ldrh\.w r1, \[pc, #341\] ; 0+d55 <[^>]+> +0[0-9a-f]+ <[^>]+> f83f 12aa ldrh\.w r1, \[pc, #-682\] ; 0+95a <[^>]+> +0[0-9a-f]+ <[^>]+> f83f 1155 ldrh\.w r1, \[pc, #-341\] ; 0+ab3 <[^>]+> +0[0-9a-f]+ <[^>]+> f9bf 12aa ldrsh\.w r1, \[pc, #682\] ; 0+eb6 <[^>]+> +0[0-9a-f]+ <[^>]+> f9bf 1155 ldrsh\.w r1, \[pc, #341\] ; 0+d65 <[^>]+> +0[0-9a-f]+ <[^>]+> f93f 12aa ldrsh\.w r1, \[pc, #-682\] ; 0+96a <[^>]+> +0[0-9a-f]+ <[^>]+> f93f 1155 ldrsh\.w r1, \[pc, #-341\] ; 0+ac3 <[^>]+> +0[0-9a-f]+ <[^>]+> f8df 12aa ldr\.w r1, \[pc, #682\] ; 0+ec6 <[^>]+> +0[0-9a-f]+ <[^>]+> f8df 1155 ldr\.w r1, \[pc, #341\] ; 0+d75 <[^>]+> +0[0-9a-f]+ <[^>]+> f85f 12aa ldr\.w r1, \[pc, #-682\] ; 0+97a <[^>]+> +0[0-9a-f]+ <[^>]+> f85f 1155 ldr\.w r1, \[pc, #-341\] ; 0+ad3 <[^>]+> 0[0-9a-f]+ <[^>]+> f200 0900 addw r9, r0, #0 0[0-9a-f]+ <[^>]+> f60f 76ff addw r6, pc, #4095 ; 0xfff 0[0-9a-f]+ <[^>]+> f6a9 2685 subw r6, r9, #2693 ; 0xa85 diff --git a/gas/testsuite/gas/arm/thumb32.l b/gas/testsuite/gas/arm/thumb32.l index a439484430c..d2860e3e605 100644 --- a/gas/testsuite/gas/arm/thumb32.l +++ b/gas/testsuite/gas/arm/thumb32.l @@ -1,4 +1,8 @@ [^;]*: Assembler messages: +[^;]*:450: Warning: s suffix on comparison instruction is deprecated +[^;]*:450: Warning: s suffix on comparison instruction is deprecated +[^;]*:450: Warning: s suffix on comparison instruction is deprecated +[^;]*:450: Warning: s suffix on comparison instruction is deprecated [^;]*:451: Warning: s suffix on comparison instruction is deprecated [^;]*:451: Warning: s suffix on comparison instruction is deprecated [^;]*:451: Warning: s suffix on comparison instruction is deprecated @@ -11,7 +15,3 @@ [^;]*:453: Warning: s suffix on comparison instruction is deprecated [^;]*:453: Warning: s suffix on comparison instruction is deprecated [^;]*:453: Warning: s suffix on comparison instruction is deprecated -[^;]*:454: Warning: s suffix on comparison instruction is deprecated -[^;]*:454: Warning: s suffix on comparison instruction is deprecated -[^;]*:454: Warning: s suffix on comparison instruction is deprecated -[^;]*:454: Warning: s suffix on comparison instruction is deprecated diff --git a/gas/testsuite/gas/arm/thumb32.s b/gas/testsuite/gas/arm/thumb32.s index baae71fecf8..d6dbdd651fe 100644 --- a/gas/testsuite/gas/arm/thumb32.s +++ b/gas/testsuite/gas/arm/thumb32.s @@ -380,7 +380,6 @@ here: strd r2, r3, [r5] strd r2, [r5, #0x30] strd r2, [r5, #-0x30] - strd r2, r3, here ldrbt r1, [r5] ldrbt r1, [r5, #0x30] -- 2.30.2