summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2021-11-23 23:29:55 +0000
committerthorpej <thorpej@NetBSD.org>2021-11-23 23:29:55 +0000
commitd647f0760138cd669ee13293fdce2ea2a8094efc (patch)
tree5af0880d502a353dc81516ca2520550bd5f009d8
parent591b30edffd8cc4de012e8f1d1f882a6485ccf39 (diff)
Temporary hack to work around incorrect/missing unwind info for
the t_sig_backtrace test case on ARM when compiled with optimization.
-rw-r--r--doc/HACKS13
-rw-r--r--tests/lib/libexecinfo/Makefile8
-rw-r--r--tests/lib/libexecinfo/t_sig_backtrace.c13
3 files changed, 30 insertions, 4 deletions
diff --git a/doc/HACKS b/doc/HACKS
index 2146023e8ae..816436fa0f9 100644
--- a/doc/HACKS
+++ b/doc/HACKS
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.225 2021/10/13 20:11:54 nia Exp $
+# $NetBSD: HACKS,v 1.226 2021/11/23 23:29:55 thorpej Exp $
#
# This file is intended to document workarounds for currently unsolved
# (mostly) compiler bugs.
@@ -1020,3 +1020,14 @@ file src/lib/libcrypt/Makefile: 1.200
descr GCC 10 fails to build blake2b.c with an internal compiler
error unless optimization is disabled.
kcah
+
+port arm
+hack compile t_sig_backtrace with -fno-omit-frame-pointer for arm
+cdate Tue Nov 23 23:24:37 UTC 2021
+mdate Tue Nov 23 23:24:37 UTC 2021
+who thorpej
+file src/tests/lib/libexecinfo/Makefile: 1.8
+file src/tests/lib/libexecinfo/t_sig_backtrace: 1.2
+descr Unit test fails to pass unless t_sig_backtrace.c is compiled
+ with -fno-omit-frame-pointer and -DNOINLINE_HACK.
+kcah
diff --git a/tests/lib/libexecinfo/Makefile b/tests/lib/libexecinfo/Makefile
index d3d711e012f..2dde350d21d 100644
--- a/tests/lib/libexecinfo/Makefile
+++ b/tests/lib/libexecinfo/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2021/11/18 15:03:19 thorpej Exp $
+# $NetBSD: Makefile,v 1.8 2021/11/23 23:29:55 thorpej Exp $
.include <bsd.own.mk>
@@ -13,4 +13,10 @@ DPADD+= ${LIBEXECINFO} ${LIBELF}
COPTS.t_backtrace.c= -Wno-stack-protector
+# XXX temporary hack
+.if ${MACHINE_CPU} == "arm"
+COPTS.t_sig_backtrace.c=-fno-omit-frame-pointer
+CPPFLAGS.t_sig_backtrace.c=-DNOINLINE_HACK
+.endif
+
.include <bsd.test.mk>
diff --git a/tests/lib/libexecinfo/t_sig_backtrace.c b/tests/lib/libexecinfo/t_sig_backtrace.c
index b57316b5f42..bf6811331ee 100644
--- a/tests/lib/libexecinfo/t_sig_backtrace.c
+++ b/tests/lib/libexecinfo/t_sig_backtrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sig_backtrace.c,v 1.1 2021/11/18 15:03:19 thorpej Exp $ */
+/* $NetBSD: t_sig_backtrace.c,v 1.2 2021/11/23 23:29:55 thorpej Exp $ */
/*-
* Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_sig_backtrace.c,v 1.1 2021/11/18 15:03:19 thorpej Exp $");
+__RCSID("$NetBSD: t_sig_backtrace.c,v 1.2 2021/11/23 23:29:55 thorpej Exp $");
#include <sys/mman.h>
#include <execinfo.h>
@@ -51,6 +51,10 @@ char *foo;
static int the_loop(int);
+#ifdef NOINLINE_HACK
+volatile int noinline;
+#endif
+
static int __noinline
func1(int i)
{
@@ -85,6 +89,11 @@ the_loop(int i)
i = func2(i);
}
+#ifdef NOINLINE_HACK
+ if (noinline)
+ vfork();
+#endif
+
return i;
}