• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3// RUN: echo "SECTIONS { \
4// RUN:       . = SIZEOF_HEADERS; \
5// RUN:       .text_low : { *(.text_low) *(.text_low2) . = . + 0x2000000 ; *(.text_high) *(.text_high2) } \
6// RUN:       } " > %t.script
7// RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
8// RUN: llvm-objdump -d %t2 --start-address=148 --stop-address=188 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK1 %s
9// RUN: llvm-objdump -d %t2 --start-address=33554620 --stop-address=33554654 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK2 %s
10// Test that range extension thunks can handle location expressions within
11// a Section Description
12 .syntax unified
13 .section .text_low, "ax", %progbits
14 .thumb
15 .globl _start
16_start: bx lr
17 .globl low_target
18 .type low_target, %function
19low_target:
20 bl high_target
21 bl high_target2
22
23 .section .text_low2, "ax", %progbits
24 .thumb
25 .globl low_target2
26 .type low_target2, %function
27low_target2:
28 bl high_target
29 bl high_target2
30// CHECK1: Disassembly of section .text_low:
31// CHECK1-EMPTY:
32// CHECK1-NEXT: <_start>:
33// CHECK1-NEXT:       94:       70 47   bx      lr
34// CHECK1: <low_target>:
35// CHECK1-NEXT:       96:       00 f0 03 f8     bl      #6
36// CHECK1-NEXT:       9a:       00 f0 06 f8     bl      #12
37// CHECK1: <__Thumbv7ABSLongThunk_high_target>:
38// CHECK1-NEXT:       a0:       40 f2 bd 0c     movw    r12, #189
39// CHECK1-NEXT:       a4:       c0 f2 00 2c     movt    r12, #512
40// CHECK1-NEXT:       a8:       60 47   bx      r12
41// CHECK1: <__Thumbv7ABSLongThunk_high_target2>:
42// CHECK1-NEXT:       aa:       40 f2 d9 0c     movw    r12, #217
43// CHECK1-NEXT:       ae:       c0 f2 00 2c     movt    r12, #512
44// CHECK1-NEXT:       b2:       60 47   bx      r12
45// CHECK1: <low_target2>:
46// CHECK1-NEXT:       b4:       ff f7 f4 ff     bl      #-24
47// CHECK1-NEXT:       b8:       ff f7 f7 ff     bl      #-18
48
49 .section .text_high, "ax", %progbits
50 .thumb
51 .globl high_target
52 .type high_target, %function
53high_target:
54 bl low_target
55 bl low_target2
56
57 .section .text_high2, "ax", %progbits
58 .thumb
59 .globl high_target2
60 .type high_target2, %function
61high_target2:
62 bl low_target
63 bl low_target2
64
65// CHECK2: <high_target>:
66// CHECK2-NEXT:  20000bc:       00 f0 02 f8     bl      #4
67// CHECK2-NEXT:  20000c0:       00 f0 05 f8     bl      #10
68// CHECK2: <__Thumbv7ABSLongThunk_low_target>:
69// CHECK2-NEXT:  20000c4:       40 f2 97 0c     movw    r12, #151
70// CHECK2-NEXT:  20000c8:       c0 f2 00 0c     movt    r12, #0
71// CHECK2-NEXT:  20000cc:       60 47   bx      r12
72// CHECK2: <__Thumbv7ABSLongThunk_low_target2>:
73// CHECK2-NEXT:  20000ce:       40 f2 b5 0c     movw    r12, #181
74// CHECK2-NEXT:  20000d2:       c0 f2 00 0c     movt    r12, #0
75// CHECK2-NEXT:  20000d6:       60 47   bx      r12
76// CHECK2: <high_target2>:
77// CHECK2-NEXT:  20000d8:       ff f7 f4 ff     bl      #-24
78// CHECK2-NEXT:  20000dc:       ff f7 f7 ff     bl      #-18
79