1GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
2# Local configure fragment for sysdeps/arm.
3
4dnl It is always possible to access static and hidden symbols in an
5dnl position independent way.  This has been true since GCC 4.1,
6dnl which is older than the minimum version required to build libc.
7AC_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.
16AC_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)])
22if test $libc_cv_arm_pcs_vfp = yes; then
23  AC_DEFINE(HAVE_ARM_PCS_VFP)
24  LIBC_CONFIG_VAR([default-abi], [hard])
25else
26  LIBC_CONFIG_VAR([default-abi], [soft])
27fi
28
29AC_CACHE_CHECK([whether PC-relative relocs in movw/movt work properly],
30	       libc_cv_arm_pcrel_movw, [
31cat > conftest.s <<\EOF
32	.syntax unified
33	.arm
34	.arch armv7-a
35
36	.text
37	.globl foo
38	.type foo,%function
39foo:	movw r0, #:lower16:symbol - 1f - 8
40	movt r0, #:upper16:symbol - 1f - 8
411:	add r0, pc
42	@ And now a case with a local symbol.
43	movw r0, #:lower16:3f - 2f - 8
44	movt r0, #:upper16:3f - 2f - 8
452:	add r0, pc
46	bx lr
47
48.data
49	.globl symbol
50	.hidden symbol
51symbol:	.long 23
523:	.long 17
53EOF
54libc_cv_arm_pcrel_movw=no
55${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
56	 -nostartfiles -nostdlib -shared \
57	 -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD &&
58LC_ALL=C $READELF -dr conftest.so > conftest.dr 2>&AS_MESSAGE_LOG_FD &&
59{
60  cat conftest.dr 1>&AS_MESSAGE_LOG_FD
61  fgrep 'TEXTREL
62R_ARM_NONE' conftest.dr > /dev/null || libc_cv_arm_pcrel_movw=yes
63}
64rm -f conftest*])
65if test $libc_cv_arm_pcrel_movw = yes; then
66  AC_DEFINE([ARM_PCREL_MOVW_OK])
67fi
68
69# This was buggy in assemblers from GNU binutils versions before 2.25.1
70# (it's known to be broken in 2.24 and 2.25; see
71# https://sourceware.org/bugzilla/show_bug.cgi?id=18383).
72AC_CACHE_CHECK([whether TPOFF relocs with addends are assembled correctly],
73	       libc_cv_arm_tpoff_addend, [
74cat > conftest.s <<\EOF
75	.syntax unified
76	.arm
77	.arch armv7-a
78
79	.text
80foo:
81	.word tbase(tpoff)+4
82
83	.section .tdata,"awT",%progbits
84	.word -4
85tbase:	.word 0
86	.word 4
87EOF
88libc_cv_arm_tpoff_addend=no
89${CC-cc} -c $CFLAGS $CPPFLAGS \
90	 -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD &&
91LC_ALL=C $READELF -x.text conftest.o > conftest.x 2>&AS_MESSAGE_LOG_FD &&
92{
93  cat conftest.x 1>&AS_MESSAGE_LOG_FD
94  $AWK 'BEGIN { result = 2 }
95$1 ~ /0x0+/ && $2 ~ /[[0-9a-f]]+/ {
96# Check for little-endian or big-endian encoding of 4 in the in-place addend.
97  result = ($2 == "04000000" || $2 == "00000004") ? 0 : 1
98}
99END { exit(result) }
100' conftest.x 2>&AS_MESSAGE_LOG_FD && libc_cv_arm_tpoff_addend=yes
101}
102rm -f conftest*])
103if test $libc_cv_arm_tpoff_addend = no; then
104  LIBC_CONFIG_VAR([test-xfail-tst-tlsalign], [yes])
105  LIBC_CONFIG_VAR([test-xfail-tst-tlsalign-static], [yes])
106fi
107
108
109libc_cv_gcc_unwind_find_fde=no
110
111# Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac.
112CFLAGS=${CFLAGS% -fno-unwind-tables}
113