Remove relro configure test.
[platform/upstream/linaro-glibc.git] / configure.ac
index f3dd87d..566ecb2 100644 (file)
@@ -184,6 +184,7 @@ AC_ARG_ENABLE([lock-elision],
                             [Enable lock elision for pthread mutexes by default]),
              [enable_lock_elision=$enableval],
              [enable_lock_elision=no])
+AC_SUBST(enable_lock_elision)
 if test "$enable_lock_elision" = yes ; then
   AC_DEFINE(ENABLE_LOCK_ELISION)
 fi
@@ -397,19 +398,6 @@ vendor=$config_vendor
 os=$config_os
 base_os=''
 
-# config.guess on some IBM machines says `rs6000' instead of `powerpc'.
-# Unify this here.
-if test "$machine" = rs6000; then
-  machine="powerpc"
-fi
-
-# Braindead PowerPC box with absolutely no FPU.
-case "$machine-$host_os" in
-  powerpc*-*soft)
-    with_fp=no
-    ;;
-esac
-
 submachine=
 AC_ARG_WITH([cpu],
            AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
@@ -581,48 +569,10 @@ if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
   esac
 fi
 
-dnl We need to use [ and ] for other purposes for a while now.
-changequote(,)dnl
-# Expand the configuration machine name into a subdirectory by architecture
-# type and particular chip.  If an add-on configure fragment already set
-# base_machine, we don't change it.
-test -n "$base_machine" || case "$machine" in
-i[4567]86)     base_machine=i386 machine=i386/$machine ;;
-powerpc64*)    base_machine=powerpc machine=powerpc/powerpc64 ;;
-powerpc*)      base_machine=powerpc machine=powerpc/powerpc32 ;;
-s390)           base_machine=s390 machine=s390/s390-32 ;;
-s390x)          base_machine=s390 machine=s390/s390-64 ;;
-sh3*)          base_machine=sh machine=sh/sh3 ;;
-sh4*)          base_machine=sh machine=sh/sh4 ;;
-sparc | sparcv[67])
-               base_machine=sparc machine=sparc/sparc32 ;;
-sparcv8 | supersparc | hypersparc)
-               base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
-sparcv8plus | sparcv8plusa | sparcv9)
-               base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
-sparcv8plusb | sparcv9b)
-               base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
-sparcv9v)
-               base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
-sparcv9v2)
-               base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
-sparc64)
-               base_machine=sparc machine=sparc/sparc64 ;;
-sparc64b)
-               base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
-sparc64v)
-               base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
-sparc64v2)
-               base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
-*)             base_machine=$machine ;;
-esac
-changequote([,])dnl
+# Set base_machine if not set by a preconfigure fragment.
+test -n "$base_machine" || base_machine=$machine
 AC_SUBST(base_machine)
 
-if test "$base_machine" = "i386"; then
-  AC_DEFINE(USE_REGPARMS)
-fi
-
 # For the multi-arch option we need support in the assembler & linker.
 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
               libc_cv_ld_gnu_indirect_function, [dnl
@@ -1099,29 +1049,6 @@ fi])
 AC_SUBST(libc_cv_gcc_static_libgcc)
 
 AC_PATH_PROG(BASH_SHELL, bash, no)
-if test "$BASH_SHELL" != no &&
-   $BASH_SHELL -c 'test "$BASH_VERSINFO" \
-            && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
-  libc_cv_have_bash2=yes
-else
-  libc_cv_have_bash2=no
-fi
-AC_SUBST(libc_cv_have_bash2)
-
-dnl We need a ksh compatible shell for tzselect.
-if test "$BASH_SHELL" = no; then
-  AC_PATH_PROG(KSH, ksh, no)
-  if test "$KSH" = no; then
-    libc_cv_have_ksh=no
-  else
-    libc_cv_have_ksh=yes
-  fi
-else
-  KSH="$BASH_SHELL"
-  AC_SUBST(KSH)
-  libc_cv_have_ksh=yes
-fi
-AC_SUBST(libc_cv_have_ksh)
 
 AC_PATH_PROG(PERL, perl, no)
 if test "$PERL" != no &&
@@ -1415,73 +1342,6 @@ LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
                    [libc_cv_z_initfirst=yes],
                    [AC_MSG_ERROR(linker with -z initfirst support required)])
 
-# Add-on fragments can set these for other machines.
-libc_commonpagesize=${libc_commonpagesize:-no}
-libc_relro_required=${libc_relro_required:-no}
-case "$base_machine" in
-  i[[34567]]86 | x86_64 | powerpc* | s390*)
-    libc_commonpagesize=0x1000
-    libc_relro_required=yes
-    ;;
-  sparc*)
-    libc_commonpagesize=0x2000
-    libc_relro_required=yes
-    ;;
-esac
-
-if test $libc_commonpagesize != no; then
-  AC_CACHE_CHECK(for -z relro option,
-                libc_cv_z_relro, [dnl
-  libc_cv_z_relro=no
-  AC_LANG_CONFTEST([AC_LANG_SOURCE([[
-int _start (void) { return 42; }
-extern void _exit (int);
-/* Since these pointers are const, they should go in rodata.
-   Since they refer to functions that have to be resolved by
-   dynamic linking, they should instead go in RELRO data.  */
-const void *const relro[] = { &_start, &_exit, 0 };
-/* GNU ld fails to produce RELRO data when it's very small and there is no
-   normal writable data following it, or if only uninitialized (.bss) data
-   follows it, or only very small writable data.  */
-int data[0x10000] = { 1, };
-]])])
-  cat > conftest.awk <<\EOF
-BEGIN {
-  result = "no"
-  commonpagesize = strtonum(commonpagesize)
-}
-{ print "LINE:", $0 > "/dev/stderr" }
-$1 == "GNU_RELRO" {
-  vaddr = strtonum($3)
-  memsz = strtonum($6)
-  end = vaddr + memsz
-  printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
-    vaddr, memsz, end, commonpagesize > "/dev/stderr"
-  result = (end % commonpagesize == 0) ? "yes" : "broken"
-}
-END { print result }
-EOF
-  AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-                   -fPIC -shared -o conftest.so conftest.c
-                   -nostartfiles -nostdlib
-                   -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
-  AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
-  AC_TRY_COMMAND([
-      $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
-          conftest.ph > conftest.cps
-    ]) &&
-  libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
-  rm -f conftest*])
-  if { test "x$libc_relro_required" = xyes &&
-       test "x$libc_cv_z_relro" != xyes
-     }
-  then
-    AC_MSG_ERROR(linker with -z relro support required)
-  fi
-else
-  AC_MSG_WARN([missing architecture parameter to check for working -z relro])
-fi
-
 AC_CACHE_CHECK(for -Bgroup option,
               libc_cv_Bgroup, [dnl
 cat > conftest.c <<EOF
@@ -1756,30 +1616,6 @@ elif test $libc_cv_asm_weakext_directive = yes; then
   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
 fi
 
-AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
-case $machine in
-  sparc/sparc64*) cfi_offset=2047;;
-  *) cfi_offset=0;;
-esac
-cat > conftest.s <<EOF
-       .text
-       .type   func,%function
-func:
-       .cfi_startproc
-       .cfi_remember_state
-       .cfi_rel_offset 1, $cfi_offset
-       .cfi_endproc
-EOF
-if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
-  libc_cv_asm_cfi_directives=yes
-else
-  libc_cv_asm_cfi_directives=no
-fi
-rm -f conftest*])
-if test $libc_cv_asm_cfi_directives = yes; then
-  AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
-fi
-
 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
 cat > conftest.c <<\EOF
 _start () {}
@@ -1819,18 +1655,6 @@ if test $libc_cv_gcc_exceptions = yes; then
 fi
 AC_SUBST(exceptions)dnl
 
-if test "$host_cpu" = powerpc ; then
-# Check for a bug present in at least versions 2.8.x of GCC
-# and versions 1.0.x of EGCS.
-AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
-AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
-              libc_cv_c_asmcr0_bug='no',
-              libc_cv_c_asmcr0_bug='yes')])
-if test "$libc_cv_c_asmcr0_bug" != 'no'; then
-  AC_DEFINE(BROKEN_PPC_ASM_CR0)
-fi
-fi
-
 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
 cat > conftest.c <<\EOF
 void zero (void *x)
@@ -1968,22 +1792,9 @@ else
   # See if we have the SELinux library
   AC_CHECK_LIB(selinux, is_selinux_enabled,
               have_selinux=yes, have_selinux=no)
-  # See if we have the SELinux header with the NSCD permissions in it.
-  if test x$have_selinux = xyes ; then
-    AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
-    AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
-                   [#ifdef NSCD__SHMEMHOST
-                    return 0;
-                    #else
-                    #error NSCD__SHMEMHOST not defined
-                    #endif],
-                   have_selinux=yes, have_selinux=no)
-    AC_MSG_RESULT($have_selinux)
-  fi
-
   if test x$with_selinux = xyes ; then
     if test x$have_selinux = xno ; then
-      AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
+      AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
     fi
   fi
 fi
@@ -2065,9 +1876,30 @@ esac],
 ])
 libc_extra_cflags=
 if test $libc_cv_predef_stack_protector = yes; then
-  libc_extra_cflags=-fno-stack-protector
+  libc_extra_cflags="$libc_extra_cflags -fno-stack-protector"
+fi
+libc_extra_cppflags=
+
+AC_CACHE_CHECK([whether the linker provides __ehdr_start],
+              libc_cv_ehdr_start, [
+old_CFLAGS="$CFLAGS"
+old_LDFLAGS="$LDFLAGS"
+old_LIBS="$LIBS"
+CFLAGS="$CFLAGS -fPIC"
+LDFLAGS="$LDFLAGS -nostdlib -nostartfiles -shared"
+LIBS=
+AC_LINK_IFELSE([AC_LANG_SOURCE([
+extern const char __ehdr_start __attribute__ ((visibility ("hidden")));
+const char *ehdr (void) { return &__ehdr_start; }
+])],
+              [libc_cv_ehdr_start=yes], [libc_cv_ehdr_start=no])
+CFLAGS="$old_CFLAGS"
+LDFLAGS="$old_LDFLAGS"
+LIBS="$old_LIBS"
+])
+if test $libc_cv_ehdr_start = yes; then
+  AC_DEFINE([HAVE_EHDR_START])
 fi
-AC_SUBST(libc_extra_cflags)
 
 ### End of automated tests.
 ### Now run sysdeps configure fragments.
@@ -2093,6 +1925,9 @@ for dir in $sysnames; do
   fi
 done
 
+AC_SUBST(libc_extra_cflags)
+AC_SUBST(libc_extra_cppflags)
+
 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
 fi