xref: /llvm-project/clang/test/CodeGen/AArch64/elf-pauthabi.c (revision 3b162f73d8027dcd8261666a40e9bdfb40f4dacc)
1207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
2207e5cccSFangrui Song // RUN:   -fptrauth-intrinsics \
3207e5cccSFangrui Song // RUN:   -fptrauth-calls \
4207e5cccSFangrui Song // RUN:   -fptrauth-returns \
5207e5cccSFangrui Song // RUN:   -fptrauth-auth-traps \
6207e5cccSFangrui Song // RUN:   -fptrauth-vtable-pointer-address-discrimination \
7207e5cccSFangrui Song // RUN:   -fptrauth-vtable-pointer-type-discrimination \
8207e5cccSFangrui Song // RUN:   -fptrauth-init-fini \
9207e5cccSFangrui Song // RUN:   -fptrauth-init-fini-address-discrimination \
10*3b162f73SDaniil Kovalev // RUN:   -fptrauth-elf-got \
11207e5cccSFangrui Song // RUN:   -fptrauth-indirect-gotos \
12207e5cccSFangrui Song // RUN:   -fptrauth-type-info-vtable-pointer-discrimination \
13207e5cccSFangrui Song // RUN:   -fptrauth-function-pointer-type-discrimination %s | \
14207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=ALL
15207e5cccSFangrui Song 
16207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
17207e5cccSFangrui Song // RUN:   -fptrauth-intrinsics %s | FileCheck %s --check-prefix=INTRIN
18207e5cccSFangrui Song 
19207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
20207e5cccSFangrui Song // RUN:   -fptrauth-calls %s | FileCheck %s --check-prefix=CALL
21207e5cccSFangrui Song 
22207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
23207e5cccSFangrui Song // RUN:   -fptrauth-returns %s | FileCheck %s --check-prefix=RET
24207e5cccSFangrui Song 
25207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
26207e5cccSFangrui Song // RUN:   -fptrauth-auth-traps %s | FileCheck %s --check-prefix=TRAP
27207e5cccSFangrui Song 
28207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
29207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-vtable-pointer-address-discrimination %s | \
30207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=VPTRADDR
31207e5cccSFangrui Song 
32207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
33207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-vtable-pointer-type-discrimination %s | \
34207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=VPTRTYPE
35207e5cccSFangrui Song 
36207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
37207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-init-fini %s | \
38207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=INITFINI
39207e5cccSFangrui Song 
40207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
41207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-init-fini -fptrauth-init-fini-address-discrimination %s | \
42207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=INITFINIADDR
43207e5cccSFangrui Song 
44207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
45*3b162f73SDaniil Kovalev // RUN:   -fptrauth-elf-got %s | FileCheck %s --check-prefix=ELFGOT
46*3b162f73SDaniil Kovalev 
47*3b162f73SDaniil Kovalev // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
48207e5cccSFangrui Song // RUN:   -fptrauth-indirect-gotos %s | FileCheck %s --check-prefix=GOTOS
49207e5cccSFangrui Song 
50207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
51207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-type-info-vtable-pointer-discrimination %s | \
52207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=TYPEINFO
53207e5cccSFangrui Song 
54207e5cccSFangrui Song // RUN: %clang_cc1 -triple aarch64-linux -emit-llvm -o - \
55207e5cccSFangrui Song // RUN:   -fptrauth-calls -fptrauth-function-pointer-type-discrimination %s | \
56207e5cccSFangrui Song // RUN:   FileCheck %s --check-prefix=FPTRTYPE
57207e5cccSFangrui Song 
58207e5cccSFangrui Song // ALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
59*3b162f73SDaniil Kovalev // ALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 4095}
60207e5cccSFangrui Song 
61207e5cccSFangrui Song // INTRIN: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
62207e5cccSFangrui Song // INTRIN: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1}
63207e5cccSFangrui Song 
64207e5cccSFangrui Song // CALL: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
65207e5cccSFangrui Song // CALL: !{i32 1, !"aarch64-elf-pauthabi-version", i32 2}
66207e5cccSFangrui Song 
67207e5cccSFangrui Song // RET: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
68207e5cccSFangrui Song // RET: !{i32 1, !"aarch64-elf-pauthabi-version", i32 4}
69207e5cccSFangrui Song 
70207e5cccSFangrui Song // TRAP: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
71207e5cccSFangrui Song // TRAP: !{i32 1, !"aarch64-elf-pauthabi-version", i32 8}
72207e5cccSFangrui Song 
73207e5cccSFangrui Song // VPTRADDR: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
74207e5cccSFangrui Song // VPTRADDR: !{i32 1, !"aarch64-elf-pauthabi-version", i32 18}
75207e5cccSFangrui Song 
76207e5cccSFangrui Song // VPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
77207e5cccSFangrui Song // VPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-version", i32 34}
78207e5cccSFangrui Song 
79207e5cccSFangrui Song // INITFINI: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
80207e5cccSFangrui Song // INITFINI: !{i32 1, !"aarch64-elf-pauthabi-version", i32 66}
81207e5cccSFangrui Song 
82207e5cccSFangrui Song // INITFINIADDR: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
83207e5cccSFangrui Song // INITFINIADDR: !{i32 1, !"aarch64-elf-pauthabi-version", i32 194}
84207e5cccSFangrui Song 
85*3b162f73SDaniil Kovalev // ELFGOT: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
86*3b162f73SDaniil Kovalev // ELFGOT: !{i32 1, !"aarch64-elf-pauthabi-version", i32 256}
87*3b162f73SDaniil Kovalev 
88207e5cccSFangrui Song // GOTOS: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
89207e5cccSFangrui Song // GOTOS: !{i32 1, !"aarch64-elf-pauthabi-version", i32 512}
90207e5cccSFangrui Song 
91207e5cccSFangrui Song // TYPEINFO: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
92207e5cccSFangrui Song // TYPEINFO: !{i32 1, !"aarch64-elf-pauthabi-version", i32 1026}
93207e5cccSFangrui Song 
94207e5cccSFangrui Song // FPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-platform", i32 268435458}
95207e5cccSFangrui Song // FPTRTYPE: !{i32 1, !"aarch64-elf-pauthabi-version", i32 2050}
96207e5cccSFangrui Song 
97207e5cccSFangrui Song void foo() {}
98