[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / lib / Headers / cet.h
blobffb19dec8f2b559a8ff167668676776ccdad46fb
1 /*===------ cet.h -Control-flow Enforcement Technology feature ------------===
2 * Add x86 feature with IBT and/or SHSTK bits to ELF program property if they
3 * are enabled. Otherwise, contents in this header file are unused. This file
4 * is mainly design for assembly source code which want to enable CET.
6 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 * See https://llvm.org/LICENSE.txt for license information.
8 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 *===-----------------------------------------------------------------------===
12 #ifndef __CET_H
13 #define __CET_H
15 #ifdef __ASSEMBLER__
17 #ifndef __CET__
18 # define _CET_ENDBR
19 #endif
21 #ifdef __CET__
23 # ifdef __LP64__
24 # if __CET__ & 0x1
25 # define _CET_ENDBR endbr64
26 # else
27 # define _CET_ENDBR
28 # endif
29 # else
30 # if __CET__ & 0x1
31 # define _CET_ENDBR endbr32
32 # else
33 # define _CET_ENDBR
34 # endif
35 # endif
38 # ifdef __LP64__
39 # define __PROPERTY_ALIGN 3
40 # else
41 # define __PROPERTY_ALIGN 2
42 # endif
44 .pushsection ".note.gnu.property", "a"
45 .p2align __PROPERTY_ALIGN
46 .long 1f - 0f /* name length. */
47 .long 4f - 1f /* data length. */
48 /* NT_GNU_PROPERTY_TYPE_0. */
49 .long 5 /* note type. */
51 .asciz "GNU" /* vendor name. */
53 .p2align __PROPERTY_ALIGN
54 /* GNU_PROPERTY_X86_FEATURE_1_AND. */
55 .long 0xc0000002 /* pr_type. */
56 .long 3f - 2f /* pr_datasz. */
58 /* GNU_PROPERTY_X86_FEATURE_1_XXX. */
59 .long __CET__
61 .p2align __PROPERTY_ALIGN
63 .popsection
64 #endif
65 #endif
66 #endif