2 // RUN
: llvm-mc
-filetype
=obj
-triple
=thumbv7a-none-linux-gnueabi
%s
-o
%t
3 // RUN
: echo
"SECTIONS { \
4 // RUN: . = SIZEOF_HEADERS; \
5 // RUN: .callee_low : { *(.callee_low) } \
6 // RUN: .caller : { *(.caller) } \
7 // RUN: .callee_high : { *(.callee_high) } \
8 // RUN: .text : { *(.text) } } " > %t.script
9 // RUN
: ld.lld
--script
%t.script
%t %S
/Inputs
/arm-thumb-narrow-branch.o
-o
%t2
10 // RUN
: llvm-objdump
-d
%t2 | FileCheck
%s
12 // Test the R_ARM_THM_JUMP11
and R_ARM_THM_JUMP8 relocations which are used
13 // with the narrow encoding of B.N
and BEQ.N.
15 // The source of these relocations is
a binary file arm-thumb-narrow-branch.o
16 // which has been assembled with the GNU assembler as llvm-mc doesn
't emit it
17 // as the range of +-2048 bytes is too small to be practically useful for out
18 // of section branches.
21 .global callee_low_far
22 .type callee_low_far,%function
23 callee_low_far = 0x809
25 .global callee_low_near
26 .type callee_low_near,%function
27 callee_low_near = 0xfff
29 .section .callee_low,"ax",%progbits
32 .type callee_low,%function
41 .type _start, %function
46 .section .callee_high,"ax",%progbits
49 .type callee_high,%function
54 .global callee_high_near
55 .type callee_high_near,%function
56 callee_high_near = 0x10ff
58 .global callee_high_far
59 .type callee_high_far,%function
60 callee_high_far = 0x180d
62 // CHECK: Disassembly of section .callee_low:
64 // CHECK-NEXT: <callee_low>:
65 // CHECK-NEXT: 1000: 4770 bx lr
67 // CHECK-NEXT: Disassembly of section .caller:
69 // CHECK-NEXT: <callers>:
70 /// callee_low_far = 0x809
71 // CHECK-NEXT: 1004: e400 b 0x808
72 // CHECK-NEXT: 1006: e7fb b 0x1000 <callee_low>
73 // CHECK-NEXT: 1008: e006 b 0x1018 <callee_high>
74 /// callee_high_far = 0x180d
75 // CHECK-NEXT: 100a: e3ff b 0x180c
76 /// callee_low_near = 0xfff
77 // CHECK-NEXT: 100c: d0f7 beq 0xffe
78 // CHECK-NEXT: 100e: d0f7 beq 0x1000 <callee_low>
79 // CHECK-NEXT: 1010: d002 beq 0x1018 <callee_high>
80 /// callee_high_near = 0x10ff
81 // CHECK-NEXT: 1012: d074 beq 0x10fe
82 // CHECK-NEXT: 1014: 4770 bx lr
83 // CHECK-NEXT: 1016: 46c0 mov r8, r8
85 // CHECK-NEXT: Disassembly of section .callee_high:
87 // CHECK-NEXT: <callee_high>:
88 // CHECK-NEXT: 1018: 4770 bx lr
90 // CHECK-NEXT: Disassembly of section .text:
92 // CHECK-NEXT: <_start>:
93 // CHECK-NEXT: 101c: f7ff fff2 bl 0x1004 <callers>
94 // CHECK-NEXT: 1020: 4770 bx lr