101 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv5-none-linux-gnueabi %s -o %t3// RUN: ld.lld %t -o %t2 --shared4// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0x70000c --stop-address=0x700010 --triple=armv5-none-linux-gnueabi -d %t2 | FileCheck %s5// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0x80000c --stop-address=0x800010 -d %t2 | FileCheck %s --check-prefix=CHECK-CALL6// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0xd00020 --stop-address=0xd00060 --triple=armv5-none-linux-gnueabi -d %t2 | FileCheck %s --check-prefix=CHECK-PLT7 8// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv5eb-none-linux-gnueabi %s -o %t9// RUN: ld.lld %t -o %t2 --shared10// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0x70000c --stop-address=0x700010 --triple=armv5eb-none-linux-gnueabi -d %t2 | FileCheck %s11// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0x80000c --stop-address=0x800010 -d %t2 | FileCheck %s --check-prefix=CHECK-CALL12// RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn --start-address=0xd00020 --stop-address=0xd00060 --triple=armv5eb-none-linux-gnueabi -d %t2 | FileCheck %s --check-prefix=CHECK-PLT13 14/// When we create a thunk to a PLT entry the relocation is redirected to the15/// Thunk, changing its expression to a non-PLT equivalent. If the thunk16/// becomes unusable we need to restore the relocation expression to the PLT17/// form so that when we create a new thunk it targets the PLT.18 19/// Test case that checks the case:20/// - Thunk is created on pass 1 to a PLT entry for preemptible21/// - Some other Thunk added in the same pass moves the thunk to22/// preemptible out of range of its caller.23/// - New Thunk is created on pass 2 to PLT entry for preemptible24 25 .globl preemptible26 .globl preemptible227.section .text.01, "ax", %progbits28.balign 0x10000029 .thumb30 .globl needsplt31 .type needsplt, %function32needsplt:33 bl preemptible34 .section .text.02, "ax", %progbits35 .space (1024 * 1024)36 37 .section .text.03, "ax", %progbits38 .space (1024 * 1024)39 40 .section .text.04, "ax", %progbits41 .space (1024 * 1024)42 43 .section .text.05, "ax", %progbits44 .space (1024 * 1024)45 46 .section .text.06, "ax", %progbits47 .space (1024 * 1024)48 49 .section .text.07, "ax", %progbits50 .space (1024 * 1024)51/// 0xd00040 = preemptible@plt52// CHECK: 0070000c <__ARMv4PILongBXThunk_preemptible>:53// CHECK-NEXT: 70000c: b 0xd0004054 55 .section .text.08, "ax", %progbits56 .space (1024 * 1024) - 457 58 .section .text.10, "ax", %progbits59 .balign 260 bl preemptible61 bl preemptible262// CHECK-CALL: 80000c: blx 0x70000c <__ARMv4PILongBXThunk_preemptible>63 .balign 264 .globl preemptible65 .type preemptible, %function66preemptible:67 bx lr68 .globl preemptible269 .type preemptible2, %function70preemptible2:71 bx lr72 73 74 .section .text.11, "ax", %progbits75 .space (5 * 1024 * 1024)76 77 78// CHECK-PLT: Disassembly of section .plt:79// CHECK-PLT-EMPTY:80// CHECK-PLT-NEXT: 00d00020 <.plt>:81// CHECK-PLT-NEXT: d00020: str lr, [sp, #-4]!82// CHECK-PLT-NEXT: add lr, pc, #0, #1283// CHECK-PLT-NEXT: add lr, lr, #32, #2084// CHECK-PLT-NEXT: ldr pc, [lr, #148]!85// CHECK-PLT-NEXT: d00030: d4 d4 d4 d4 .word 0xd4d4d4d486// CHECK-PLT-NEXT: d00034: d4 d4 d4 d4 .word 0xd4d4d4d487// CHECK-PLT-NEXT: d00038: d4 d4 d4 d4 .word 0xd4d4d4d488// CHECK-PLT-NEXT: d0003c: d4 d4 d4 d4 .word 0xd4d4d4d489// CHECK-PLT-EMPTY:90// CHECK-PLT-NEXT: <preemptible@plt>:91// CHECK-PLT-NEXT: d00040: add r12, pc, #0, #1292// CHECK-PLT-NEXT: d00044: add r12, r12, #32, #2093// CHECK-PLT-NEXT: d00048: ldr pc, [r12, #124]!94// CHECK-PLT-NEXT: d0004c: d4 d4 d4 d4 .word 0xd4d4d4d495// CHECK-PLT-EMPTY:96// CHECK-PLT-NEXT: <preemptible2@plt>:97// CHECK-PLT-NEXT: d00050: add r12, pc, #0, #1298// CHECK-PLT-NEXT: d00054: add r12, r12, #32, #2099// CHECK-PLT-NEXT: d00058: ldr pc, [r12, #112]!100// CHECK-PLT-NEXT: d0005c: d4 d4 d4 d4 .word 0xd4d4d4d4101