1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/aarch64.
4 # Static PIE is supported.
5 AC_DEFINE(SUPPORT_STATIC_PIE)
7 # We check to see if the compiler and flags are
8 # selecting the big endian ABI and if they are then
9 # we set libc_cv_aarch64_be to yes which causes
10 # HAVE_AARCH64_BE to be defined in config.h and
11 # in include/libc-symbols.h and thus available to
12 # shlib-versions to select the appropriate name for
13 # the dynamic linker via %ifdef.
14 AC_CACHE_CHECK([for big endian],
16 [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__
19 ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)])
20 if test $libc_cv_aarch64_be = yes; then
21 AC_DEFINE(HAVE_AARCH64_BE)
22 LIBC_CONFIG_VAR([default-abi], [lp64_be])
24 LIBC_CONFIG_VAR([default-abi], [lp64])
27 # Only consider BTI supported if -mbranch-protection=bti is
28 # on by default in the compiler and the linker produces
29 # binaries with GNU property notes in PT_GNU_PROPERTY segment.
30 AC_CACHE_CHECK([for BTI support], [libc_cv_aarch64_bti], [dnl
31 cat > conftest.c <<EOF
34 libc_cv_aarch64_bti=no
35 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles $no_ssp -shared -fPIC -o conftest.so conftest.c]) \
36 && AC_TRY_COMMAND([$READELF -lW conftest.so | grep -q GNU_PROPERTY]) \
37 && AC_TRY_COMMAND([$READELF -nW conftest.so | grep -q "NT_GNU_PROPERTY_TYPE_0.*AArch64 feature:.* BTI"])
39 libc_cv_aarch64_bti=yes
42 LIBC_CONFIG_VAR([aarch64-bti], [$libc_cv_aarch64_bti])
43 if test $libc_cv_aarch64_bti = yes; then
44 AC_DEFINE(HAVE_AARCH64_BTI)
47 # Check if glibc is built with return address signing, i.e.
48 # if -mbranch-protection=pac-ret is on. We need this because
49 # pac-ret relies on unwinder support so it's not safe to use
50 # it in assembly code unconditionally, but there is no
51 # feature test macro for it in gcc.
52 AC_CACHE_CHECK([if pac-ret is enabled], [libc_cv_aarch64_pac_ret], [dnl
53 cat > conftest.c <<EOF
55 int foo (void) { return bar () + 1; }
57 libc_cv_aarch64_pac_ret=no
58 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -o conftest.s conftest.c]) \
59 && AC_TRY_COMMAND([grep -q -E '\''(hint( | )+25|paciasp)'\'' conftest.s])
61 libc_cv_aarch64_pac_ret=yes
64 if test $libc_cv_aarch64_pac_ret = yes; then
65 AC_DEFINE(HAVE_AARCH64_PAC_RET)
68 # Check if binutils supports variant PCS symbols.
69 AC_CACHE_CHECK([for variant PCS support], [libc_cv_aarch64_variant_pcs], [dnl
70 cat > conftest.S <<EOF
81 libc_cv_aarch64_variant_pcs=no
82 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles $no_ssp -shared -fPIC -o conftest.so conftest.S]) \
83 && AC_TRY_COMMAND([$READELF -dW conftest.so | grep -q AARCH64_VARIANT_PCS])
85 libc_cv_aarch64_variant_pcs=yes
88 LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
90 # Check if asm support armv8.2-a+sve
91 AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl
92 cat > conftest.s <<\EOF
95 if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
96 libc_cv_aarch64_sve_asm=yes
98 libc_cv_aarch64_sve_asm=no
101 if test $libc_cv_aarch64_sve_asm = yes; then
102 AC_DEFINE(HAVE_AARCH64_SVE_ASM)
105 if test x"$build_mathvec" = xnotset; then
109 # Check if compiler supports SVE ACLE.
110 AC_CACHE_CHECK(for availability of SVE ACLE, libc_cv_aarch64_sve_acle, [dnl
111 cat > conftest.c <<EOF
114 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fsyntax-only -ffreestanding conftest.c]); then
115 libc_cv_aarch64_sve_acle=yes
117 libc_cv_aarch64_sve_acle=no
121 # Check if compiler is sufficient to build mathvec
122 if test $build_mathvec = yes; then
124 if test $libc_cv_aarch64_variant_pcs = no; then
126 AC_MSG_WARN([mathvec is enabled but linker does not support variant PCS.])
128 if test $libc_cv_aarch64_sve_asm = no; then
130 AC_MSG_WARN([mathvec is enabled but assembler does not support SVE.])
132 if test $libc_cv_aarch64_sve_acle = no; then
134 AC_MSG_WARN([mathvec is enabled but compiler does not have SVE ACLE.])
136 if test $fail = yes; then
137 AC_MSG_ERROR([use a compatible toolchain or configure with --disable-mathvec (this results in incomplete ABI).])
140 AC_MSG_WARN([mathvec is disabled, this results in incomplete ABI.])