diff options
author | Roland McGrath <roland@gnu.org> | 2003-09-23 12:07:26 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2003-09-23 12:07:26 +0000 |
commit | 2abf9ff11384a47dc456c138a8faf6b1469aac2b (patch) | |
tree | d0ccba6b9bf3096c8d1d2d209984bf4d28597408 | |
parent | ecdeaac05f73c29eca92eecd55ad4fb8513c7771 (diff) | |
download | glibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.tar.gz glibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.tar.xz glibc-2abf9ff11384a47dc456c138a8faf6b1469aac2b.zip |
* sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before
calling _dl_start, using GOTOFF access. * configure.in (libc_cv_z_execstack): New check. * configure: Regenerated. * config.make.in (have-z-execstack): New variable set by it. * elf/tst-execstack.c: New file. * elf/tst-execstack-mod.c: New file. * elf/tst-execstack-needed.c: New file. * elf/Makefile (tests-execstack-yes, modules-execstack-yes): New variables. (tests, modules-names): Conditionally include them. (distribute): Add tst-execstack-mod.c here. ($(objpfx)tst-execstack, $(objpfx)tst-execstack.out): New targets. (LDFLAGS-tst-execstack, LDFLAGS-tst-execstack-mod): New variables. ($(objpfx)tst-execstack-needed): New target. (LDFLAGS-tst-execstack-needed): New variable. * sysdeps/generic/ldsodefs.h (struct rtld_global): Add _dl_stack_flags and _dl_make_stack_executable_hook. Declare _dl_make_stack_executable. * elf/rtld.c (_rtld_global): Add initializer for _dl_stack_flags. (dl_main): Reset _dl_stack_flags according to PT_GNU_STACK phdr. Initialize _dl_make_stack_executable_hook. * elf/dl-support.c: Define those new variables. (_dl_non_dynamic_init): Scan phdrs for PT_GNU_STACK. (_dl_phdr): Fix type. * elf/dl-load.c (_dl_map_object_from_fd): Grok PT_GNU_STACK phdr and enable execute permission for the stack if necessary. * sysdeps/generic/dl-execstack.c: New file. * elf/Makefile (dl-routines): Add it. * elf/Versions (ld: GLIBC_PRIVATE): Add _dl_make_stack_executable. * sysdeps/unix/sysv/linux/dl-execstack.c: New file.
-rw-r--r-- | ChangeLog | 35 | ||||
-rw-r--r-- | config.make.in | 1 | ||||
-rwxr-xr-x | configure | 542 | ||||
-rw-r--r-- | configure.in | 20 | ||||
-rw-r--r-- | elf/Makefile | 21 | ||||
-rw-r--r-- | elf/tst-execstack-mod.c | 30 | ||||
-rw-r--r-- | elf/tst-execstack-needed.c | 36 | ||||
-rw-r--r-- | elf/tst-execstack.c | 133 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 11 |
9 files changed, 683 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog index c05bc4ebe2..528df36a49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2003-09-23 Roland McGrath <roland@redhat.com> + + * sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before + calling _dl_start, using GOTOFF access. + + * configure.in (libc_cv_z_execstack): New check. + * configure: Regenerated. + * config.make.in (have-z-execstack): New variable set by it. + * elf/tst-execstack.c: New file. + * elf/tst-execstack-mod.c: New file. + * elf/tst-execstack-needed.c: New file. + * elf/Makefile (tests-execstack-yes, modules-execstack-yes): New + variables. + (tests, modules-names): Conditionally include them. + (distribute): Add tst-execstack-mod.c here. + ($(objpfx)tst-execstack, $(objpfx)tst-execstack.out): New targets. + (LDFLAGS-tst-execstack, LDFLAGS-tst-execstack-mod): New variables. + ($(objpfx)tst-execstack-needed): New target. + (LDFLAGS-tst-execstack-needed): New variable. + + * sysdeps/generic/ldsodefs.h (struct rtld_global): Add _dl_stack_flags + and _dl_make_stack_executable_hook. Declare _dl_make_stack_executable. + * elf/rtld.c (_rtld_global): Add initializer for _dl_stack_flags. + (dl_main): Reset _dl_stack_flags according to PT_GNU_STACK phdr. + Initialize _dl_make_stack_executable_hook. + * elf/dl-support.c: Define those new variables. + (_dl_non_dynamic_init): Scan phdrs for PT_GNU_STACK. + (_dl_phdr): Fix type. + * elf/dl-load.c (_dl_map_object_from_fd): Grok PT_GNU_STACK phdr and + enable execute permission for the stack if necessary. + * sysdeps/generic/dl-execstack.c: New file. + * elf/Makefile (dl-routines): Add it. + * elf/Versions (ld: GLIBC_PRIVATE): Add _dl_make_stack_executable. + * sysdeps/unix/sysv/linux/dl-execstack.c: New file. + 2003-09-23 Ulrich Drepper <drepper@redhat.com> * sysdeps/posix/sprofil.c (pc_to_index): Remove inline marker. diff --git a/config.make.in b/config.make.in index 71ccf7131a..21d01f9bc6 100644 --- a/config.make.in +++ b/config.make.in @@ -42,6 +42,7 @@ have-z-nodelete = @libc_cv_z_nodelete@ have-z-nodlopen = @libc_cv_z_nodlopen@ have-z-initfirst = @libc_cv_z_initfirst@ have-z-combreloc = @libc_cv_z_combreloc@ +have-z-execstack = @libc_cv_z_execstack@ have-initfini = @libc_cv_have_initfini@ have-Bgroup = @libc_cv_Bgroup@ need-nopic-initfini = @nopic_initfini@ diff --git a/configure b/configure index 2087db5046..6f8d6c8dce 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in CVSid. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.54 for GNU C Library (see version.h). +# Generated by GNU Autoconf 2.57 for GNU C Library (see version.h). # # Report bugs to <glibc>. # @@ -39,7 +39,10 @@ PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var @@ -85,15 +88,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -309,7 +312,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF CCVERSION SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO OLD_DEBIAN_INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_Bgroup ASFLAGS_config libc_cv_z_combreloc libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi subdirs force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF CCVERSION SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO OLD_DEBIAN_INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_Bgroup ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_have_initfini libc_cv_cpp_asm_debuginfo no_whole_archive exceptions LIBGD EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES linux_doors mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -976,7 +979,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF GNU C Library configure (see version.h) -generated by GNU Autoconf 2.54 +generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. @@ -991,7 +994,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU C Library $as_me (see version.h), which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1043,24 +1046,54 @@ _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= +ac_configure_args0= +ac_configure_args1= ac_sep= -for ac_arg +ac_must_keep_next=false +for ac_pass in 1 2 do - case $ac_arg in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n ) continue ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -2492,8 +2525,10 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. @@ -2524,7 +2559,11 @@ if test "${ac_cv_objext+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -2549,9 +2588,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -2568,7 +2610,11 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -2596,7 +2642,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2616,7 +2663,11 @@ if test "${ac_cv_prog_cc_g+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -2641,7 +2692,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -2672,7 +2724,11 @@ else ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> #include <sys/types.h> @@ -2735,7 +2791,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext done @@ -2786,7 +2843,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> $ac_declaration int @@ -2812,13 +2873,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 : else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration int main () @@ -2843,7 +2909,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext conftest.$ac_ext done @@ -2856,7 +2923,8 @@ fi else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c @@ -2931,12 +2999,22 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -2959,7 +3037,8 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -2969,7 +3048,11 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -2993,7 +3076,8 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -3022,12 +3106,22 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -3050,7 +3144,8 @@ if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi @@ -3060,7 +3155,11 @@ rm -f conftest.err conftest.$ac_ext # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 @@ -3084,7 +3183,8 @@ if test -z "$ac_cpp_err"; then continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break @@ -3097,8 +3197,10 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -3229,7 +3331,11 @@ if test "${ac_cv_cxx_compiler_gnu+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3257,7 +3363,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3277,7 +3384,11 @@ if test "${ac_cv_prog_cxx_g+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3302,7 +3413,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -3335,7 +3447,11 @@ for ac_declaration in \ do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> $ac_declaration int @@ -3361,13 +3477,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 : else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_declaration int main () @@ -3392,7 +3513,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi rm -f conftest.$ac_objext conftest.$ac_ext done @@ -4540,7 +4662,11 @@ if test "${libc_cv_friendly_stddef+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define __need_size_t #define __need_wchar_t #include <stddef.h> @@ -4573,7 +4699,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 libc_cv_friendly_stddef=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + libc_cv_friendly_stddef=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -5260,6 +5387,7 @@ echo "${ECHO_T}$libc_cv_as_noexecstack" >&6 ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack" fi + echo "$as_me:$LINENO: checking for -z combreloc" >&5 echo $ECHO_N "checking for -z combreloc... $ECHO_C" >&6 if test "${libc_cv_z_combreloc+set}" = set; then @@ -5298,8 +5426,36 @@ echo "${ECHO_T}$libc_cv_z_combreloc" >&6 _ACEOF fi + + + echo "$as_me:$LINENO: checking for -z execstack" >&5 +echo $ECHO_N "checking for -z execstack... $ECHO_C" >&6 +if test "${libc_cv_z_execstack+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.c <<EOF +int _start (void) { return 42; } +EOF + if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS + -shared -o conftest.so conftest.c + -Wl,-z,execstack -nostdlib + 1>&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } + then + libc_cv_z_execstack=yes + else + libc_cv_z_execstack=no + fi + rm -f conftest* fi +echo "$as_me:$LINENO: result: $libc_cv_z_execstack" >&5 +echo "${ECHO_T}$libc_cv_z_execstack" >&6 +fi if test $elf != yes; then echo "$as_me:$LINENO: checking for .init and .fini sections" >&5 @@ -5309,7 +5465,11 @@ if test "${libc_cv_have_initfini+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -5336,7 +5496,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 libc_cv_have_initfini=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + libc_cv_have_initfini=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -5396,7 +5557,11 @@ if test "${libc_cv_asm_underscores+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ asm ("_glibc_foobar:"); int main () @@ -5421,7 +5586,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 libc_cv_asm_underscores=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + libc_cv_asm_underscores=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -5745,7 +5911,11 @@ if test "${libc_cv_c_asmcr0_bug+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int tester(int x) { asm ("" : : : "cc"); return x & 123; } int main () @@ -5770,7 +5940,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 libc_cv_c_asmcr0_bug='no' else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + libc_cv_c_asmcr0_bug='yes' fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -6098,7 +6269,11 @@ if test "$with_gd" != "no"; then LIBS="$LIBS -lgd -lpng -lz -lm" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <gd.h> int main () @@ -6123,7 +6298,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 LIBGD=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + LIBGD=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext @@ -6160,43 +6336,54 @@ if test "${ac_cv_header_stdc+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> +int +main () +{ + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <string.h> _ACEOF @@ -6214,7 +6401,11 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> _ACEOF @@ -6235,13 +6426,18 @@ if test $ac_cv_header_stdc = yes; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) @@ -6274,7 +6470,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) ac_cv_header_stdc=no fi @@ -6313,7 +6510,11 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> @@ -6333,7 +6534,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -6357,7 +6559,11 @@ if test "${ac_cv_type_long_double+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6385,7 +6591,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_cv_type_long_double=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_long_double=no fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -6407,7 +6614,11 @@ else # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6435,7 +6646,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6462,7 +6677,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -6474,10 +6690,15 @@ rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6505,7 +6726,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 while :; do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6532,7 +6757,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -6544,7 +6770,8 @@ rm -f conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_lo= ac_hi= fi rm -f conftest.$ac_objext conftest.$ac_ext @@ -6555,7 +6782,11 @@ while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default int main () @@ -6582,26 +6813,35 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_double=$ac_lo;; -'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double), 77" >&5 -echo "$as_me: error: cannot compute sizeof (long double), 77" >&2;} +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double), 77 +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } ;; esac else if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default long longval () { return (long) (sizeof (long double)); } unsigned long ulongval () { return (long) (sizeof (long double)); } @@ -6649,10 +6889,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long double), 77" >&5 -echo "$as_me: error: cannot compute sizeof (long double), 77" >&2;} +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long double), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double), 77 +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext @@ -6951,7 +7194,7 @@ _ACEOF t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache -if cmp -s $cache_file confcache; then :; else +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file @@ -7011,6 +7254,8 @@ cat >$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false +ac_cs_recheck=false +ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF @@ -7045,7 +7290,10 @@ PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var @@ -7091,15 +7339,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conftest.sh - echo "exit 0" >>conftest.sh - chmod +x conftest.sh - if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh fi @@ -7262,7 +7510,7 @@ _ASBOX cat >&5 <<_CSEOF This file was extended by GNU C Library $as_me (see version.h), which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7302,6 +7550,7 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] @@ -7324,7 +7573,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ GNU C Library config.status (see version.h) -configured by $0, generated by GNU Autoconf 2.54, +configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 @@ -7361,12 +7610,9 @@ do case $ac_option in # Handling of the options. _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" - exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; -_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) @@ -7388,6 +7634,9 @@ Try \`$0 --help' for more information." >&2;} $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 @@ -7402,6 +7651,20 @@ Try \`$0 --help' for more information." >&2;} shift done +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + _ACEOF cat >>$CONFIG_STATUS <<_ACEOF @@ -7442,6 +7705,9 @@ if $ac_need_defaults; then test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { @@ -7450,17 +7716,17 @@ $debug || } # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} + { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/cs$$-$RANDOM + tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } @@ -7575,6 +7841,7 @@ s,@libc_cv_z_initfirst@,$libc_cv_z_initfirst,;t t s,@libc_cv_Bgroup@,$libc_cv_Bgroup,;t t s,@ASFLAGS_config@,$ASFLAGS_config,;t t s,@libc_cv_z_combreloc@,$libc_cv_z_combreloc,;t t +s,@libc_cv_z_execstack@,$libc_cv_z_execstack,;t t s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t s,@libc_cv_cpp_asm_debuginfo@,$libc_cv_cpp_asm_debuginfo,;t t s,@no_whole_archive@,$no_whole_archive,;t t @@ -7990,7 +8257,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else @@ -8123,8 +8390,11 @@ ac_clean_files=$ac_clean_files_save # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. diff --git a/configure.in b/configure.in index 91d903f591..c3f4adb89d 100644 --- a/configure.in +++ b/configure.in @@ -1334,6 +1334,7 @@ EOF ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack" fi AC_SUBST(ASFLAGS_config) + AC_CACHE_CHECK(for -z combreloc, libc_cv_z_combreloc, [dnl cat > conftest.c <<EOF @@ -1363,8 +1364,25 @@ dnl look for a section named .rel.dyn. if test "$libc_cv_z_combreloc" = yes; then AC_DEFINE(HAVE_Z_COMBRELOC) fi + AC_SUBST(libc_cv_z_combreloc) + + AC_CACHE_CHECK(for -z execstack, + libc_cv_z_execstack, [dnl + cat > conftest.c <<EOF +int _start (void) { return 42; } +EOF + if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS + -shared -o conftest.so conftest.c + -Wl,-z,execstack -nostdlib + 1>&AS_MESSAGE_LOG_FD]) + then + libc_cv_z_execstack=yes + else + libc_cv_z_execstack=no + fi + rm -f conftest*]) + AC_SUBST(libc_cv_z_execstack) fi -AC_SUBST(libc_cv_z_combreloc) if test $elf != yes; then AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini, diff --git a/elf/Makefile b/elf/Makefile index d5a1c3de34..36f205abb2 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -29,7 +29,8 @@ routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \ # profiled libraries. dl-routines = $(addprefix dl-,load cache lookup object reloc deps \ runtime error init fini debug misc \ - version profile conflict tls origin) + version profile conflict tls origin \ + execstack) all-dl-routines = $(dl-routines) $(sysdep-dl-routines) # But they are absent from the shared libc, because that code is in ld.so. elide-routines.os = $(all-dl-routines) dl-support enbl-secure \ @@ -80,6 +81,7 @@ distribute := rtld-Rules \ reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \ tst-array1.exp tst-array2.exp tst-array4.exp \ tst-array2dep.c \ + tst-execstack-mod.c \ check-textrel.c dl-sysdep.h CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables @@ -150,12 +152,14 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ neededtest3 neededtest4 unload2 lateglobal initfirst global \ restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \ circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \ - tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align + tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \ + $(tests-execstack-$(have-z-execstack)) # reldep9 test-srcs = tst-pathopt tests-vis-yes = vismain tests-nodelete-yes = nodelete nodelete2 tests-nodlopen-yes = nodlopen nodlopen2 +tests-execstack-yes = tst-execstack tst-execstack-needed endif modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ testobj1_1 failobj constload2 constload3 unloadmod \ @@ -178,7 +182,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ circlemod3 circlemod3a \ reldep8mod1 reldep8mod2 reldep8mod3 \ reldep9mod1 reldep9mod2 reldep9mod3 \ - tst-alignmod + tst-alignmod $(modules-execstack-$(have-z-execstack)) ifeq (yes,$(have-initfini-array)) modules-names += tst-array2dep endif @@ -186,6 +190,7 @@ modules-vis-yes = vismod1 vismod2 vismod3 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 \ nodel2mod1 nodel2mod2 nodel2mod3 modules-nodlopen-yes = nodlopenmod nodlopenmod2 +modules-execstack-yes = tst-execstack-mod extra-objs += $(addsuffix .os,$(strip $(modules-names))) # We need this variable to be sure the test modules get the right CPPFLAGS. test-extras += $(modules-names) @@ -660,6 +665,16 @@ $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so endif +ifeq ($(have-z-execstack),yes) +$(objpfx)tst-execstack: $(libdl) +$(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so +LDFLAGS-tst-execstack = -Wl,-z,noexecstack +LDFLAGS-tst-execstack-mod = -Wl,-z,execstack + +$(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so +LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack +endif + $(objpfx)tst-array1.out: $(objpfx)tst-array1 $(elf-objpfx)$(rtld-installed-name) \ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ diff --git a/elf/tst-execstack-mod.c b/elf/tst-execstack-mod.c new file mode 100644 index 0000000000..038e6550b5 --- /dev/null +++ b/elf/tst-execstack-mod.c @@ -0,0 +1,30 @@ +/* Test module for making nonexecutable stacks executable + on load of a DSO that requires executable stacks. */ + +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> + +void callme (void (*callback) (void)); + +/* This is a function that makes use of executable stack by + using a local function trampoline. */ +void +tryme (void) +{ + bool ok = false; + void callback (void) { ok = true; } + + callme (&callback); + + if (ok) + printf ("DSO called ok (local %p, trampoline %p)\n", &ok, &callback); + else + abort (); +} + +void +callme (void (*callback) (void)) +{ + (*callback) (); +} diff --git a/elf/tst-execstack-needed.c b/elf/tst-execstack-needed.c new file mode 100644 index 0000000000..03090f7dd6 --- /dev/null +++ b/elf/tst-execstack-needed.c @@ -0,0 +1,36 @@ +/* Test program for making nonexecutable stacks executable + on DT_NEEDED load of a DSO that requires executable stacks. */ + +#include <dlfcn.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <error.h> + +extern void tryme (void); /* from tst-execstack-mod.so */ + +static void deeper (void (*f) (void)); + +static int +do_test (void) +{ + tryme (); + + /* Test that growing the stack region gets new executable pages too. */ + deeper (&tryme); + + return 0; +} + +static void +deeper (void (*f) (void)) +{ + char stack[1100 * 1024]; + memfrob (stack, sizeof stack); + (*f) (); + memfrob (stack, sizeof stack); +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-execstack.c b/elf/tst-execstack.c new file mode 100644 index 0000000000..21eaa9bc90 --- /dev/null +++ b/elf/tst-execstack.c @@ -0,0 +1,133 @@ +/* Test program for making nonexecutable stacks executable + on load of a DSO that requires executable stacks. */ + +#include <dlfcn.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <error.h> + +static void +print_maps (void) +{ +#if 0 + char *cmd = NULL; + asprintf (&cmd, "cat /proc/%d/maps", getpid ()); + system (cmd); + free (cmd); +#endif +} + +static void deeper (void (*f) (void)); + +#if USE_PTHREADS +# include <pthread.h> + +static void * +tryme_thread (void *f) +{ + (*((void (*) (void)) f)) (); + + return 0; +} + +static pthread_barrier_t startup_barrier, go_barrier; +static void * +waiter_thread (void *arg) +{ + void **f = arg; + pthread_barrier_wait (&startup_barrier); + pthread_barrier_wait (&go_barrier); + + (*((void (*) (void)) *f)) (); + + return 0; +} +#endif + +static int +do_test (void) +{ + void *f; + +#if USE_PTHREADS + /* Create some threads while stacks are nonexecutable. */ + #define N 5 + pthread_t thr[N]; + + pthread_barrier_init (&startup_barrier, NULL, N + 1); + pthread_barrier_init (&go_barrier, NULL, N + 1); + + for (int i = 0; i < N; ++i) + { + int rc = pthread_create (&thr[i], NULL, &waiter_thread, &f); + if (rc) + error (1, rc, "pthread_create"); + } + + /* Make sure they are all there using their stacks. */ + pthread_barrier_wait (&startup_barrier); + puts ("threads waiting"); +#endif + + print_maps (); + + /* Loading this module should force stacks to become executable. */ + void *h = dlopen ("tst-execstack-mod.so", RTLD_LAZY); + if (h == NULL) + { + printf ("cannot load: %s\n", dlerror ()); + return 1; + } + + f = dlsym (h, "tryme"); + if (f == NULL) + { + printf ("symbol not found: %s\n", dlerror ()); + return 1; + } + + /* Test if that really made our stack executable. + The `tryme' function should crash if not. */ + + (*((void (*) (void)) f)) (); + + print_maps (); + + /* Test that growing the stack region gets new executable pages too. */ + deeper ((void (*) (void)) f); + + print_maps (); + +#if USE_PTHREADS + /* Test that a fresh thread now gets an executable stack. */ + { + pthread_t th; + int rc = pthread_create (&th, NULL, &tryme_thread, f); + if (rc) + error (1, rc, "pthread_create"); + } + + puts ("threads go"); + /* The existing threads' stacks should have been changed. + Let them run to test it. */ + pthread_barrier_wait (&go_barrier); + + pthread_exit (0); +#endif + + return 0; +} + +static void +deeper (void (*f) (void)) +{ + char stack[1100 * 1024]; + memfrob (stack, sizeof stack); + (*f) (); + memfrob (stack, sizeof stack); +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 34019b89bb..9e84e2c059 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -276,18 +276,17 @@ _dl_runtime_profile:\n\ .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ + # Point %ebx at the GOT.\n\ + call 0b\n\ + addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ # Note that _dl_start gets the parameter in %eax.\n\ movl %esp, %eax\n\ + # Store the highest stack address\n\ + movl %eax, __libc_stack_end@GOTOFF(%ebx)\n\ call _dl_start\n\ _dl_start_user:\n\ # Save the user entry point address in %edi.\n\ movl %eax, %edi\n\ - # Point %ebx at the GOT.\n\ - call 0b\n\ - addl $_GLOBAL_OFFSET_TABLE_, %ebx\n\ - # Store the highest stack address\n\ - movl __libc_stack_end@GOT(%ebx), %eax\n\ - movl %esp, (%eax)\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ movl _dl_skip_args@GOTOFF(%ebx), %eax\n\ |