Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/csu Add an initfini_array test that does not depen...
details: https://anonhg.NetBSD.org/src/rev/bc47992ce4ea
branches: trunk
changeset: 995556:bc47992ce4ea
user: christos <christos%NetBSD.org@localhost>
date: Thu Dec 27 19:33:52 2018 +0000
description:
Add an initfini_array test that does not depend on the linker putting it
there automatically.
diffstat:
tests/lib/csu/Makefile | 5 +++--
tests/lib/csu/h_initfini_array.c | 16 ++++++++++++++++
tests/lib/csu/t_crt0.sh | 13 ++++++++++++-
3 files changed, 31 insertions(+), 3 deletions(-)
diffs (71 lines):
diff -r 0c5ca3504f8c -r bc47992ce4ea tests/lib/csu/Makefile
--- a/tests/lib/csu/Makefile Thu Dec 27 19:32:32 2018 +0000
+++ b/tests/lib/csu/Makefile Thu Dec 27 19:33:52 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2018/03/09 20:20:47 joerg Exp $
+# $NetBSD: Makefile,v 1.7 2018/12/27 19:33:52 christos Exp $
NOMAN= # defined
@@ -24,8 +24,9 @@
${SRCS_CHECK_STACK}
LDADD.h_initfini3+= -Wl,-rpath,${TESTSDIR}
-PROGS+= h_ifunc_static
+PROGS+= h_ifunc_static h_initfini_array
SRCS.h_ifunc_static= h_ifunc_static.c
+SRCS.h_initfini_array= h_initfini_array.c
LDSTATIC.h_ifunc_static=-static
.include <bsd.test.mk>
diff -r 0c5ca3504f8c -r bc47992ce4ea tests/lib/csu/h_initfini_array.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/csu/h_initfini_array.c Thu Dec 27 19:33:52 2018 +0000
@@ -0,0 +1,16 @@
+static int x = 1;
+
+static void
+foo(void)
+{
+ x = 0;
+}
+
+static void (*fp) (void) __attribute__((__section__(".init_array"), __used__)) =
+ foo;
+
+int
+main(void)
+{
+ return x;
+}
diff -r 0c5ca3504f8c -r bc47992ce4ea tests/lib/csu/t_crt0.sh
--- a/tests/lib/csu/t_crt0.sh Thu Dec 27 19:32:32 2018 +0000
+++ b/tests/lib/csu/t_crt0.sh Thu Dec 27 19:33:52 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_crt0.sh,v 1.4 2011/12/11 14:57:07 joerg Exp $
+# $NetBSD: t_crt0.sh,v 1.5 2018/12/27 19:33:52 christos Exp $
#
# Copyright (c) 2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -95,10 +95,21 @@
atf_check -o file:expout -x "env LD_PRELOAD=$(atf_get_srcdir)/h_initfini3_dso.so $(atf_get_srcdir)/h_initfini1"
}
+atf_test_case initfini_array
+initfini_array_head()
+{
+ atf_set "descr" "Checks support for init_array/fini_array sections"
+}
+initfini_array_body()
+{
+ atf_check -x "$(atf_get_srcdir)/h_initfini_array"
+}
+
atf_init_test_cases()
{
atf_add_test_case initfini1
atf_add_test_case initfini2
atf_add_test_case initfini3
atf_add_test_case initfini4
+ atf_add_test_case initfini_array
}
Home |
Main Index |
Thread Index |
Old Index