From: Todd C. Miller Date: Thu, 29 Oct 2015 20:06:21 +0000 (-0600) Subject: Preserve LDFLAGS when checking for stack protector as they may include X-Git-Tag: SUDO_1_8_15^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b87ac0f0a25a08e46ef79b6324f02adf4ef67227;p=sudo Preserve LDFLAGS when checking for stack protector as they may include rpath settings to allow the stack protector lib to be found. Avoid using existing CFLAGS since we don't want the compiler to optimize away the stack variable. --- diff --git a/configure b/configure index 462364db9..b8b22e514 100755 --- a/configure +++ b/configure @@ -23926,7 +23926,7 @@ else _CFLAGS="$CFLAGS" _LDFLAGS="$LDFLAGS" CFLAGS="-fstack-protector-strong" - LDFLAGS="-fstack-protector-strong" + LDFLAGS="$_LDFLAGS -fstack-protector-strong" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23947,7 +23947,7 @@ if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="-fstack-protector-all" - LDFLAGS="-fstack-protector-all" + LDFLAGS="$_LDFLAGS -fstack-protector-all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23968,7 +23968,7 @@ if ac_fn_c_try_compile "$LINENO"; then : else CFLAGS="-fstack-protector" - LDFLAGS="-fstack-protector" + LDFLAGS="$_LDFLAGS -fstack-protector" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ diff --git a/configure.ac b/configure.ac index edeaa2c0e..958b57243 100644 --- a/configure.ac +++ b/configure.ac @@ -3985,7 +3985,7 @@ if test "$enable_hardening" != "no"; then _CFLAGS="$CFLAGS" _LDFLAGS="$LDFLAGS" CFLAGS="-fstack-protector-strong" - LDFLAGS="-fstack-protector-strong" + LDFLAGS="$_LDFLAGS -fstack-protector-strong" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[char buf[1024]; buf[1023] = '\0';]]) @@ -3993,7 +3993,7 @@ if test "$enable_hardening" != "no"; then sudo_cv_var_stack_protector="-fstack-protector-strong" ], [ CFLAGS="-fstack-protector-all" - LDFLAGS="-fstack-protector-all" + LDFLAGS="$_LDFLAGS -fstack-protector-all" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[char buf[1024]; buf[1023] = '\0';]]) @@ -4001,7 +4001,7 @@ if test "$enable_hardening" != "no"; then sudo_cv_var_stack_protector="-fstack-protector-all" ], [ CFLAGS="-fstack-protector" - LDFLAGS="-fstack-protector" + LDFLAGS="$_LDFLAGS -fstack-protector" AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [[char buf[1024]; buf[1023] = '\0';]])