File: arm-cmse-keep-sections.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (55 lines) | stat: -rw-r--r-- 1,904 bytes parent folder | download | duplicates (8)
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