diff options
author | Roland McGrath <roland@hack.frob.com> | 2012-05-14 16:08:25 -0700 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2012-05-16 16:22:50 -0700 |
commit | 30b99d798f9728a96d4766dd3f7fcfe5daae8945 (patch) | |
tree | 1dae148d2523a99037637ee4cdf9e58261bea288 /configure | |
parent | 61653dfb81b776bb72ce4304175b861d77c357a8 (diff) | |
download | glibc-30b99d798f9728a96d4766dd3f7fcfe5daae8945.tar.gz |
BZ#10375: Configure magic to use -fno-stack-protector if needed.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 139 |
1 files changed, 139 insertions, 0 deletions
@@ -632,6 +632,7 @@ libc_cv_localedir libc_cv_slibdir old_glibc_headers libc_cv_gcc_unwind_find_fde +libc_extra_cflags CPPUNDEFS sizeof_long_double EGREP @@ -666,6 +667,7 @@ libc_cv_gcc_static_libgcc CXX_SYSINCLUDES SYSINCLUDES AUTOCONF +NM READELF SED MAKEINFO @@ -5154,6 +5156,98 @@ else READELF="$ac_cv_prog_READELF" fi +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args. +set dummy ${ac_tool_prefix}nm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + ac_cv_prog_NM="$NM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NM="${ac_tool_prefix}nm" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NM=$ac_cv_prog_NM +if test -n "$NM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5 +$as_echo "$NM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NM"; then + ac_ct_NM=$NM + # Extract the first word of "nm", so it can be a program name with args. +set dummy nm; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NM"; then + ac_cv_prog_ac_ct_NM="$ac_ct_NM" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NM="nm" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NM=$ac_cv_prog_ac_ct_NM +if test -n "$ac_ct_NM"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NM" >&5 +$as_echo "$ac_ct_NM" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NM" = x; then + NM="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NM=$ac_ct_NM + fi +else + NM="$ac_cv_prog_NM" +fi + for ac_prog in autoconf do @@ -7577,6 +7671,51 @@ if test $libc_cv_predef_fortify_source = yes; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC implicitly enables -fstack-protector" >&5 +$as_echo_n "checking whether $CC implicitly enables -fstack-protector... " >&6; } +if ${libc_cv_predef_stack_protector+:} false; then : + $as_echo_n "(cached) " >&6 +else + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void foobar (char *); +int +main () +{ +char large_array[2048]; foobar (large_array); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +libc_undefs=`$NM -u conftest.o | + LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \ + 2>&5` || { + as_fn_error $? "confusing output from $NM -u" "$LINENO" 5 +} +echo >&5 "libc_undefs='$libc_undefs'" +case "$libc_undefs" in +foobar) libc_cv_predef_stack_protector=no ;; +'__stack_chk_fail +foobar') libc_cv_predef_stack_protector=yes ;; +*) as_fn_error $? "unexpected symbols in test: $libc_undefs" "$LINENO" 5 ;; +esac +else + as_fn_error $? "test compilation failed" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_predef_stack_protector" >&5 +$as_echo "$libc_cv_predef_stack_protector" >&6; } +libc_extra_cflags= +if test $libc_cv_predef_stack_protector = yes; then + libc_extra_cflags=-fno-stack-protector +fi + + ### End of automated tests. ### Now run sysdeps configure fragments. |