1 /* ELF program property for Intel CET.
2 Copyright (C) 2017 Free Software Foundation, Inc.
4 This file is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
9 This file is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 Under Section 7 of GPL version 3, you are granted additional
15 permissions described in the GCC Runtime Library Exception, version
16 3.1, as published by the Free Software Foundation.
18 You should have received a copy of the GNU General Public License and
19 a copy of the GCC Runtime Library Exception along with this program;
20 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
21 <http://www.gnu.org/licenses/>.
24 /* Add x86 feature with IBT and/or SHSTK bits to ELF program property
25 if they are enabled. Otherwise, contents in this header file are
26 unused. Define _CET_ENDBR for assembly codes. _CET_ENDBR should be
27 placed unconditionally at the entrance of a function whose address
30 #ifndef _CET_H_INCLUDED
31 #define _CET_H_INCLUDED
37 # define _CET_ENDBR endbr64
39 # define _CET_ENDBR endbr32
48 /* GNU_PROPERTY_X86_FEATURE_1_IBT. */
49 # define __PROPERTY_IBT 0x1
51 # define __PROPERTY_IBT 0x0
55 /* GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
56 # define __PROPERTY_SHSTK 0x2
58 # define __PROPERTY_SHSTK 0x0
61 # define __PROPERTY_BITS (__PROPERTY_IBT | __PROPERTY_SHSTK)
64 # define __PROPERTY_ALIGN 3
66 # define __PROPERTY_ALIGN 2
69 .pushsection
".note.gnu.property", "a"
70 .p2align __PROPERTY_ALIGN
71 .long 1f
- 0f
/* name length. */
72 .long 4f
- 1f
/* data length. */
73 /* NT_GNU_PROPERTY_TYPE_0. */
74 .long 5 /* note type. */
76 .asciz
"GNU" /* vendor name. */
78 .p2align __PROPERTY_ALIGN
79 /* GNU_PROPERTY_X86_FEATURE_1_AND. */
80 .long 0xc0000002 /* pr_type. */
81 .long 3f
- 2f
/* pr_datasz. */
83 /* GNU_PROPERTY_X86_FEATURE_1_XXX. */
86 .p2align __PROPERTY_ALIGN
91 #endif /* __ASSEMBLER__ */
93 #endif /* _CET_H_INCLUDED */