From d9d30f6cb582fbd3932aa4731061c6335ffc5a70 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 16 Dec 2024 19:20:54 +0800 Subject: 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 Reviewed-by: Sam James --- configure.ac | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 6eaf83b8dc..d4c1c7c916 100644 --- a/configure.ac +++ b/configure.ac @@ -1527,6 +1527,28 @@ LIBC_CONFIG_VAR([cc-option-wimplicit-fallthrough], [$libc_cv_cc_wimplicit_fallthrough]) AC_SUBST(libc_cv_test_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; +} +" + +dnl Check if TEST_CC support trampolines. +LIBC_TRY_TEST_CC_COMMAND([support for trampolines], + [$conftest_code], + [-c -Werror], + libc_cv_test_cc_trampolines, + [libc_cv_test_cc_trampolines=yes], + [libc_cv_test_cc_trampolines=no] +) +LIBC_CONFIG_VAR([have-test-cc-trampoline], + [$libc_cv_test_cc_trampolines]) + dnl Check if TEST_CC supports -finput-charset=ascii. LIBC_TRY_TEST_CC_OPTION([-finput-charset=ascii], [-c -Werror -finput-charset=ascii], -- cgit v1.2.3