1// REQUIRES: arm 2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t 3// RUN: ld.lld %t --shared --icf=all -o %t.so 4// The output file is large, most of it zeroes. We dissassemble only the 5// parts we need to speed up the test and avoid a large output file 6// RUN: llvm-objdump -d %t.so --start-address=0x2000000 --stop-address=0x2000018 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK1 %s 7// RUN: llvm-objdump -d %t.so --start-address=0x2800004 --stop-address=0x2800034 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK2 %s 8// RUN: llvm-objdump -d %t.so --start-address=0x4000000 --stop-address=0x4000010 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK3 %s 9// RUN: llvm-objdump -d %t.so --start-address=0x4000010 --stop-address=0x4000100 --triple=armv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK4 %s 10// RUN: rm %t.so 11 .syntax unified 12 .thumb 13 14// Make sure that we generate a range extension thunk to a PLT entry 15 .section ".text.1", "ax", %progbits 16 .global sym1 17 .global elsewhere 18 .type elsewhere, %function 19 .global preemptible 20 .type preemptible, %function 21 .global far_preemptible 22 .type far_preemptible, %function 23 .global far_nonpreemptible 24 .hidden far_nonpreemptible 25 .type far_nonpreemptible, %function 26 .global far_nonpreemptible_alias 27 .hidden far_nonpreemptible_alias 28 .type far_nonpreemptible_alias, %function 29sym1: 30 bl elsewhere 31 bl preemptible 32 bx lr 33preemptible: 34 bl far_preemptible 35 bl far_nonpreemptible 36 bl far_nonpreemptible_alias 37 bx lr 38// CHECK1: Disassembly of section .text: 39// CHECK1-EMPTY: 40// CHECK1-NEXT: <sym1>: 41// CHECK1-NEXT: 2000000: 00 f0 00 d8 bl #8388608 42// CHECK1-NEXT: 2000004: 00 f0 04 d8 bl #8388616 43// CHECK1-NEXT: 2000008: 70 47 bx lr 44// CHECK1: <preemptible>: 45// CHECK1-NEXT: 200000a: 00 f0 07 d8 bl #8388622 46// CHECK1-NEXT: 200000e: 00 f0 0b d8 bl #8388630 47// CHECK1-NEXT: 2000012: 00 f0 09 d8 bl #8388626 48// CHECK1-NEXT: 2000016: 70 47 bx lr 49 50 .section .text.2, "ax", %progbits 51 .balign 0x0800000 52 bx lr 53// CHECK2: <__ThumbV7PILongThunk_elsewhere>: 54// CHECK2-NEXT: 2800004: 40 f2 20 0c movw r12, #32 55// CHECK2-NEXT: 2800008: c0 f2 80 1c movt r12, #384 56// CHECK2-NEXT: 280000c: fc 44 add r12, pc 57// CHECK2-NEXT: 280000e: 60 47 bx r12 58// CHECK2: <__ThumbV7PILongThunk_preemptible>: 59// CHECK2-NEXT: 2800010: 40 f2 24 0c movw r12, #36 60// CHECK2-NEXT: 2800014: c0 f2 80 1c movt r12, #384 61// CHECK2-NEXT: 2800018: fc 44 add r12, pc 62// CHECK2-NEXT: 280001a: 60 47 bx r12 63// CHECK2: <__ThumbV7PILongThunk_far_preemptible>: 64// CHECK2-NEXT: 280001c: 40 f2 28 0c movw r12, #40 65// CHECK2-NEXT: 2800020: c0 f2 80 1c movt r12, #384 66// CHECK2-NEXT: 2800024: fc 44 add r12, pc 67// CHECK2-NEXT: 2800026: 60 47 bx r12 68// CHECK2: <__ThumbV7PILongThunk_far_nonpreemptible>: 69// CHECK2-NEXT: 2800028: 4f f6 cd 7c movw r12, #65485 70// CHECK2-NEXT: 280002c: c0 f2 7f 1c movt r12, #383 71// CHECK2-NEXT: 2800030: fc 44 add r12, pc 72// CHECK2-NEXT: 2800032: 60 47 bx r12 73 74 .section .text.3, "ax", %progbits 75.balign 0x2000000 76far_preemptible: 77far_nonpreemptible: 78 bl elsewhere 79 80 .section .text.4, "ax", %progbits 81.balign 0x2000000 82far_nonpreemptible_alias: 83 bl elsewhere 84 85// CHECK3: <far_preemptible>: 86// CHECK3: 4000000: 00 f0 16 e8 blx #44 87 88// CHECK4: Disassembly of section .plt: 89// CHECK4-EMPTY: 90// CHECK4-NEXT: <$a>: 91// CHECK4-NEXT: 4000010: 04 e0 2d e5 str lr, [sp, #-4]! 92// CHECK4-NEXT: 4000014: 00 e6 8f e2 add lr, pc, #0, #12 93// CHECK4-NEXT: 4000018: 20 ea 8e e2 add lr, lr, #32 94// CHECK4-NEXT: 400001c: a4 f0 be e5 ldr pc, [lr, #164]! 95// CHECK4: <$d>: 96// CHECK4-NEXT: 4000020: d4 d4 d4 d4 .word 0xd4d4d4d4 97// CHECK4-NEXT: 4000024: d4 d4 d4 d4 .word 0xd4d4d4d4 98// CHECK4-NEXT: 4000028: d4 d4 d4 d4 .word 0xd4d4d4d4 99// CHECK4-NEXT: 400002c: d4 d4 d4 d4 .word 0xd4d4d4d4 100// CHECK4: <$a>: 101// CHECK4-NEXT: 4000030: 00 c6 8f e2 add r12, pc, #0, #12 102// CHECK4-NEXT: 4000034: 20 ca 8c e2 add r12, r12, #32 103// CHECK4-NEXT: 4000038: 8c f0 bc e5 ldr pc, [r12, #140]! 104// CHECK4: <$d>: 105// CHECK4-NEXT: 400003c: d4 d4 d4 d4 .word 0xd4d4d4d4 106// CHECK4: <$a>: 107// CHECK4-NEXT: 4000040: 00 c6 8f e2 add r12, pc, #0, #12 108// CHECK4-NEXT: 4000044: 20 ca 8c e2 add r12, r12, #32 109// CHECK4-NEXT: 4000048: 80 f0 bc e5 ldr pc, [r12, #128]! 110// CHECK4: <$d>: 111// CHECK4-NEXT: 400004c: d4 d4 d4 d4 .word 0xd4d4d4d4 112// CHECK4: <$a>: 113// CHECK4-NEXT: 4000050: 00 c6 8f e2 add r12, pc, #0, #12 114// CHECK4-NEXT: 4000054: 20 ca 8c e2 add r12, r12, #32 115// CHECK4-NEXT: 4000058: 74 f0 bc e5 ldr pc, [r12, #116]! 116// CHECK4: <$d>: 117// CHECK4-NEXT: 400005c: d4 d4 d4 d4 .word 0xd4d4d4d4 118