1// REQUIRES: arm 2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t 3// RUN: echo "SECTIONS { \ 4// RUN: .text 0x100000 : { *(SORT_BY_NAME(.text.*)) } \ 5// RUN: }" > %t.script 6// RUN: ld.lld --script %t.script %t -o %t2 7// RUN: llvm-objdump -d %t2 --start-address=0x100000 --stop-address=0x100008 | FileCheck --check-prefix=CHECK1 %s 8// RUN: llvm-objdump -d %t2 --start-address=0x1000004 --stop-address=0x100000e | FileCheck --check-prefix=CHECK2 %s 9 10 .syntax unified 11 12// Test that linkerscript sorting does not apply to Thunks, we expect that the 13// sort will reverse the order of sections presented here. 14 15// Define a function aligned on a megabyte boundary 16 .macro FUNCTION suff 17 .section .text.\suff\(), "ax", %progbits 18 .thumb 19 .balign 0x100000 20 .globl tfunc\suff\() 21 .type tfunc\suff\(), %function 22tfunc\suff\(): 23 bx lr 24 .endm 25 26 FUNCTION 31 27 FUNCTION 30 28 FUNCTION 29 29 FUNCTION 28 30 FUNCTION 27 31 FUNCTION 26 32 FUNCTION 25 33 FUNCTION 24 34 FUNCTION 23 35 FUNCTION 22 36 FUNCTION 21 37 FUNCTION 20 38 FUNCTION 19 39 FUNCTION 18 40 FUNCTION 17 41 FUNCTION 16 42 FUNCTION 15 43// CHECK2: <__Thumbv7ABSLongThunk_tfunc31>: 44// CHECK2-NEXT: 1000004: f3ff 97fc b.w 0x2000000 <tfunc31> 45 FUNCTION 14 46 FUNCTION 13 47 FUNCTION 12 48 FUNCTION 11 49 FUNCTION 10 50 FUNCTION 09 51 FUNCTION 08 52 FUNCTION 07 53 FUNCTION 06 54 FUNCTION 05 55 FUNCTION 04 56 FUNCTION 03 57 FUNCTION 02 58 FUNCTION 01 59 .section .text.00, "ax", %progbits 60 .thumb 61 .globl _start 62_start: 63// Expect no range extension needed for tfunc01 and an extension needed for 64// tfunc31 65 bl tfunc01 66 bl tfunc31 67// CHECK1: <_start>: 68// CHECK1-NEXT: 100000: f0ff fffe bl 0x200000 <tfunc01> 69// CHECK1-NEXT: 100004: f2ff d7fe bl 0x1000004 <__Thumbv7ABSLongThunk_tfunc31> 70