1 /* ELF program property for x86 ISA level.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 In addition to the permissions in the GNU Lesser General Public
11 License, the Free Software Foundation gives you unlimited
12 permission to link the compiled version of this file with other
13 programs, and to distribute those programs without any restriction
14 coming from the use of this file. (The Lesser General Public
15 License restrictions do apply in other respects; for example, they
16 cover modification of the file, and distribution when not linked
17 into another program.)
19 The GNU C Library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public
25 License along with the GNU C Library; if not, see
26 <https://www.gnu.org/licenses/>. */
29 #include <sysdeps/x86/isa-level.h>
30 /* ELF program property for x86 ISA level. */
31 #ifdef INCLUDE_X86_ISA_LEVEL
32 # if MINIMUM_X86_ISA_LEVEL >= 1
33 /* NB: ISAs, excluding MMX, in x86-64 ISA level baseline are used. */
34 # define ISA_BASELINE GNU_PROPERTY_X86_ISA_1_BASELINE
36 # define ISA_BASELINE 0
39 # if MINIMUM_X86_ISA_LEVEL >= 2
40 /* NB: ISAs in x86-64 ISA level v2 are used. */
41 # define ISA_V2 GNU_PROPERTY_X86_ISA_1_V2
46 # if MINIMUM_X86_ISA_LEVEL >= 3
47 /* NB: ISAs in x86-64 ISA level v3 are used. */
48 # define ISA_V3 GNU_PROPERTY_X86_ISA_1_V3
53 # if MINIMUM_X86_ISA_LEVEL >= 4
54 /* NB: ISAs in x86-64 ISA level v4 are used. */
55 # define ISA_V4 GNU_PROPERTY_X86_ISA_1_V4
61 # define ISA_LEVEL (ISA_BASELINE | ISA_V2 | ISA_V3 | ISA_V4)
66 # define PROPERTY_ALIGN 3
68 # define PROPERTY_ALIGN 2
71 # define note_stringify(arg) note_stringify_1(arg)
72 # define note_stringify_1(arg) #arg
74 asm(".pushsection \".note.gnu.property\",\"a\",@note\n"
75 " .p2align " note_stringify (PROPERTY_ALIGN
)
80 /* note type: NT_GNU_PROPERTY_TYPE_0. */
81 " .long " note_stringify (NT_GNU_PROPERTY_TYPE_0
)
83 "\n0: .asciz \"GNU\"\n"
84 "1: .p2align " note_stringify (PROPERTY_ALIGN
)
85 /* pr_type: GNU_PROPERTY_X86_ISA_1_NEEDED. */
86 "\n .long " note_stringify (GNU_PROPERTY_X86_ISA_1_NEEDED
)
89 /* GNU_PROPERTY_X86_ISA_1_V[234]. */
90 "2:\n .long " note_stringify (ISA_LEVEL
)
91 "\n3:\n .p2align " note_stringify (PROPERTY_ALIGN
)
92 "\n4:\n .popsection");
93 # endif /* ISA_LEVEL */
94 #endif /* INCLUDE_X86_ISA_LEVEL */