69 lines · plain
1// REQUIRES: arm2/// Create a secure app and import library using CMSE.3/// Create a non-secure app that refers symbols in the import library.4 5// RUN: rm -rf %t && split-file %s %t && cd %t6// 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.o8// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main cmse-non-secure-app.s -o nonsecureapp.o9/// 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 secureapp11/// Link the non-secure app against the import library.12// RUN: ld.lld -e nonsecure_entry --image-base=0x8000 -Ttext=0x8000 implib.lib nonsecureapp.o -o nonsecureapp13// RUN: llvm-readelf -s implib.lib | FileCheck %s14// RUN: llvm-objdump -d --no-show-raw-insn secureapp | FileCheck %s --check-prefixes=SECUREDISS15// RUN: llvm-objdump -d --no-show-raw-insn nonsecureapp | FileCheck %s --check-prefixes=NONSECUREDISS16 17// SECUREDISS-LABEL: <entry>:18// SECUREDISS-NEXT: 20000: sg19// SECUREDISS-NEXT: b.w {{.*}} <__acle_se_entry>20 21// SECUREDISS-LABEL: <__acle_se_entry>:22// SECUREDISS-NEXT: 20008: nop23 24// SECUREDISS-LABEL: <secure_entry>:25// SECUREDISS-NEXT: 2000c: bl {{.*}} <__acle_se_entry>26// SECUREDISS-NEXT: bx lr27 28// NONSECUREDISS-LABEL: <nonsecure_entry>:29// NONSECUREDISS-NEXT: 8000: push {r0, lr}30// NONSECUREDISS-NEXT: bl 0x2000031// NONSECUREDISS-NEXT: pop.w {r0, lr}32// NONSECUREDISS-NEXT: bx lr33 34// CHECK: Symbol table '.symtab' contains 2 entries:35// CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name36// CHECK-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND37// CHECK-NEXT: 1: 00020001 8 FUNC GLOBAL DEFAULT ABS entry38 39//--- cmse-implib.s40 .include "arm-cmse-macros.s"41 42 .syntax unified43 .text44 45 cmse_veneer entry, function, global, function, global46 47//--- cmse-secure-app.s48 .align 249 // Main entry point.50 .global secure_entry51 .thumb_func52secure_entry:53 bl entry54 bx lr55 .size secure_entry, .-secure_entry56 57//--- cmse-non-secure-app.s58 .align 259 .global nonsecure_entry60 .thumb61 .thumb_func62 .type nonsecure_entry, %function63nonsecure_entry:64 push {r0,lr}65 bl entry66 pop {r0,lr}67 bx lr68 .size nonsecure_entry, .-nonsecure_entry69