forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptrauth_struct.c
36 lines (28 loc) · 838 Bytes
/
ptrauth_struct.c
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
// Test serializing a module that contains a struct
// with a ptrauth qualified field.
// RUN: rm -rf %t && mkdir %t
// RUN: split-file %s %t
// The command below should not crash.
// RUN: %clang_cc1 -triple arm64e-apple-macosx -fptrauth-returns \
// RUN: -fptrauth-intrinsics -fptrauth-calls -fptrauth-indirect-gotos \
// RUN: -fptrauth-auth-traps -fmodules -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t/cache -o %t/tu.o -x c %t/tu.c
//--- tu.c
#include "struct_with_ptrauth_field.h"
int foo(struct T *t) {
return t->s.foo(t->s.v, t->s.v) + t->arr[12];
}
//--- struct_with_ptrauth_field.h
typedef int (* FuncTy) (int, int);
struct S{
FuncTy __ptrauth(0, 1, 1234) foo;
int v;
};
struct T {
struct S s;
char arr[64];
};
//--- module.modulemap
module mod1 {
header "struct_with_ptrauth_field.h"
}