about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-06-27 16:51:22 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-06-27 16:51:22 +0000
commitcb403c34c6f6e1cce5018864485958cfc2e28906 (patch)
tree6e49a1ac806649d16b3041e930cee0b032dc6a84
parentbe25493251c014a696b62834b0e63b155d8fe353 (diff)
downloadglibc-cb403c34c6f6e1cce5018864485958cfc2e28906.tar.gz
glibc-cb403c34c6f6e1cce5018864485958cfc2e28906.tar.xz
glibc-cb403c34c6f6e1cce5018864485958cfc2e28906.zip
Remove relro configure test.
This patch removes the configure test for working -z relro.

The use of -z relro in Makeconfig became unconditional with

commit 2e6ab1df44c412bb9d30b26a4d8a679150a7e375
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Sat Oct 28 06:44:04 2006 +0000

    Remove conditional code which now is unnecessary.

(commit reference from git://repo.or.cz/glibc/history), so since then
the configure test has not controlled anything about how glibc is
built - simply about whether configure succeeds and allows a build to
be attempted.  The test for whether the option did something useful
(as opposed to whether it exists - which we can certainly just assume
by now) was originally added in
<https://sourceware.org/ml/libc-hacker/2004-09/msg00069.html> to
disable the option in a case when it did nothing useful on ia64 (as a
result of something deliberate in the linker on ia64).  Since 2006
that disabling has been of no effect, and given that the current test
does not set libc_relro_required for ia64, it does nothing whatever
useful for the original motivating case.  Also at around the same time
in 2006 the test was made to give an error for missing or broken -z
relro support on various architectures.

So effectively all the test does now is verify that, on certain
architectures, the linker has not been changed deliberately to make
the option ineffective.  I see no apparent reason why such a change
should be expected, or why the build should be stopped if it were to
be made (any more than we disallow build on ia64); I think we can
trust binutils patch review to point out the consequences of any
change to COMMONPAGESIZE setting.  The only thing that might now make
sense would be disabling the -z relro use on an architecture-specific
basis if there were an architecture-specific reason to consider that
to make sense; it would be for the ia64 maintainer to decide if that
makes sense for ia64 at present, but I think that could be done
through sysdeps Makefiles - no special configure tests needed.

Tested for x86_64 that this patch makes no change to the installed
shared libraries.

Together with
<https://sourceware.org/ml/libc-alpha/2014-06/msg00788.html> (pending
review) this substantially eliminates architecture-specific cases from
architecture-independent configure.ac files.  There remains an i386
case in sysdeps/mach/hurd/configure.ac that should properly move to
the i386 subdirectory.  (There are also OS-specific cases outside
OS-specific directories; in principle I think should should also
move.)

	* configure.ac (libc_commonpagesize): Remove variable.
	(libc_relro_required): Likewise.
	(libc_cv_z_relro): Remove configure test.
	* configure: Regenerated.
	* sysdeps/aarch64/preconfigure (libc_commonpagesize): Do not set
	variable.
	(libc_relro_required): Likewise.
	* sysdeps/alpha/preconfigure (libc_commonpagesize): Likewise.
	(libc_relro_required): Likewise.
	* sysdeps/arm/preconfigure.ac (libc_commonpagesize): Likewise.
	(libc_relro_required): Likewise.
	* sysdeps/arm/preconfigure: Regenerated.
	* sysdeps/ia64/preconfigure: Remove file.
	* sysdeps/tile/preconfigure (libc_commonpagesize): Do not set
	variable.
	(libc_relro_required): Likewise.
-rw-r--r--ChangeLog17
-rwxr-xr-xconfigure92
-rw-r--r--configure.ac67
-rw-r--r--sysdeps/aarch64/preconfigure8
-rw-r--r--sysdeps/alpha/preconfigure3
-rw-r--r--sysdeps/arm/preconfigure8
-rw-r--r--sysdeps/arm/preconfigure.ac8
-rw-r--r--sysdeps/ia64/preconfigure3
-rw-r--r--sysdeps/tile/preconfigure5
9 files changed, 17 insertions, 194 deletions
diff --git a/ChangeLog b/ChangeLog
index 027bf9df1a..510e78ac0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
 2014-06-27  Joseph Myers  <joseph@codesourcery.com>
 
+	* configure.ac (libc_commonpagesize): Remove variable.
+	(libc_relro_required): Likewise.
+	(libc_cv_z_relro): Remove configure test.
+	* configure: Regenerated.
+	* sysdeps/aarch64/preconfigure (libc_commonpagesize): Do not set
+	variable.
+	(libc_relro_required): Likewise.
+	* sysdeps/alpha/preconfigure (libc_commonpagesize): Likewise.
+	(libc_relro_required): Likewise.
+	* sysdeps/arm/preconfigure.ac (libc_commonpagesize): Likewise.
+	(libc_relro_required): Likewise.
+	* sysdeps/arm/preconfigure: Regenerated.
+	* sysdeps/ia64/preconfigure: Remove file.
+	* sysdeps/tile/preconfigure (libc_commonpagesize): Do not set
+	variable.
+	(libc_relro_required): Likewise.
+
 	[BZ #16561]
 	[BZ #16562]
 	* sysdeps/ieee754/dbl-64/e_jn.c: Include <float.h>.
diff --git a/configure b/configure
index ea44f64dc5..c8d2967f9e 100755
--- a/configure
+++ b/configure
@@ -5940,98 +5940,6 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
 $as_echo "$libc_linker_feature" >&6; }
 
-# 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
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z relro option" >&5
-$as_echo_n "checking for -z relro option... " >&6; }
-if ${libc_cv_z_relro+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-    libc_cv_z_relro=no
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-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, };
-
-_ACEOF
-  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='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-		    -fPIC -shared -o conftest.so conftest.c
-		    -nostartfiles -nostdlib
-		    -Wl,-z,relro 1>&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } &&
-  { ac_try='$READELF -Wl conftest.so > conftest.ph'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } &&
-  { ac_try='
-      $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
-	   conftest.ph > conftest.cps
-    '
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } &&
-  libc_cv_z_relro=`cat conftest.cps 2>&5`
-  rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_relro" >&5
-$as_echo "$libc_cv_z_relro" >&6; }
-  if { test "x$libc_relro_required" = xyes &&
-       test "x$libc_cv_z_relro" != xyes
-     }
-  then
-    as_fn_error $? "linker with -z relro support required" "$LINENO" 5
-  fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: missing architecture parameter to check for working -z relro" >&5
-$as_echo "$as_me: WARNING: missing architecture parameter to check for working -z relro" >&2;}
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Bgroup option" >&5
 $as_echo_n "checking for -Bgroup option... " >&6; }
 if ${libc_cv_Bgroup+:} false; then :
diff --git a/configure.ac b/configure.ac
index f8d78608c0..566ecb276d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1342,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
diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure
index 720c1d7dae..d9bd1f8558 100644
--- a/sysdeps/aarch64/preconfigure
+++ b/sysdeps/aarch64/preconfigure
@@ -4,11 +4,3 @@ aarch64*)
 	machine=aarch64
 	;;
 esac
-
-case "$machine" in
-aarch64*)
-	# Parameters to allow auto-detection of -z relro.
-	libc_commonpagesize=0x1000
-	libc_relro_required=yes
-	;;
-esac
diff --git a/sysdeps/alpha/preconfigure b/sysdeps/alpha/preconfigure
index 6412a136f4..cb02cffc3a 100644
--- a/sysdeps/alpha/preconfigure
+++ b/sysdeps/alpha/preconfigure
@@ -1,6 +1,3 @@
 case "$machine" in
 alpha*)		base_machine=alpha machine=alpha/$machine
-		# Parameters to allow auto-detection of -z relro.
-		libc_commonpagesize=0x2000
-		libc_relro_required=yes ;;
 esac
diff --git a/sysdeps/arm/preconfigure b/sysdeps/arm/preconfigure
index 74869b10a8..b3124edae2 100644
--- a/sysdeps/arm/preconfigure
+++ b/sysdeps/arm/preconfigure
@@ -61,11 +61,3 @@ $as_echo "$as_me: WARNING: arm/preconfigure: Did not find ARM architecture type;
 
   machine=arm/$machine
 esac
-
-case "$machine" in
-arm*)
-	# Parameters to allow auto-detection of -z relro.
-	libc_commonpagesize=0x1000
-	libc_relro_required=yes
-	;;
-esac
diff --git a/sysdeps/arm/preconfigure.ac b/sysdeps/arm/preconfigure.ac
index 29a260c30b..39c86218aa 100644
--- a/sysdeps/arm/preconfigure.ac
+++ b/sysdeps/arm/preconfigure.ac
@@ -56,11 +56,3 @@ arm*)
 
   machine=arm/$machine
 esac
-
-case "$machine" in
-arm*)
-	# Parameters to allow auto-detection of -z relro.
-	libc_commonpagesize=0x1000
-	libc_relro_required=yes
-	;;
-esac
diff --git a/sysdeps/ia64/preconfigure b/sysdeps/ia64/preconfigure
deleted file mode 100644
index 76cb729fcf..0000000000
--- a/sysdeps/ia64/preconfigure
+++ /dev/null
@@ -1,3 +0,0 @@
-case "$machine" in
-ia64*)		libc_commonpagesize=0x4000 ;;
-esac
diff --git a/sysdeps/tile/preconfigure b/sysdeps/tile/preconfigure
index 9dba5b1040..dfe050cc6d 100644
--- a/sysdeps/tile/preconfigure
+++ b/sysdeps/tile/preconfigure
@@ -10,8 +10,3 @@ case "$machine" in
 	    machine=tile/tilegx/tilegx32
 	fi ;;
 esac
-case "$machine" in
-    tile*)
-	libc_commonpagesize=0x10000
-	libc_relro_required=yes ;;
-esac