localedata: dz_BT, bo_CN: convert to UTF-8
[glibc.git] / sysdeps / aarch64 / configure.ac
blob27874eceb44911e4f5751ca870d37198f37a9869
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],
15   [libc_cv_aarch64_be],
16   [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__
17                       yes
18                      #endif
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])
23 else
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
32 void foo (void) { }
33 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"])
38   then
39     libc_cv_aarch64_bti=yes
40   fi
41   rm -rf conftest.*])
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
54 int bar (void);
55 int foo (void) { return bar () + 1; }
56 EOF
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])
60   then
61     libc_cv_aarch64_pac_ret=yes
62   fi
63   rm -rf conftest.*])
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
71 .global foo
72 .type foo, %function
73 .variant_pcs foo
74 foo:
75         ret
76 .global bar
77 .type bar, %function
78 bar:
79         b foo
80 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])
84   then
85     libc_cv_aarch64_variant_pcs=yes
86   fi
87   rm -rf conftest.*])
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
93         ptrue p0.b
94 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
97 else
98   libc_cv_aarch64_sve_asm=no
100 rm -f conftest*])
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
106   build_mathvec=yes
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
112 #include <arm_sve.h>
114   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fsyntax-only -ffreestanding conftest.c]); then
115     libc_cv_aarch64_sve_acle=yes
116   else
117     libc_cv_aarch64_sve_acle=no
118   fi
119   rm conftest.c])
121 # Check if compiler is sufficient to build mathvec
122 if test $build_mathvec = yes; then
123   fail=no
124   if test $libc_cv_aarch64_variant_pcs = no; then
125     fail=yes
126     AC_MSG_WARN([mathvec is enabled but linker does not support variant PCS.])
127   fi
128   if test $libc_cv_aarch64_sve_asm = no; then
129     fail=yes
130     AC_MSG_WARN([mathvec is enabled but assembler does not support SVE.])
131   fi
132   if test $libc_cv_aarch64_sve_acle = no; then
133     fail=yes
134     AC_MSG_WARN([mathvec is enabled but compiler does not have SVE ACLE.])
135   fi
136   if test $fail = yes; then
137     AC_MSG_ERROR([use a compatible toolchain or configure with --disable-mathvec (this results in incomplete ABI).])
138   fi
139 else
140   AC_MSG_WARN([mathvec is disabled, this results in incomplete ABI.])