2 // RUN
: rm
-rf
%t && split-file
%s
%t
3 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
-triple
=armv6m-none-eabi
%t/a.s
-o
%t/a.o
4 // RUN
: ld.lld
--no-rosegment
--script
%t/a.t %t/a.o
-o
%t/a
5 // RUN
: llvm-objdump
--no-print-imm-hex
--no-show-raw-insn
-d
%t/a --triple
=armv6m-none-eabi | FileCheck
%s
6 // RUN
: not ld.lld
--no-rosegment
--script
%t/a.t %t/a.o
-o
%t/a2
--pie
2>&1 | FileCheck
--check-prefix
=CHECK-PI
%s
7 // RUN
: rm
-f
%t/a %t/a2
9 // Range extension thunks for Arm Architecture v6m. Only Thumb instructions
10 // are permitted which limits the access to instructions that can access the
11 // high registers
(r8 - r15), this means that the thunks have to spill
12 // low registers
(r0 - r7) in order to perform the transfer of control.
16 .text_low 0x11345670 : { *(.text_low) }
17 .text_high 0x12345678 : { *(.text_high) }
21 // The
'y' on the
.section directive means that this section is eXecute Only code
23 .section .text_low, "axy", %progbits
25 .type _start, %function
31 .section .text_high, "ax", %progbits
37 // CHECK
: Disassembly of section
.text_low:
39 // CHECK-NEXT
: <_start
>:
40 // CHECK-NEXT
: 11345670: bl 0x11345674 <__Thumbv6MABSXOLongThunk_far
>
41 // CHECK
: <__Thumbv6MABSXOLongThunk_far
>:
42 // CHECK-NEXT
: push
{r0, r1}
43 // CHECK-NEXT
: movs
r0, #18
44 // CHECK-NEXT
: lsls
r0, r0, #8
45 // CHECK-NEXT
: adds
r0, #52
46 // CHECK-NEXT
: lsls
r0, r0, #8
47 // CHECK-NEXT
: adds
r0, #86
48 // CHECK-NEXT
: lsls
r0, r0, #8
49 // CHECK-NEXT
: adds
r0, #121
50 // CHECK-NEXT
: str
r0, [sp
, #4]
51 // CHECK-NEXT
: pop
{r0, pc
}
52 // CHECK
: Disassembly of section
.text_high:
55 // CHECK-NEXT
: 12345678: bx
lr
57 // CHECK-PI
: error
: relocation R_ARM_THM_CALL to far
not supported for Armv6-M targets for position independent
and execute only code