1*a1bc3e63SJonathan Cohen// RUN: not llvm-mc -triple armv7-apple-darwin -filetype=obj %s 2>&1 | FileCheck %s 2*a1bc3e63SJonathan Cohen 3*a1bc3e63SJonathan Cohen// Check that the relocation size is valid. 4*a1bc3e63SJonathan Cohen// Check lower bound of edge case. 5*a1bc3e63SJonathan Cohen_foo1_valid: 6*a1bc3e63SJonathan Cohen // CHECK-NOT: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 7*a1bc3e63SJonathan Cohen b _foo1_valid+0x2000004 8*a1bc3e63SJonathan Cohen// Check outside of range of the largest accepted positive number 9*a1bc3e63SJonathan Cohen_foo1: 10*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 11*a1bc3e63SJonathan Cohen b _foo1+0x2000008 12*a1bc3e63SJonathan Cohen 13*a1bc3e63SJonathan Cohen// Check Same as above, for smallest negative value 14*a1bc3e63SJonathan Cohen_foo2_valid: 15*a1bc3e63SJonathan Cohen // CHECK-NOT: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 16*a1bc3e63SJonathan Cohen b _foo2_valid-0x1FFFFF8 17*a1bc3e63SJonathan Cohen_foo2: 18*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 19*a1bc3e63SJonathan Cohen b _foo2-0x1FFFFFC 20*a1bc3e63SJonathan Cohen 21*a1bc3e63SJonathan Cohen// Edge case - subtracting positive number 22*a1bc3e63SJonathan Cohen_foo3: 23*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 24*a1bc3e63SJonathan Cohen b _foo3-0x2000010 25*a1bc3e63SJonathan Cohen 26*a1bc3e63SJonathan Cohen// Edge case - adding negative number 27*a1bc3e63SJonathan Cohen_foo4: 28*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 29*a1bc3e63SJonathan Cohen b _foo4+0x2000008 30*a1bc3e63SJonathan Cohen 31*a1bc3e63SJonathan Cohen_foo5: 32*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 33*a1bc3e63SJonathan Cohen bl _foo5+0x2000008 34*a1bc3e63SJonathan Cohen 35*a1bc3e63SJonathan Cohen_foo6: 36*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 37*a1bc3e63SJonathan Cohen blx _foo6+0x2000008 38*a1bc3e63SJonathan Cohen 39*a1bc3e63SJonathan Cohen// blx instruction is aligned to 16-bits. 40*a1bc3e63SJonathan Cohen_foo7_blx: 41*a1bc3e63SJonathan Cohen // CHECK-NOT:[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 42*a1bc3e63SJonathan Cohen blx _foo7_blx+0x1FFFFFE 43*a1bc3e63SJonathan Cohen 44*a1bc3e63SJonathan Cohen// Other branch instructions require 32-bit alignment. 45*a1bc3e63SJonathan Cohen_foo7: 46*a1bc3e63SJonathan Cohen // CHECK:[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 47*a1bc3e63SJonathan Cohen bl _foo7_blx+0x1FFFFFE 48*a1bc3e63SJonathan Cohen 49*a1bc3e63SJonathan Cohen_foo8: 50*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 51*a1bc3e63SJonathan Cohen ble _foo8+0x2000008 52*a1bc3e63SJonathan Cohen 53*a1bc3e63SJonathan Cohen_foo9: 54*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation out of range 55*a1bc3e63SJonathan Cohen beq _foo9+0x2000008 56*a1bc3e63SJonathan Cohen 57*a1bc3e63SJonathan Cohen // Check that the relocation alignment is valid. 58*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 59*a1bc3e63SJonathan Cohen bl _foo1+0x101 60*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 61*a1bc3e63SJonathan Cohen blx _foo1+0x101 62*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 63*a1bc3e63SJonathan Cohen b _foo1+0x101 64*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 65*a1bc3e63SJonathan Cohen ble _foo1+0x101 66*a1bc3e63SJonathan Cohen // CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: Relocation not aligned 67*a1bc3e63SJonathan Cohen beq _foo1+0x101 68