[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / arm-cmse-implib.s
blob60a68b0226c3dfea036e08ad0142aee1cb479132
1 // REQUIRES: arm
2 /// Test that addresses of secure gateways in an old import library are maintained in new import libraries.
4 // RUN: rm -rf %t && split-file %s %t && cd %t
5 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base app -o app.o
6 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base implib-v1 -I %S/Inputs -o 1.o
7 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj --triple=thumbv8m.base implib-v2 -I %S/Inputs -o 2.o
9 // RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 1 app.o --out-implib=1.lib --cmse-implib 1.o
10 // RUN: llvm-readelf -s 1 1.lib | FileCheck %s --check-prefixes=CHECK1
12 // RUN: ld.lld -Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 -o 2 app.o --out-implib=2.lib --in-implib=1.lib --cmse-implib 2.o
13 // RUN: llvm-readelf -s 2 2.lib | FileCheck %s --check-prefixes=CHECK2
15 //--- app
17 .align 2
18 .global secure_entry
19 .type secure_entry, %function
20 secure_entry:
21 nop
22 .size secure_entry, .-secure_entry
24 //--- implib-v1
26 .include "arm-cmse-macros.s"
28 .syntax unified
29 .text
31 cmse_veneer foo, function, global, function, global
32 cmse_veneer bar, function, weak, function, global
33 cmse_no_veneer no_veneer1, function, weak, function, global
34 cmse_no_veneer no_veneer2, function, weak, function, weak
36 //--- implib-v2
38 .include "arm-cmse-macros.s"
40 .syntax unified
41 .text
43 cmse_veneer baz, function, weak, function, global
44 cmse_veneer foo, function, global, function, global
45 cmse_veneer bar, function, weak, function, global
46 cmse_veneer qux, function, global, function, global
47 cmse_no_veneer no_veneer1, function, weak, function, global
48 cmse_no_veneer no_veneer2, function, weak, function, weak
50 /// Executable 1
51 // CHECK1: File:
52 // CHECK1: Symbol table '.symtab' contains 13 entries:
53 // CHECK1-NEXT: Num: Value Size Type Bind Vis Ndx Name
54 // CHECK1-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
55 // CHECK1-NEXT: 1: 00020000 0 NOTYPE LOCAL DEFAULT 2 $t
56 // CHECK1-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t
57 // CHECK1-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t
58 // CHECK1-NEXT: 4: 00008001 2 FUNC GLOBAL DEFAULT 1 secure_entry
59 // CHECK1-NEXT: 5: 00020001 8 FUNC GLOBAL DEFAULT 2 foo
60 // CHECK1-NEXT: 6: 00008005 2 FUNC GLOBAL DEFAULT 1 __acle_se_foo
61 // CHECK1-NEXT: 7: 00020009 8 FUNC WEAK DEFAULT 2 bar
62 // CHECK1-NEXT: 8: 00008009 2 FUNC GLOBAL DEFAULT 1 __acle_se_bar
63 // CHECK1-NEXT: 9: 0000800d 8 FUNC WEAK DEFAULT 1 no_veneer1
64 // CHECK1-NEXT: 10: 00008013 2 FUNC GLOBAL DEFAULT 1 __acle_se_no_veneer1
65 // CHECK1-NEXT: 11: 00008015 8 FUNC WEAK DEFAULT 1 no_veneer2
66 // CHECK1-NEXT: 12: 0000801b 2 FUNC WEAK DEFAULT 1 __acle_se_no_veneer2
69 /// Import library 1
70 // CHECK1: File:
71 // CHECK1: Symbol table '.symtab' contains 5 entries:
72 // CHECK1-NEXT: Num: Value Size Type Bind Vis Ndx Name
73 // CHECK1-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
74 // CHECK1-NEXT: 1: 0000800d 8 FUNC WEAK DEFAULT ABS no_veneer1
75 // CHECK1-NEXT: 2: 00008015 8 FUNC WEAK DEFAULT ABS no_veneer2
76 // CHECK1-NEXT: 3: 00020001 8 FUNC GLOBAL DEFAULT ABS foo
77 // CHECK1-NEXT: 4: 00020009 8 FUNC WEAK DEFAULT ABS bar
79 /// Executable 2
80 // CHECK2: File:
81 // CHECK2: Symbol table '.symtab' contains 17 entries:
82 // CHECK2-NEXT: Num: Value Size Type Bind Vis Ndx Name
83 // CHECK2-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
84 // CHECK2-NEXT: 1: 00020000 0 NOTYPE LOCAL DEFAULT 2 $t
85 // CHECK2-NEXT: 2: 00008000 0 NOTYPE LOCAL DEFAULT 1 $t
86 // CHECK2-NEXT: 3: 00008004 0 NOTYPE LOCAL DEFAULT 1 $t
87 // CHECK2-NEXT: 4: 00008001 2 FUNC GLOBAL DEFAULT 1 secure_entry
88 // CHECK2-NEXT: 5: 00020011 8 FUNC WEAK DEFAULT 2 baz
89 // CHECK2-NEXT: 6: 00008005 2 FUNC GLOBAL DEFAULT 1 __acle_se_baz
90 // CHECK2-NEXT: 7: 00020001 8 FUNC GLOBAL DEFAULT 2 foo
91 // CHECK2-NEXT: 8: 00008009 2 FUNC GLOBAL DEFAULT 1 __acle_se_foo
92 // CHECK2-NEXT: 9: 00020009 8 FUNC WEAK DEFAULT 2 bar
93 // CHECK2-NEXT: 10: 0000800d 2 FUNC GLOBAL DEFAULT 1 __acle_se_bar
94 // CHECK2-NEXT: 11: 00020019 8 FUNC GLOBAL DEFAULT 2 qux
95 // CHECK2-NEXT: 12: 00008011 2 FUNC GLOBAL DEFAULT 1 __acle_se_qux
96 // CHECK2-NEXT: 13: 00008015 8 FUNC WEAK DEFAULT 1 no_veneer1
97 // CHECK2-NEXT: 14: 0000801b 2 FUNC GLOBAL DEFAULT 1 __acle_se_no_veneer1
98 // CHECK2-NEXT: 15: 0000801d 8 FUNC WEAK DEFAULT 1 no_veneer2
99 // CHECK2-NEXT: 16: 00008023 2 FUNC WEAK DEFAULT 1 __acle_se_no_veneer2
102 /// Note that foo retains its address from Import library 1 (0x000020001)
103 /// New entry functions, baz and qux, use addresses not used by Import library 1.
104 /// Import library 2
105 // CHECK2: File:
106 // CHECK2: Symbol table '.symtab' contains 7 entries:
107 // CHECK2-NEXT: Num: Value Size Type Bind Vis Ndx Name
108 // CHECK2-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
109 // CHECK2-NEXT: 1: 00008015 8 FUNC WEAK DEFAULT ABS no_veneer1
110 // CHECK2-NEXT: 2: 0000801d 8 FUNC WEAK DEFAULT ABS no_veneer2
111 // CHECK2-NEXT: 3: 00020001 8 FUNC GLOBAL DEFAULT ABS foo
112 // CHECK2-NEXT: 4: 00020009 8 FUNC WEAK DEFAULT ABS bar
113 // CHECK2-NEXT: 5: 00020011 8 FUNC WEAK DEFAULT ABS baz
114 // CHECK2-NEXT: 6: 00020019 8 FUNC GLOBAL DEFAULT ABS qux