2 /// Create
a secure app
and import library using CMSE.
3 /// Create
a non-secure app that refers symbols in the import library.
5 // RUN
: rm
-rf
%t && split-file
%s
%t && cd
%t
6 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
--triple
=thumbv8m.main cmse-implib.s
-o implib.o
-I
%S
/Inputs
/
7 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
--triple
=thumbv8m.main cmse-secure-app.s
-o secureapp.o
8 // RUN
: llvm-mc
-arm-add-build-attributes
-filetype
=obj
--triple
=thumbv8m.main cmse-non-secure-app.s
-o nonsecureapp.o
9 /// Create the secure app
and import library.
10 // RUN
: ld.lld
-e secure_entry
--section-start
.gnu.sgstubs=0x20000 --cmse-implib implib.o secureapp.o --out-implib=implib.lib -o secureapp
11 /// Link the non-secure app against the import library.
12 // RUN
: ld.lld
-e nonsecure_entry
-Ttext
=0x8000 implib.lib nonsecureapp.o
-o nonsecureapp
13 // RUN
: llvm-readelf
-s implib.lib | FileCheck
%s
14 // RUN
: llvm-objdump
-d
--no-show-raw-insn secureapp | FileCheck
%s
--check-prefixes
=SECUREDISS
15 // RUN
: llvm-objdump
-d
--no-show-raw-insn nonsecureapp | FileCheck
%s
--check-prefixes
=NONSECUREDISS
17 // SECUREDISS-LABEL
: <entry
>:
18 // SECUREDISS-NEXT
: 20000: sg
19 // SECUREDISS-NEXT
: b.w
{{.*}} <__acle_se_entry>
21 // SECUREDISS-LABEL
: <__acle_se_entry
>:
22 // SECUREDISS-NEXT
: 20008: nop
24 // SECUREDISS-LABEL
: <secure_entry
>:
25 // SECUREDISS-NEXT
: 2000c
: bl {{.*}} <__acle_se_entry>
26 // SECUREDISS-NEXT
: bx
lr
28 // NONSECUREDISS-LABEL
: <nonsecure_entry
>:
29 // NONSECUREDISS-NEXT
: 8000: push
{r0, lr}
30 // NONSECUREDISS-NEXT
: bl 0x20000
31 // NONSECUREDISS-NEXT
: pop.w
{r0, lr}
32 // NONSECUREDISS-NEXT
: bx
lr
34 // CHECK
: Symbol table
'.symtab' contains
2 entries
:
35 // CHECK-NEXT
: Num
: Value Size Type Bind Vis Ndx Name
36 // CHECK-NEXT
: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
37 // CHECK-NEXT
: 1: 00020001 8 FUNC GLOBAL DEFAULT
ABS entry
40 .include "arm-cmse-macros.s"
45 cmse_veneer entry
, function
, global
, function
, global
47 //--- cmse-secure-app.s
55 .size secure_entry, .-secure_entry
57 //--- cmse-non-secure-app.s
59 .global nonsecure_entry
62 .type nonsecure_entry, %function
68 .size nonsecure_entry, .-nonsecure_entry