brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · cebea41 Raw
141 lines · c
1//// Note: preprocessor features exactly match corresponding clang driver flags. However, some flags are only intended to be used in combination with other ones.2//// For example, -fptrauth-init-fini will not affect codegen without -fptrauth-calls, but the preprocessor feature would be set anyway.3 4// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-intrinsics | \5// RUN:   FileCheck %s --check-prefixes=INTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT6 7// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-calls | \8// RUN:   FileCheck %s --check-prefixes=NOINTRIN,CALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT9 10// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-returns | \11// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,RETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT12 13// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-address-discrimination | \14// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,VPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT15 16// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-vtable-pointer-type-discrimination | \17// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,VPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT18 19// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-type-info-vtable-pointer-discrimination | \20// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,TYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT21 22// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-function-pointer-type-discrimination | \23// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,FUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT24 25// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini | \26// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,INITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT27 28// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-init-fini-address-discrimination | \29// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,INITFINI_ADDR_DISCR,NOGOTOS,NOELFGOT30 31// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-indirect-gotos | \32// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,GOTOS,NOELFGOT33 34// RUN: %clang_cc1 -E %s -triple=aarch64 -fptrauth-elf-got | \35// RUN:   FileCheck %s --check-prefixes=NOINTRIN,NOCALLS,NORETS,NOVPTR_ADDR_DISCR,NOVPTR_TYPE_DISCR,NOTYPE_INFO_DISCR,NOFUNC,NOINITFINI,NOINITFINI_ADDR_DISCR,NOGOTOS,ELFGOT36 37#if defined(__PTRAUTH__)38// INTRIN: has_ptrauth_intrinsics39void has_ptrauth_intrinsics() {}40#else41// NOINTRIN: no_ptrauth_intrinsics42void no_ptrauth_intrinsics() {}43#endif44 45#if __has_feature(ptrauth_calls)46// CALLS: has_ptrauth_calls47void has_ptrauth_calls() {}48#else49// NOCALLS: no_ptrauth_calls50void no_ptrauth_calls() {}51#endif52 53// This is always enabled when ptrauth_calls is enabled54#if __has_feature(ptrauth_member_function_pointer_type_discrimination)55// CALLS: has_ptrauth_member_function_pointer_type_discrimination56void has_ptrauth_member_function_pointer_type_discrimination() {}57#else58// NOCALLS: no_ptrauth_member_function_pointer_type_discrimination59void no_ptrauth_member_function_pointer_type_discrimination() {}60#endif61 62#if __has_feature(ptrauth_returns)63// RETS: has_ptrauth_returns64void has_ptrauth_returns() {}65#else66// NORETS: no_ptrauth_returns67void no_ptrauth_returns() {}68#endif69 70#if __has_feature(ptrauth_vtable_pointer_address_discrimination)71// VPTR_ADDR_DISCR: has_ptrauth_vtable_pointer_address_discrimination72void has_ptrauth_vtable_pointer_address_discrimination() {}73#else74// NOVPTR_ADDR_DISCR: no_ptrauth_vtable_pointer_address_discrimination75void no_ptrauth_vtable_pointer_address_discrimination() {}76#endif77 78#if __has_feature(ptrauth_vtable_pointer_type_discrimination)79// VPTR_TYPE_DISCR: has_ptrauth_vtable_pointer_type_discrimination80void has_ptrauth_vtable_pointer_type_discrimination() {}81#else82// NOVPTR_TYPE_DISCR: no_ptrauth_vtable_pointer_type_discrimination83void no_ptrauth_vtable_pointer_type_discrimination() {}84#endif85 86#if __has_feature(ptrauth_type_info_vtable_pointer_discrimination)87// TYPE_INFO_DISCR: has_ptrauth_type_info_vtable_pointer_discrimination88void has_ptrauth_type_info_vtable_pointer_discrimination() {}89#else90// NOTYPE_INFO_DISCR: no_ptrauth_type_info_vtable_pointer_discrimination91void no_ptrauth_type_info_vtable_pointer_discrimination() {}92#endif93 94#if __has_feature(ptrauth_function_pointer_type_discrimination)95// FUNC: has_ptrauth_function_pointer_type_discrimination96void has_ptrauth_function_pointer_type_discrimination() {}97#else98// NOFUNC: no_ptrauth_function_pointer_type_discrimination99void no_ptrauth_function_pointer_type_discrimination() {}100#endif101 102#if __has_feature(ptrauth_init_fini)103// INITFINI: has_ptrauth_init_fini104void has_ptrauth_init_fini() {}105#else106// NOINITFINI: no_ptrauth_init_fini107void no_ptrauth_init_fini() {}108#endif109 110#if __has_feature(ptrauth_init_fini_address_discrimination)111// INITFINI_ADDR_DISCR: has_ptrauth_init_fini_address_discrimination112void has_ptrauth_init_fini_address_discrimination() {}113#else114// NOINITFINI_ADDR_DISCR: no_ptrauth_init_fini_address_discrimination115void no_ptrauth_init_fini_address_discrimination() {}116#endif117 118#if __has_feature(ptrauth_indirect_gotos)119// GOTOS: has_ptrauth_indirect_gotos120void has_ptrauth_indirect_gotos() {}121#else122// NOGOTOS: no_ptrauth_indirect_gotos123void no_ptrauth_indirect_gotos() {}124#endif125 126#if __has_feature(ptrauth_elf_got)127// ELFGOT: has_ptrauth_elf_got128void has_ptrauth_elf_got() {}129#else130// NOELFGOT: no_ptrauth_elf_got131void no_ptrauth_elf_got() {}132#endif133 134#if __has_feature(ptrauth_objc_signable_class)135// INTRIN: has_ptrauth_objc_signable_class136void has_ptrauth_objc_signable_class(){}137#else138// NOINTRIN: no_ptrauth_objc_signable_class139void no_ptrauth_objc_signable_class(){}140#endif141