* modules/jit/cache-tests (Files): Add m4/warnings.m4.
(configure.ac): Set and substitute DISABLE_OPENBSD_RETGUARD.
(Makefile.am): Set test_cache_CFLAGS.
* tests/jit/test-cache.c (main): If the compiler defines _RET_PROTECTOR,
skip the test.
+2024-01-08 Bruno Haible <bruno@clisp.org>
+
+ jit/cache tests: Avoid test failure on OpenBSD.
+ * modules/jit/cache-tests (Files): Add m4/warnings.m4.
+ (configure.ac): Set and substitute DISABLE_OPENBSD_RETGUARD.
+ (Makefile.am): Set test_cache_CFLAGS.
+ * tests/jit/test-cache.c (main): If the compiler defines _RET_PROTECTOR,
+ skip the test.
+
2024-01-08 Bruno Haible <bruno@clisp.org>
jit/cache tests: Avoid test failure on CentOS, *BSD, macOS.
tests/jit/test-cache.c
tests/macros.h
m4/mmap-anon.m4
+m4/warnings.m4
Status:
unportable-test
configure.ac:
AC_CHECK_HEADERS_ONCE([sys/mman.h])
gl_FUNC_MMAP_ANON
+dnl Disable the OpenBSD "retguard" stack protector for this test.
+gl_COMPILER_OPTION_IF([-fno-ret-protector],
+ [DISABLE_OPENBSD_RETGUARD='-fno-ret-protector'],
+ [DISABLE_OPENBSD_RETGUARD=])
+AC_SUBST([DISABLE_OPENBSD_RETGUARD])
Makefile.am:
TESTS += test-cache
check_PROGRAMS += test-cache
test_cache_SOURCES = jit/test-cache.c
+test_cache_CFLAGS = $(AM_CFLAGS) $(DISABLE_OPENBSD_RETGUARD)
int
main ()
{
-#if !HAVE_SYS_MMAN_H
+#if defined _RET_PROTECTOR
+ /* The OpenBSD "retguard" stack protector produces code for 'return1' and
+ 'return2' that is not position independent, and there is no clang
+ attribute for turning this instrumentation off for specific functions.
+ If this stack protector has not been disabled through a configure test,
+ we need to skip this unit test. */
+ return 77;
+#elif !HAVE_SYS_MMAN_H
return 77;
#else
int const pagesize = getpagesize ();