1GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. 2# Local configure fragment for sysdeps/x86. 3 4if 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 8cat > conftest.c <<EOF 9#if !defined __CET__ || __CET__ != 3 10# error CET isn't available. 11#endif 12EOF 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 15 else 16 libc_cv_x86_cet_available=no 17 fi 18 rm -rf conftest*]) 19 if test $libc_cv_x86_cet_available != yes; then 20 AC_MSG_ERROR([$CC doesn't support CET]) 21 fi 22fi 23if test $enable_cet != no; then 24 # Check if assembler supports CET. 25 AC_CACHE_CHECK(whether $AS supports CET, 26 libc_cv_x86_cet_as, [dnl 27cat > conftest.s <<EOF 28 incsspd %ecx 29EOF 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 32 else 33 libc_cv_x86_cet_as=no 34 fi 35 rm -rf conftest*]) 36 if test $libc_cv_x86_cet_as = no; then 37 AC_MSG_ERROR([$AS doesn't support CET]) 38 fi 39fi 40if test $enable_cet = yes; then 41 AC_DEFINE(DEFAULT_DL_X86_CET_CONTROL, cet_elf_property) 42elif test $enable_cet = permissive; then 43 AC_DEFINE(DEFAULT_DL_X86_CET_CONTROL, cet_permissive) 44fi 45LIBC_CONFIG_VAR([enable-cet], [$enable_cet]) 46 47# Check if linker supports x86 ISA level. 48AC_CACHE_CHECK([for linker x86 ISA level support], 49 libc_cv_include_x86_isa_level, [dnl 50cat > conftest1.S <<EOF 51#ifdef __LP64__ 52# define P2ALIGN 3 53#else 54# define P2ALIGN 2 55#endif 56 .section ".note.gnu.property", "a" 57 .p2align P2ALIGN 58 .long 1f - 0f /* name length. */ 59 .long 4f - 1f /* data length. */ 60 /* NT_GNU_PROPERTY_TYPE_0 */ 61 .long 5 /* note type. */ 620: 63 .asciz "GNU" /* vendor name. */ 641: 65 .p2align P2ALIGN 66 /* GNU_PROPERTY_X86_ISA_1_NEEDED */ 67 .long 0xc0008002 /* pr_type. */ 68 .long 3f - 2f /* pr_datasz. */ 692: 70 .long 0x1 713: 72 .p2align P2ALIGN 734: 74EOF 75cat > conftest2.S <<EOF 76#ifdef __LP64__ 77# define P2ALIGN 3 78#else 79# define P2ALIGN 2 80#endif 81 .section ".note.gnu.property", "a" 82 .p2align P2ALIGN 83 .long 1f - 0f /* name length. */ 84 .long 4f - 1f /* data length. */ 85 /* NT_GNU_PROPERTY_TYPE_0 */ 86 .long 5 /* note type. */ 870: 88 .asciz "GNU" /* vendor name. */ 891: 90 .p2align P2ALIGN 91 /* GNU_PROPERTY_X86_ISA_1_NEEDED */ 92 .long 0xc0008002 /* pr_type. */ 93 .long 3f - 2f /* pr_datasz. */ 942: 95 .long 0x2 963: 97 .p2align P2ALIGN 984: 99EOF 100libc_cv_include_x86_isa_level=no 101if 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 105 fi 106fi 107rm -f conftest*]) 108if 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 115 fi]) 116 if test $libc_cv_have_x86_lahf_sahf = yes; then 117 AC_DEFINE(HAVE_X86_LAHF_SAHF) 118 fi 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 124 fi]) 125 if test $libc_cv_have_x86_movbe = yes; then 126 AC_DEFINE(HAVE_X86_MOVBE) 127 fi 128fi 129LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level]) 130 131dnl Static PIE is supported. 132AC_DEFINE(SUPPORT_STATIC_PIE) 133