summaryrefslogtreecommitdiff
path: root/gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s
diff options
context:
space:
mode:
Diffstat (limited to 'gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s')
-rw-r--r--gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s39
1 files changed, 39 insertions, 0 deletions
diff --git a/gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s b/gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s
new file mode 100644
index 000000000000..3c528f19975b
--- /dev/null
+++ b/gas/testsuite/gas/arm/group-reloc-ldr-encoding-bad.s
@@ -0,0 +1,39 @@
+@ Tests that are supposed to fail during encoding
+@ for LDR group relocations.
+
+ .text
+
+ .macro ldrtest load store sym offset
+
+ \load r0, [r0, #:pc_g0:(\sym \offset)]
+ \load r0, [r0, #:pc_g1:(\sym \offset)]
+ \load r0, [r0, #:pc_g2:(\sym \offset)]
+ \load r0, [r0, #:sb_g0:(\sym \offset)]
+ \load r0, [r0, #:sb_g1:(\sym \offset)]
+ \load r0, [r0, #:sb_g2:(\sym \offset)]
+
+ \store r0, [r0, #:pc_g0:(\sym \offset)]
+ \store r0, [r0, #:pc_g1:(\sym \offset)]
+ \store r0, [r0, #:pc_g2:(\sym \offset)]
+ \store r0, [r0, #:sb_g0:(\sym \offset)]
+ \store r0, [r0, #:sb_g1:(\sym \offset)]
+ \store r0, [r0, #:sb_g2:(\sym \offset)]
+
+ .endm
+
+@ LDR/STR/LDRB/STRB only have 12 bits available for the magnitude of the addend.
+@ So these should all fail.
+
+ ldrtest ldr str f "+ 4096"
+ ldrtest ldrb strb f "+ 4096"
+ ldrtest ldr str f "- 4096"
+ ldrtest ldrb strb f "- 4096"
+
+ ldrtest ldr str localsym "+ 4096"
+ ldrtest ldrb strb localsym "+ 4096"
+ ldrtest ldr str localsym "- 4096"
+ ldrtest ldrb strb localsym "- 4096"
+
+localsym:
+ mov r0, #0
+