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>
This commit is contained in:
H.J. Lu
2024-12-16 19:20:54 +08:00
parent f5fb9fa011
commit d9d30f6cb5
4 changed files with 80 additions and 2 deletions

View File

@@ -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],