]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - configure.ac
posix/glob.c: update from gnulib
[thirdparty/glibc.git] / configure.ac
index 40f2de166184ed460e8aeef9d67399080580f444..a045f6608e60a314e6011e315f1041a8329ee06d 100644 (file)
@@ -153,7 +153,7 @@ AC_ARG_WITH([default-link],
            AS_HELP_STRING([--with-default-link],
                           [do not use explicit linker scripts]),
            [use_default_link=$withval],
-           [use_default_link=default])
+           [use_default_link=no])
 
 dnl Additional build flags injection.
 AC_ARG_WITH([nonshared-cflags],
@@ -767,7 +767,7 @@ if test x"$libc_cv_gcc_indirect_function" != xyes; then
   # GCC 8+ emits a warning for alias with incompatible types and it might
   # fail to build ifunc resolvers aliases to either weak or internal
   # symbols.  Disables multiarch build in this case.
-  if test x"$libc_cv_gcc_incompatible_alias" == xyes; then
+  if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
     AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
     if test x"$multi_arch" = xyes; then
       AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
@@ -1324,37 +1324,6 @@ if test $libc_cv_as_noexecstack = yes; then
 fi
 AC_SUBST(ASFLAGS_config)
 
-AC_CACHE_CHECK(for -z combreloc,
-              libc_cv_z_combreloc, [dnl
-cat > conftest.c <<EOF
-extern int bar (int);
-extern int mumble;
-int foo (void) { return bar (mumble); }
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-                       -fPIC -shared $no_ssp -o conftest.so conftest.c
-                       -nostdlib -nostartfiles
-                       -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
-then
-dnl The following test is a bit weak.  We must use a tool which can test
-dnl cross-platform since the gcc used can be a cross compiler.  Without
-dnl introducing new options this is not easily doable.  Instead use a tool
-dnl which always is cross-platform: readelf.  To detect whether -z combreloc
-dnl look for a section named .rel.dyn or .rela.dyn.
-  if $READELF -S conftest.so | grep -E '.rela?.dyn' > /dev/null; then
-    libc_cv_z_combreloc=yes
-  else
-    libc_cv_z_combreloc=no
-  fi
-else
-  libc_cv_z_combreloc=no
-fi
-rm -f conftest*])
-if test "$libc_cv_z_combreloc" = yes; then
-  AC_DEFINE(HAVE_Z_COMBRELOC)
-fi
-AC_SUBST(libc_cv_z_combreloc)
-
 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
                    [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
 AC_SUBST(libc_cv_z_execstack)
@@ -1367,6 +1336,11 @@ LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
                    [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
 LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
 
+LIBC_LINKER_FEATURE([-z pack-relative-relocs],
+                   [-Wl,-z,pack-relative-relocs],
+                   [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
+LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
+
 LIBC_LINKER_FEATURE([--no-dynamic-linker],
                    [-Wl,--no-dynamic-linker],
                    [libc_cv_no_dynamic_linker=yes],
@@ -1402,59 +1376,6 @@ fi
 rm -f conftest*])
 AC_SUBST(libc_cv_hashstyle)
 
-# The linker's default -shared behavior is good enough if it
-# does these things that our custom linker scripts ensure that
-# all allocated NOTE sections come first.
-if test "$use_default_link" = default; then
-  AC_CACHE_CHECK([for sufficient default -shared layout],
-                 libc_cv_use_default_link, [dnl
-  libc_cv_use_default_link=no
-  cat > conftest.s <<\EOF
-         .section .note.a,"a",%note
-         .balign 4
-         .long 4,4,9
-         .string "GNU"
-         .string "foo"
-         .section .note.b,"a",%note
-         .balign 4
-         .long 4,4,9
-         .string "GNU"
-         .string "bar"
-EOF
-  if AC_TRY_COMMAND([dnl
-  ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
-       ac_try=`$READELF -S conftest.so | sed -n \
-        ['${x;p;}
-         s/^ *\[ *[1-9][0-9]*\]  *\([^ ][^ ]*\)  *\([^ ][^ ]*\) .*$/\2 \1/
-         t a
-         b
-         : a
-         H']`
-  then
-    libc_seen_a=no libc_seen_b=no
-    set -- $ac_try
-    while test $# -ge 2 -a "$1" = NOTE; do
-      case "$2" in
-      .note.a) libc_seen_a=yes ;;
-      .note.b) libc_seen_b=yes ;;
-      esac
-      shift 2
-    done
-    case "$libc_seen_a$libc_seen_b" in
-    yesyes)
-      libc_cv_use_default_link=yes
-      ;;
-    *)
-      echo >&AS_MESSAGE_LOG_FD "\
-$libc_seen_a$libc_seen_b from:
-$ac_try"
-      ;;
-    esac
-  fi
-  rm -f conftest*])
-  use_default_link=$libc_cv_use_default_link
-fi
-
 AC_CACHE_CHECK(for GLOB_DAT reloc,
               libc_cv_has_glob_dat, [dnl
 cat > conftest.c <<EOF
@@ -1868,28 +1789,40 @@ rm -f conftest.*])
 LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
 
 AC_MSG_CHECKING(if we can build programs as PIE)
-if test "x$default_pie" != xno; then
-  # Disable build-pie-default if target does not support it.
-  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
 # error PIE is not supported
-#endif]])], [libc_cv_pie_default=yes], [libc_cv_pie_default=no])
+#endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
+AC_MSG_RESULT($libc_cv_pie_supported)
+# Disable build-pie-default if target does not support it or glibc is
+# configured with --disable-default-pie.
+if test "x$default_pie" = xno; then
+  build_pie_default=no
+else
+  build_pie_default=$libc_cv_pie_supported
 fi
-AC_MSG_RESULT($libc_cv_pie_default)
-LIBC_CONFIG_VAR([build-pie-default], [$libc_cv_pie_default])
+LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
 
 AC_MSG_CHECKING(if we can build static PIE programs)
-libc_cv_static_pie=$libc_cv_pie_default
-if test "x$libc_cv_pie_default" != xno \
+libc_cv_static_pie_supported=$libc_cv_pie_supported
+if test "x$libc_cv_pie_supported" != xno \
    -a "$libc_cv_no_dynamic_linker" = yes; then
-  # Enable static-pie if available
   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
 # error static PIE is not supported
-#endif]])], [libc_cv_static_pie=yes], [libc_cv_static_pie=no])
-  if test "$libc_cv_static_pie" = "yes"; then
-    AC_DEFINE(ENABLE_STATIC_PIE)
-  fi
+#endif]])], [libc_cv_static_pie_supported=yes],
+           [libc_cv_static_pie_supported=no])
+fi
+AC_MSG_RESULT($libc_cv_static_pie_supported)
+
+# Enable static-pie only if it is available and glibc isn't configured
+# with --disable-default-pie.
+if test "x$default_pie" = xno; then
+  libc_cv_static_pie=no
+else
+  libc_cv_static_pie=$libc_cv_static_pie_supported
+fi
+if test "$libc_cv_static_pie" = "yes"; then
+  AC_DEFINE(ENABLE_STATIC_PIE)
 fi
-AC_MSG_RESULT($libc_cv_static_pie)
 LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
 
 # Set the `multidir' variable by grabbing the variable from the compiler.