configure.ac 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
  2. # Local configure fragment for sysdeps/arm.
  3. # We check to see if the compiler and flags are
  4. # selecting the hard-float ABI and if they are then
  5. # we set libc_cv_arm_pcs_vfp to yes which causes
  6. # HAVE_ARM_PCS_VFP to be defined in config.h and
  7. # in include/libc-symbols.h and thus available to
  8. # shlib-versions to select the appropriate name for
  9. # the dynamic linker via %ifdef.
  10. AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI],
  11. [libc_cv_arm_pcs_vfp],
  12. [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP
  13. yes
  14. #endif
  15. ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)])
  16. if test $libc_cv_arm_pcs_vfp = yes; then
  17. AC_DEFINE(HAVE_ARM_PCS_VFP)
  18. LIBC_CONFIG_VAR([default-abi], [hard])
  19. else
  20. LIBC_CONFIG_VAR([default-abi], [soft])
  21. fi
  22. AC_CACHE_CHECK([whether VFP supports 32 registers],
  23. libc_cv_arm_pcs_vfp_d32, [
  24. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  25. void foo (void)
  26. {
  27. asm volatile ("vldr d16,=17" : : : "d16");
  28. }
  29. ]])],
  30. [libc_cv_arm_pcs_vfp_d32=yes],
  31. [libc_cv_arm_pcs_vfp_d32=no])])
  32. if test "$libc_cv_arm_pcs_vfp_d32" = yes ;
  33. then
  34. AC_DEFINE(HAVE_ARM_PCS_VFP_D32)
  35. fi
  36. AC_CACHE_CHECK([whether PC-relative relocs in movw/movt work properly],
  37. libc_cv_arm_pcrel_movw, [
  38. cat > conftest.s <<\EOF
  39. .syntax unified
  40. .arm
  41. .arch armv7-a
  42. .text
  43. .globl foo
  44. .type foo,%function
  45. foo: movw r0, #:lower16:symbol - 1f - 8
  46. movt r0, #:upper16:symbol - 1f - 8
  47. 1: add r0, pc
  48. @ And now a case with a local symbol.
  49. movw r0, #:lower16:3f - 2f - 8
  50. movt r0, #:upper16:3f - 2f - 8
  51. 2: add r0, pc
  52. bx lr
  53. .data
  54. .globl symbol
  55. .hidden symbol
  56. symbol: .long 23
  57. 3: .long 17
  58. EOF
  59. libc_cv_arm_pcrel_movw=no
  60. ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
  61. -nostartfiles -nostdlib -shared \
  62. -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD &&
  63. LC_ALL=C $READELF -dr conftest.so > conftest.dr 2>&AS_MESSAGE_LOG_FD &&
  64. {
  65. cat conftest.dr 1>&AS_MESSAGE_LOG_FD
  66. grep -F 'TEXTREL
  67. R_ARM_NONE' conftest.dr > /dev/null || libc_cv_arm_pcrel_movw=yes
  68. }
  69. rm -f conftest*])
  70. if test $libc_cv_arm_pcrel_movw = yes; then
  71. AC_DEFINE([ARM_PCREL_MOVW_OK])
  72. fi
  73. # This was buggy in assemblers from GNU binutils versions before 2.25.1
  74. # (it's known to be broken in 2.24 and 2.25; see
  75. # https://sourceware.org/bugzilla/show_bug.cgi?id=18383).
  76. AC_CACHE_CHECK([whether TPOFF relocs with addends are assembled correctly],
  77. libc_cv_arm_tpoff_addend, [
  78. cat > conftest.s <<\EOF
  79. .syntax unified
  80. .arm
  81. .arch armv7-a
  82. .text
  83. foo:
  84. .word tbase(tpoff)+4
  85. .section .tdata,"awT",%progbits
  86. .word -4
  87. tbase: .word 0
  88. .word 4
  89. EOF
  90. libc_cv_arm_tpoff_addend=no
  91. ${CC-cc} -c $CFLAGS $CPPFLAGS \
  92. -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD &&
  93. LC_ALL=C $READELF -x.text conftest.o > conftest.x 2>&AS_MESSAGE_LOG_FD &&
  94. {
  95. cat conftest.x 1>&AS_MESSAGE_LOG_FD
  96. $AWK 'BEGIN { result = 2 }
  97. $1 ~ /0x0+/ && $2 ~ /[[0-9a-f]]+/ {
  98. # Check for little-endian or big-endian encoding of 4 in the in-place addend.
  99. result = ($2 == "04000000" || $2 == "00000004") ? 0 : 1
  100. }
  101. END { exit(result) }
  102. ' conftest.x 2>&AS_MESSAGE_LOG_FD && libc_cv_arm_tpoff_addend=yes
  103. }
  104. rm -f conftest*])
  105. if test $libc_cv_arm_tpoff_addend = no; then
  106. LIBC_CONFIG_VAR([test-xfail-tst-tlsalign], [yes])
  107. LIBC_CONFIG_VAR([test-xfail-tst-tlsalign-static], [yes])
  108. fi
  109. libc_cv_gcc_unwind_find_fde=no
  110. # Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac.
  111. CFLAGS=${CFLAGS% -fno-unwind-tables}