Module Name:    src
Committed By:   thorpej
Date:           Tue Nov 23 23:29:55 UTC 2021

Modified Files:
        src/doc: HACKS
        src/tests/lib/libexecinfo: Makefile t_sig_backtrace.c

Log Message:
Temporary hack to work around incorrect/missing unwind info for
the t_sig_backtrace test case on ARM when compiled with optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.225 -r1.226 src/doc/HACKS
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libexecinfo/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libexecinfo/t_sig_backtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.225 src/doc/HACKS:1.226
--- src/doc/HACKS:1.225	Wed Oct 13 20:11:54 2021
+++ src/doc/HACKS	Tue Nov 23 23:29:55 2021
@@ -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

Index: src/tests/lib/libexecinfo/Makefile
diff -u src/tests/lib/libexecinfo/Makefile:1.7 src/tests/lib/libexecinfo/Makefile:1.8
--- src/tests/lib/libexecinfo/Makefile:1.7	Thu Nov 18 15:03:19 2021
+++ src/tests/lib/libexecinfo/Makefile	Tue Nov 23 23:29:55 2021
@@ -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>

Index: src/tests/lib/libexecinfo/t_sig_backtrace.c
diff -u src/tests/lib/libexecinfo/t_sig_backtrace.c:1.1 src/tests/lib/libexecinfo/t_sig_backtrace.c:1.2
--- src/tests/lib/libexecinfo/t_sig_backtrace.c:1.1	Thu Nov 18 15:03:19 2021
+++ src/tests/lib/libexecinfo/t_sig_backtrace.c	Tue Nov 23 23:29:55 2021
@@ -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;
 }
 

Reply via email to