96 lines · plain
1// RUN: llvm-mc -triple thumbv7-windows-gnu -filetype obj %s -o - | llvm-objdump -D -r - | FileCheck %s2// RUN: not llvm-mc -triple thumbv7-windows-gnu -filetype obj --defsym ERR=1 %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3 4 .text5main:6 nop7 b .Ltarget8 b .Lother_target9 10// A private label target in the same section11 .def .Ltarget12 .scl 313 .type 3214 .endef15 .p2align 216.Ltarget:17 bx lr18 19// A private label target in another section20 .section "other", "xr"21 nop22 nop23 nop24 nop25 nop26 nop27 nop28 nop29 .def .Lother_target30 .scl 331 .type 3232 .endef33 .p2align 234.Lother_target:35 bx lr36 37// Check that both branches have a relocation with a zero offset.38//39// CHECK: 00000000 <main>:40// CHECK: 0: bf00 nop41// CHECK: 2: f000 b800 b.w 0x6 <main+0x6> @ imm = #0x042// CHECK: 00000002: IMAGE_REL_ARM_BRANCH24T .Ltarget43// CHECK: 6: f000 b800 b.w 0xa <main+0xa> @ imm = #0x044// CHECK: 00000006: IMAGE_REL_ARM_BRANCH24T .Lother_target45// CHECK: a: bf00 nop46// CHECK: 0000000c <.Ltarget>:47// CHECK: c: 4770 bx lr48// CHECK: 00000000 <other>:49// CHECK: 0: bf00 nop50// CHECK: 2: bf00 nop51// CHECK: 4: bf00 nop52// CHECK: 6: bf00 nop53// CHECK: 8: bf00 nop54// CHECK: a: bf00 nop55// CHECK: c: bf00 nop56// CHECK: e: bf00 nop57// CHECK: 00000010 <.Lother_target>:58// CHECK: 10: 4770 bx lr59 60.ifdef ERR61 .section "other2", "xr"62err:63 nop64 65// Test errors, if referencing a symbol with an offset66 67 b .Lerr_target+468// ERR: [[#@LINE-1]]:19: error: cannot perform a PC-relative fixup with a non-zero symbol offset69 bl .Lerr_target+470// ERR: [[#@LINE-1]]:20: error: cannot perform a PC-relative fixup with a non-zero symbol offset71 blx .Lerr_target+472// ERR: [[#@LINE-1]]:21: error: cannot perform a PC-relative fixup with a non-zero symbol offset73 74// Test errors, if referencing a private label which lacks .def/.scl/.type/.endef, in another75// section, without an offset. Such symbols are omitted from the output symbol table, so the76// relocation can't reference them. Such relocations usually are made towards the base of the77// section plus an offset, but such an offset is not supported with this relocation.78 79 b .Lerr_target280// ERR: [[#@LINE-1]]:7: error: cannot perform a PC-relative fixup with a non-zero symbol offset81 82 .def .Lerr_target83 .scl 384 .type 3285 .endef86.Lerr_target:87 nop88 nop89 bx lr90 91 .section "other3", "xr"92 nop93.Lerr_target2:94 bx lr95.endif96