[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / arm-thunk-arm-thumb-reuse.s
blob724be08b8d11b8ab9f4e34bce7c8f75bbcbbd58b
1 // REQUIRES: arm
2 // RUN: split-file %s %t
3 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %t/test.s -o %t.o
4 // RUN: ld.lld --script %t/script %t.o -o %t2
5 // RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t2 | FileCheck %s
7 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7aeb-none-linux-gnueabi -mcpu=cortex-a8 %t/test.s -o %t.o
8 // RUN: ld.lld --script %t/script %t.o -o %t2
9 // RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t2 | FileCheck %s
10 // RUN: ld.lld --be8 --script %t/script %t.o -o %t2
11 // RUN: llvm-objdump --no-print-imm-hex --no-show-raw-insn -d %t2 | FileCheck %s
13 /// Test that we can reuse thunks between Arm and Thumb callers
14 /// using a BL. Expect two thunks, one for far, one for far2.
16 //--- script
17 SECTIONS {
18 .text 0x10000 : { *(.text) }
19 .text.far 0x10000000 : AT (0x10000000) { *(.far) }
22 //--- test.s
24 .syntax unified
25 .text
26 .globl _start
27 .type _start, %function
28 .arm
29 _start:
30 bl far
31 .thumb
32 bl far
33 bl far2
34 .arm
35 bl far2
37 // CHECK: 00010000 <_start>:
38 // CHECK-NEXT: 10000: bl 0x10010 <__ARMv7ABSLongThunk_far>
39 // CHECK-NEXT: 10004: blx 0x10010 <__ARMv7ABSLongThunk_far>
40 // CHECK-NEXT: 10008: bl 0x1001c <__Thumbv7ABSLongThunk_far2>
41 // CHECK-NEXT: 1000c: blx 0x1001c <__Thumbv7ABSLongThunk_far2>
42 // CHECK: 00010010 <__ARMv7ABSLongThunk_far>:
43 // CHECK-NEXT: 10010: movw r12, #0
44 // CHECK-NEXT: 10014: movt r12, #4096
45 // CHECK-NEXT: 10018: bx r12
46 // CHECK: 0001001c <__Thumbv7ABSLongThunk_far2>:
47 // CHECK-NEXT: 1001c: movw r12, #4
48 // CHECK-NEXT: 10020: movt r12, #4096
49 // CHECK-NEXT: 10024: bx r12
51 .section .text.far, "ax", %progbits
52 .globl far
53 .type far, %function
54 far:
55 bx lr
56 .globl far2
57 .type far2, %function
58 far2:
59 bx lr
61 // CHECK: Disassembly of section .text.far:
62 // CHECK: 10000000 <far>:
63 // CHECK-NEXT: 10000000: bx lr
64 // CHECK: 10000004 <far2>:
65 // CHECK-NEXT: 10000004: bx lr