1 // REQUIRES: aarch64-registered-target
3 // No MTE, so no StackSafety.
8 // RUN: %clang -O1 --target=aarch64-unknown-linux -mllvm -stack-safety-print %s -S -o - 2>&1 | FileCheck %s
11 // RUN: %clang -O1 --target=aarch64-unknown-linux -c %s -flto=full -o %t.ltonewpm1.bc
12 // RUN: %clang -O1 --target=aarch64-unknown-linux -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc
13 // RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \
14 // RUN: -r %t.ltonewpm1.bc,fn,plx \
15 // RUN: -r %t.ltonewpm1.bc,use,lx \
16 // RUN: -r %t.ltonewpm1.bc,use_local,plx \
17 // RUN: -r %t.ltonewpm1.bc,w, \
18 // RUN: -r %t.ltonewpm2.bc,use,plx \
19 // RUN: -r %t.ltonewpm2.bc,z, 2>&1 | FileCheck %s --allow-empty
22 // RUN: %clang -O1 --target=aarch64-unknown-linux -c %s -flto=thin -o %t.thinltonewpm1.bc
23 // RUN: %clang -O1 --target=aarch64-unknown-linux -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc
24 // RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \
25 // RUN: -r %t.thinltonewpm1.bc,fn,plx \
26 // RUN: -r %t.thinltonewpm1.bc,use,lx \
27 // RUN: -r %t.thinltonewpm1.bc,use_local,plx \
28 // RUN: -r %t.thinltonewpm1.bc,w, \
29 // RUN: -r %t.thinltonewpm2.bc,use,plx \
30 // RUN: -r %t.thinltonewpm2.bc,z, 2>&1 | FileCheck %s --allow-empty
35 // -O0: both are unsafe.
36 // RUN: %clang -O0 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print %s -S -o - 2>&1 | FileCheck %s
38 // No LTO: just one is safe.
39 // RUN: %clang -O1 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print %s -S -o /dev/null 2>&1 | FileCheck %s -check-prefixes=SSI,XUNSAFE,YSAFE
41 // Full LTO: both are safe.
42 // RUN: %clang -O1 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c %s -flto=full -o %t.ltonewpm1.bc
43 // RUN: %clang -O1 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c -DBUILD2 %s -flto=full -o %t.ltonewpm2.bc
44 // RUN: llvm-lto2 run -o %t.ltonewpm %t.ltonewpm1.bc %t.ltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \
45 // RUN: -r %t.ltonewpm1.bc,fn,plx \
46 // RUN: -r %t.ltonewpm1.bc,use,lx \
47 // RUN: -r %t.ltonewpm1.bc,use_local,plx \
48 // RUN: -r %t.ltonewpm1.bc,w, \
49 // RUN: -r %t.ltonewpm2.bc,use,plx \
50 // RUN: -r %t.ltonewpm2.bc,z, 2>&1 | FileCheck %s -check-prefixes=SSI,XSAFE,YSAFE
52 // Thin LTO: both are safe.
53 // RUN: %clang -O1 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c %s -flto=thin -o %t.thinltonewpm1.bc
54 // RUN: %clang -O1 --target=aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -c -DBUILD2 %s -flto=thin -o %t.thinltonewpm2.bc
55 // RUN: llvm-lto2 run -o %t.thinltonewpm %t.thinltonewpm1.bc %t.thinltonewpm2.bc -save-temps -stack-safety-print -thinlto-threads 1 -O1 \
56 // RUN: -r %t.thinltonewpm1.bc,fn,plx \
57 // RUN: -r %t.thinltonewpm1.bc,use,lx \
58 // RUN: -r %t.thinltonewpm1.bc,use_local,plx \
59 // RUN: -r %t.thinltonewpm1.bc,w, \
60 // RUN: -r %t.thinltonewpm2.bc,use,plx \
61 // RUN: -r %t.thinltonewpm2.bc,z, 2>&1 | FileCheck %s -check-prefixes=SSI,XSAFE,YSAFE
68 __attribute__((noinline
)) void use(int *p
) { *p
= z
; }
73 __attribute__((noinline
)) void use_local(char *p
) { *p
= w
; }
76 // SSI-LABEL: allocas uses:
78 // XUNSAFE-DAG: [4]: full-set
79 // XSAFE-DAG: [4]: [0,4)
83 // YUNSAFE-DAG: [1]: full-set
84 // YSAFE-DAG: [1]: [0,1)
90 // CHECK-NOT: allocas uses: