aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-16 19:20:54 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-22 12:55:50 +0800
commitd9d30f6cb582fbd3932aa4731061c6335ffc5a70 (patch)
tree74b702da46a9377a9adf61f1f4dce3182f5025e2 /configure
parentf5fb9fa011f242bfd8c291fe876532ebd252397e (diff)
downloadglibc-d9d30f6cb582fbd3932aa4731061c6335ffc5a70.zip
glibc-d9d30f6cb582fbd3932aa4731061c6335ffc5a70.tar.gz
glibc-d9d30f6cb582fbd3932aa4731061c6335ffc5a70.tar.bz2
Enable execstack tests only if compiler supports trampoline
Since trampoline is required to test execstack, enable execstack tests only if compiler supports trampoline. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure47
1 files changed, 47 insertions, 0 deletions
diff --git a/configure b/configure
index b899d39..aaad07e 100755
--- a/configure
+++ b/configure
@@ -7774,6 +7774,53 @@ config_vars="$config_vars
cc-option-wimplicit-fallthrough = $libc_cv_cc_wimplicit_fallthrough"
+conftest_code="
+void bar (void (*callback) (void));
+int foo (void)
+{
+ int var = 0;
+ void callback (void) { var = 1; }
+ bar (callback);
+ return var;
+}
+"
+
+
+cat > conftest.c <<EOF
+$conftest_code
+EOF
+
+saved_CC="$CC"
+CC="$TEST_CC"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for trampolines in testing" >&5
+printf %s "checking support for trampolines in testing... " >&6; }
+if test ${libc_cv_test_cc_trampolines+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c -Werror conftest.c -o conftest 1>&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ libc_cv_test_cc_trampolines=yes
+ else
+ libc_cv_test_cc_trampolines=no
+
+ fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cc_trampolines" >&5
+printf "%s\n" "$libc_cv_test_cc_trampolines" >&6; }
+
+CC="$saved_CC"
+
+rm -f conftest*
+config_vars="$config_vars
+have-test-cc-trampoline = $libc_cv_test_cc_trampolines"
+
saved_CC="$CC"