1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/x86.
4 if test $enable_cet != no; then
5 # Check if CET can be enabled.
6 AC_CACHE_CHECK(whether CET can be enabled,
7 libc_cv_x86_cet_available, [dnl
9 #if !defined __CET__ || __CET__ != 3
10 # error CET isn't available.
13 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS -fcf-protection -include cet.h conftest.c 1>&AS_MESSAGE_LOG_FD); then
14 libc_cv_x86_cet_available=yes
16 libc_cv_x86_cet_available=no
19 if test $libc_cv_x86_cet_available != yes; then
20 AC_MSG_ERROR([$CC doesn't support CET])
23 if test $enable_cet != no; then
24 # Check if assembler supports CET.
25 AC_CACHE_CHECK(whether assembler supports CET,
26 libc_cv_x86_cet_as, [dnl
27 cat > conftest.s <<EOF
30 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s -o conftest.o 1>&AS_MESSAGE_LOG_FD); then
31 libc_cv_x86_cet_as=yes
36 if test $libc_cv_x86_cet_as = no; then
37 AC_MSG_ERROR([$AS doesn't support CET])
40 if test $enable_cet = yes; then
41 AC_DEFINE(DEFAULT_DL_X86_CET_CONTROL, cet_elf_property)
42 elif test $enable_cet = permissive; then
43 AC_DEFINE(DEFAULT_DL_X86_CET_CONTROL, cet_permissive)
45 LIBC_CONFIG_VAR([enable-cet], [$enable_cet])
47 # Check if linker supports x86 ISA level.
48 AC_CACHE_CHECK([for linker x86 ISA level support],
49 libc_cv_include_x86_isa_level, [dnl
50 cat > conftest1.S <<EOF
56 .section ".note.gnu.property", "a"
58 .long 1f - 0f /* name length. */
59 .long 4f - 1f /* data length. */
60 /* NT_GNU_PROPERTY_TYPE_0 */
61 .long 5 /* note type. */
63 .asciz "GNU" /* vendor name. */
66 /* GNU_PROPERTY_X86_ISA_1_NEEDED */
67 .long 0xc0008002 /* pr_type. */
68 .long 3f - 2f /* pr_datasz. */
75 cat > conftest2.S <<EOF
81 .section ".note.gnu.property", "a"
83 .long 1f - 0f /* name length. */
84 .long 4f - 1f /* data length. */
85 /* NT_GNU_PROPERTY_TYPE_0 */
86 .long 5 /* note type. */
88 .asciz "GNU" /* vendor name. */
91 /* GNU_PROPERTY_X86_ISA_1_NEEDED */
92 .long 0xc0008002 /* pr_type. */
93 .long 3f - 2f /* pr_datasz. */
100 libc_cv_include_x86_isa_level=no
101 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -nostartfiles -nostdlib -r -o conftest conftest1.S conftest2.S); then
102 count=`LC_ALL=C $READELF -n conftest | grep NT_GNU_PROPERTY_TYPE_0 | wc -l`
103 if test "$count" = 1; then
104 libc_cv_include_x86_isa_level=yes
108 if test $libc_cv_include_x86_isa_level = yes; then
109 AC_DEFINE(INCLUDE_X86_ISA_LEVEL)
110 AC_CACHE_CHECK([for LAHF/SAHF instruction support],
111 libc_cv_have_x86_lahf_sahf, [dnl
112 libc_cv_have_x86_lahf_sahf=no
113 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-msahf\b|-march=x86-64-v)'; then
114 libc_cv_have_x86_lahf_sahf=yes
116 if test $libc_cv_have_x86_lahf_sahf = yes; then
117 AC_DEFINE(HAVE_X86_LAHF_SAHF)
119 AC_CACHE_CHECK([for MOVBE instruction support],
120 libc_cv_have_x86_movbe, [dnl
121 libc_cv_have_x86_movbe=no
122 if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -fverbose-asm -S -o - -x c /dev/null) | grep -qE '(-mmovbe\b|-march=x86-64-v(@<:@3-9@:>@|@<:@1-9@:>@@<:@0-9@:>@))'; then
123 libc_cv_have_x86_movbe=yes
125 if test $libc_cv_have_x86_movbe = yes; then
126 AC_DEFINE(HAVE_X86_MOVBE)
129 LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
131 dnl Static PIE is supported.
132 AC_DEFINE(SUPPORT_STATIC_PIE)