lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. |
| 2 | # Local configure fragment for sysdeps/arm. |
| 3 | |
| 4 | dnl It is always possible to access static and hidden symbols in an |
| 5 | dnl position independent way. This has been true since GCC 4.1, |
| 6 | dnl which is older than the minimum version required to build libc. |
| 7 | AC_DEFINE(PI_STATIC_AND_HIDDEN) |
| 8 | |
| 9 | # We check to see if the compiler and flags are |
| 10 | # selecting the hard-float ABI and if they are then |
| 11 | # we set libc_cv_arm_pcs_vfp to yes which causes |
| 12 | # HAVE_ARM_PCS_VFP to be defined in config.h and |
| 13 | # in include/libc-symbols.h and thus available to |
| 14 | # shlib-versions to select the appropriate name for |
| 15 | # the dynamic linker via %ifdef. |
| 16 | AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI], |
| 17 | [libc_cv_arm_pcs_vfp], |
| 18 | [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP |
| 19 | yes |
| 20 | #endif |
| 21 | ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)]) |
| 22 | if test $libc_cv_arm_pcs_vfp = yes; then |
| 23 | AC_DEFINE(HAVE_ARM_PCS_VFP) |
| 24 | LIBC_CONFIG_VAR([default-abi], [hard]) |
| 25 | else |
| 26 | LIBC_CONFIG_VAR([default-abi], [soft]) |
| 27 | fi |
| 28 | |
| 29 | AC_CACHE_CHECK([whether the build tools support the GNU descriptor TLS scheme], |
| 30 | [libc_cv_arm_tls_desc], |
| 31 | [old_CFLAGS="$CFLAGS" |
| 32 | CFLAGS="$CFLAGS -mtls-dialect=gnu2" |
| 33 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([asm (".word\tfoo(tlsdesc)");], [])], |
| 34 | [libc_cv_arm_tls_desc=yes], [libc_cv_arm_tls_desc=no]) |
| 35 | CFLAGS="$old_CFLAGS"]) |
| 36 | if test $libc_cv_arm_tls_desc = yes; then |
| 37 | LIBC_CONFIG_VAR([have-arm-tls-desc], [yes]) |
| 38 | else |
| 39 | LIBC_CONFIG_VAR([have-arm-tls-desc], [no]) |
| 40 | fi |
| 41 | |
| 42 | AC_CACHE_CHECK([whether PC-relative relocs in movw/movt work properly], |
| 43 | libc_cv_arm_pcrel_movw, [ |
| 44 | cat > conftest.s <<\EOF |
| 45 | .syntax unified |
| 46 | .arm |
| 47 | .arch armv7-a |
| 48 | |
| 49 | .text |
| 50 | .globl foo |
| 51 | .type foo,%function |
| 52 | foo: movw r0, #:lower16:symbol - 1f - 8 |
| 53 | movt r0, #:upper16:symbol - 1f - 8 |
| 54 | 1: add r0, pc |
| 55 | @ And now a case with a local symbol. |
| 56 | movw r0, #:lower16:3f - 2f - 8 |
| 57 | movt r0, #:upper16:3f - 2f - 8 |
| 58 | 2: add r0, pc |
| 59 | bx lr |
| 60 | |
| 61 | .data |
| 62 | .globl symbol |
| 63 | .hidden symbol |
| 64 | symbol: .long 23 |
| 65 | 3: .long 17 |
| 66 | EOF |
| 67 | libc_cv_arm_pcrel_movw=no |
| 68 | ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ |
| 69 | -nostartfiles -nostdlib -shared \ |
| 70 | -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && |
| 71 | LC_ALL=C $READELF -dr conftest.so > conftest.dr 2>&AS_MESSAGE_LOG_FD && |
| 72 | { |
| 73 | cat conftest.dr 1>&AS_MESSAGE_LOG_FD |
| 74 | fgrep 'TEXTREL |
| 75 | R_ARM_NONE' conftest.dr > /dev/null || libc_cv_arm_pcrel_movw=yes |
| 76 | } |
| 77 | rm -f conftest*]) |
| 78 | if test $libc_cv_arm_pcrel_movw = yes; then |
| 79 | AC_DEFINE([ARM_PCREL_MOVW_OK]) |
| 80 | fi |
| 81 | |
| 82 | # This was buggy in assemblers from GNU binutils versions before 2.25.1 |
| 83 | # (it's known to be broken in 2.24 and 2.25; see |
| 84 | # https://sourceware.org/bugzilla/show_bug.cgi?id=18383). |
| 85 | AC_CACHE_CHECK([whether TPOFF relocs with addends are assembled correctly], |
| 86 | libc_cv_arm_tpoff_addend, [ |
| 87 | cat > conftest.s <<\EOF |
| 88 | .syntax unified |
| 89 | .arm |
| 90 | .arch armv7-a |
| 91 | |
| 92 | .text |
| 93 | foo: |
| 94 | .word tbase(tpoff)+4 |
| 95 | |
| 96 | .section .tdata,"awT",%progbits |
| 97 | .word -4 |
| 98 | tbase: .word 0 |
| 99 | .word 4 |
| 100 | EOF |
| 101 | libc_cv_arm_tpoff_addend=no |
| 102 | ${CC-cc} -c $CFLAGS $CPPFLAGS \ |
| 103 | -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD && |
| 104 | LC_ALL=C $READELF -x.text conftest.o > conftest.x 2>&AS_MESSAGE_LOG_FD && |
| 105 | { |
| 106 | cat conftest.x 1>&AS_MESSAGE_LOG_FD |
| 107 | $AWK 'BEGIN { result = 2 } |
| 108 | $1 ~ /0x0+/ && $2 ~ /[[0-9a-f]]+/ { |
| 109 | # Check for little-endian or big-endian encoding of 4 in the in-place addend. |
| 110 | result = ($2 == "04000000" || $2 == "00000004") ? 0 : 1 |
| 111 | } |
| 112 | END { exit(result) } |
| 113 | ' conftest.x 2>&AS_MESSAGE_LOG_FD && libc_cv_arm_tpoff_addend=yes |
| 114 | } |
| 115 | rm -f conftest*]) |
| 116 | if test $libc_cv_arm_tpoff_addend = no; then |
| 117 | LIBC_CONFIG_VAR([test-xfail-tst-tlsalign], [yes]) |
| 118 | LIBC_CONFIG_VAR([test-xfail-tst-tlsalign-static], [yes]) |
| 119 | fi |
| 120 | |
| 121 | |
| 122 | libc_cv_gcc_unwind_find_fde=no |
| 123 | |
| 124 | # Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac. |
| 125 | CFLAGS=${CFLAGS% -fno-unwind-tables} |
| 126 | |
| 127 | dnl The normal configure check for gcc -fexecptions fails because it can't |
| 128 | dnl find __aeabi_unwind_cpp_pr0. Work around this here; our GCC definitely |
| 129 | dnl has -fexceptions. |
| 130 | libc_cv_gcc_exceptions=yes |
| 131 | exceptions=-fexceptions |