File: arm-cmse-keep-sections.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (55 lines) | stat: -rw-r--r-- 1,904 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// REQUIRES: arm
/// Create a secure app and import library using CMSE.
/// Create a non-secure app that refers symbols in the import library.

// RUN: rm -rf %t && split-file %s %t && cd %t
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main cmse-implib.s -o implib.o -I%S/Inputs/
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.main cmse-secure-app.s -o secureapp.o
/// Create the secure app and import library.
// RUN: ld.lld -e secure_entry --section-start .gnu.sgstubs=0x1000000 --section-start SECURE1=0x10 --section-start SECURE2=0x2000000 --cmse-implib implib.o secureapp.o --out-implib=implib.lib -o secureapp --gc-sections
// RUN: llvm-readelf -s implib.lib | FileCheck %s
// RUN: llvm-objdump -d --no-show-raw-insn secureapp | FileCheck %s --check-prefix=DISS


// DISS-LABEL: <__acle_se_entry1>:
// DISS-NEXT:  10: nop

// DISS-LABEL: <entry1>:
// DISS-NEXT: 1000000: sg
// DISS-LABEL:         b.w {{.*}} <__acle_se_entry1>

// DISS-LABEL: <entry2>:
// DISS-NEXT: 1000008: sg
// DISS-LABEL:         b.w {{.*}} <__acle_se_entry2>

// DISS-LABEL: <__acle_se_entry2>:
// DISS-NEXT:  2000000: nop

// CHECK:    Symbol table '.symtab' contains {{.*}} entries:
// CHECK-NEXT:  Num:  Value  Size Type  Bind   Vis     Ndx Name
// CHECK-NEXT:    0: 00000000   0 NOTYPE  LOCAL  DEFAULT   UND
// CHECK-NEXT:    1: 01000001   8 FUNC  GLOBAL DEFAULT   ABS entry1
// CHECK-NEXT:    2: 01000009   8 FUNC  GLOBAL DEFAULT   ABS entry2

//--- cmse-implib.s
  .include "arm-cmse-macros.s"

  .syntax unified
  .section SECURE1, "ax"

  cmse_veneer entry1, function, global, function, global

  .syntax unified
  .section SECURE2, "ax"

  cmse_veneer entry2, function, global, function, global

//--- cmse-secure-app.s
  .text
  .align  2
  // Main entry point.
  .global secure_entry
  .thumb_func
secure_entry:
  bx lr
  .size  secure_entry, .-secure_entry