sparc64: Remove unwind information from signal return stubs [BZ#31244]
[glibc.git] / sysdeps / loongarch / configure.ac
blob28a8ae5486291db236f460423acb256fdfa8124a
1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2 # Local configure fragment for sysdeps/loongarch/elf.
4 dnl It is always possible to access static and hidden symbols in an
5 dnl position independent way.
6 AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC)
8 dnl Test if the toolchain is new enough for static PIE.
9 dnl We need a GAS supporting explicit reloc (older GAS produces stack-based
10 dnl reloc and triggers an internal error in the linker).  And, we need GCC to
11 dnl pass the correct linker flags for static PIE.  We strictly require GAS >=
12 dnl 2.41 so we don't need to check the assembler capability, but we need to
13 dnl check if GCC is doing the correct thing.
14 AC_CACHE_CHECK([if ${CC-cc} is sufficient to build static PIE on LoongArch],
15 libc_cv_static_pie_on_loongarch, [
16   cat > conftest.S <<\EOF
17 .global _start
18 .type _start, @function
19 _start:
20   li.w $a7, 93
21   li.w $a0, 0
22   syscall 0
24 .data
26   .word 0
27   /* This should produce an R_LARCH_RELATIVE in the static PIE.  */
28   .dword _start
29 EOF
31   libc_cv_static_pie_on_loongarch=no
32   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static-pie -nostdlib -fPIE -o conftest conftest.S]) \
33      && AC_TRY_COMMAND([LC_ALL=C $READELF -Wr conftest | grep -q R_LARCH_RELATIVE]) \
34      && ! AC_TRY_COMMAND([LC_ALL=C $READELF -Wl conftest | grep -q INTERP])
35   then
36     libc_cv_static_pie_on_loongarch=yes
37   fi
38   rm -rf conftest* ])
40 if test "$libc_cv_static_pie_on_loongarch" = yes; then
41   AC_DEFINE(SUPPORT_STATIC_PIE)
44   # Check if gcc supports option -mcmodel=medium.
45 AC_CACHE_CHECK(whether $CC supports option -mcmodel=medium,
46                libc_cv_loongarch_cmodel_medium, [
47   if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS -mcmodel=medium /dev/null 1>&AS_MESSAGE_LOG_FD); then
48     libc_cv_loongarch_cmodel_medium=yes
49   else
50     libc_cv_loongarch_cmodel_medium=no
51   fi])
52 LIBC_CONFIG_VAR([have-cmodel-medium], [$libc_cv_loongarch_cmodel_medium])
54 # Check if asm support vector instructions.
55 AC_CACHE_CHECK(for vector support in assembler, libc_cv_loongarch_vec_asm, [dnl
56 cat > conftest.s <<\EOF
57         vld  $vr0, $sp, 0
58 EOF
59 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s -o conftest 1>&AS_MESSAGE_LOG_FD); then
60   libc_cv_loongarch_vec_asm=yes
61 else
62   libc_cv_loongarch_vec_asm=no
64 rm -f conftest*])
65 if test $libc_cv_loongarch_vec_asm = no; then
66   AC_MSG_ERROR([binutils version is too old, use 2.41 or newer version])