94 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t3// RUN: ld.lld %t -o %t24// The output file is large, most of it zeroes. We dissassemble only the5// parts we need to speed up the test and avoid a large output file6// RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x100002 --stop-address=0x10000a | FileCheck --check-prefix=CHECK1 %s7// RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x1000004 --stop-address=0x1000026 | FileCheck --check-prefix=CHECK2 %s8// RUN: llvm-objdump --no-print-imm-hex -d %t2 --start-address=0x1100014 --stop-address=0x1100022 | FileCheck --check-prefix=CHECK3 %s9// In this test case a branch that is in range and does not need its range10// extended can be pushed out of range by another Thunk, necessitating another11// pass12 13 .macro FUNCTION suff14 .section .text.\suff\(), "ax", %progbits15 .thumb16 .balign 0x10000017 .globl tfunc\suff\()18 .type tfunc\suff\(), %function19tfunc\suff\():20 bx lr21 .endm22 23 FUNCTION 0024 .globl _start25_start:26 bl target27 b.w arm_target28// arm_target is in range but needs an interworking thunk29// CHECK1: <_start>:30// CHECK1-NEXT: 100002: f300 d006 bl 0x1000012 <__Thumbv7ABSLongThunk_target>31// CHECK1-NEXT: 100006: f2ff 97ff b.w 0x1000008 <__Thumbv7ABSLongThunk_arm_target>32 nop33 nop34 nop35 .globl target236 .type target2, %function37 nop38 39target2:40 FUNCTION 0141 FUNCTION 0242 FUNCTION 0343 FUNCTION 0444 FUNCTION 0545 FUNCTION 0646 FUNCTION 0747 FUNCTION 0848 FUNCTION 0949 FUNCTION 1050 FUNCTION 1151 FUNCTION 1252 FUNCTION 1353 FUNCTION 1454 FUNCTION 1555 56 .section .text.16, "ax", %progbits57 .arm58 .globl arm_target59 .type arm_target, %function60arm_target:61 bx lr62// CHECK2: 01000004 <arm_target>:63// CHECK2: <__Thumbv7ABSLongThunk_arm_target>:64// CHECK2-NEXT: 1000008: f240 0c04 movw r12, #465// CHECK2-NEXT: 100000c: f2c0 1c00 movt r12, #25666// CHECK2-NEXT: 1000010: 4760 bx r1267// CHECK2: <__Thumbv7ABSLongThunk_target>:68// CHECK2-NEXT: 1000012: f0ff bfff b.w 0x1100014 <target>69// CHECK2: <__Thumbv7ABSLongThunk_target2>:70// CHECK2-NEXT: 1000016: f4ff 97fc b.w 0x100012 <target2>71 72 .section .text.17, "ax", %progbits73// Just enough space so that bl target is in range if no extension thunks are74// generated.75 76 .space 0x100000 - 677 78 .section .text.18, "ax", %progbits79 .thumb80 .globl target81 .type target, %function82// target is at maximum ARM branch range away from caller.83target:84// Similar case in the backwards direction85 bl target286 nop87 nop88 bx lr89// CHECK3: <target>:90// CHECK3-NEXT: 1100014: f6ff ffff bl 0x1000016 <__Thumbv7ABSLongThunk_target2>91// CHECK3-NEXT: 1100018: bf00 nop92// CHECK3-NEXT: 110001a: bf00 nop93// CHECK3-NEXT: 110001c: 4770 bx lr94