• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_low 0x100000 : { *(.text_low) } \
5// RUN:       .text_high 0x2000000 : { *(.text_high) } \
6// RUN:       .data : { *(.data) } \
7// RUN:       }" > %t.script
8// RUN: ld.lld --script %t.script %t -o %t2
9// RUN: llvm-objdump -d --triple=thumbv7a-none-linux-gnueabi %t2 | FileCheck %s
10 .syntax unified
11 .section .text_low, "ax", %progbits
12 .thumb
13 .globl _start
14_start: bx lr
15 .globl low_target
16 .type low_target, %function
17low_target:
18 bl high_target
19 bl orphan_target
20// CHECK: Disassembly of section .text_low:
21// CHECK-EMPTY:
22// CHECK-NEXT: <_start>:
23// CHECK-NEXT:   100000:        70 47   bx      lr
24// CHECK: <low_target>:
25// CHECK-NEXT:   100002:        00 f0 03 f8     bl      #6
26// CHECK-NEXT:   100006:        00 f0 06 f8     bl      #12
27// CHECK: <__Thumbv7ABSLongThunk_high_target>:
28// CHECK-NEXT:   10000c:        40 f2 01 0c     movw    r12, #1
29// CHECK-NEXT:   100010:        c0 f2 00 2c     movt    r12, #512
30// CHECK-NEXT:   100014:        60 47   bx      r12
31// CHECK: <__Thumbv7ABSLongThunk_orphan_target>:
32// CHECK-NEXT:   100016:        40 f2 15 0c     movw    r12, #21
33// CHECK-NEXT:   10001a:        c0 f2 00 2c     movt    r12, #512
34// CHECK-NEXT:   10001e:        60 47   bx      r12
35  .section .text_high, "ax", %progbits
36 .thumb
37 .globl high_target
38 .type high_target, %function
39high_target:
40 bl low_target
41 bl orphan_target
42// CHECK: Disassembly of section .text_high:
43// CHECK-EMPTY:
44// CHECK-NEXT: <high_target>:
45// CHECK-NEXT:  2000000:        00 f0 02 f8     bl      #4
46// CHECK-NEXT:  2000004:        00 f0 06 f8     bl      #12
47// CHECK: <__Thumbv7ABSLongThunk_low_target>:
48// CHECK-NEXT:  2000008:        40 f2 03 0c     movw    r12, #3
49// CHECK-NEXT:  200000c:        c0 f2 10 0c     movt    r12, #16
50// CHECK-NEXT:  2000010:        60 47   bx      r12
51
52 .section orphan, "ax", %progbits
53 .thumb
54 .globl orphan_target
55 .type orphan_target, %function
56orphan_target:
57 bl low_target
58 bl high_target
59// CHECK: Disassembly of section orphan:
60// CHECK-EMPTY:
61// CHECK-NEXT: <orphan_target>:
62// CHECK-NEXT:  2000014:        ff f7 f8 ff     bl      #-16
63// CHECK-NEXT:  2000018:        ff f7 f2 ff     bl      #-28
64
65 .data
66 .word 10
67