Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/libexec/ld.elf_so ld.elf_so: Test variations on PR too...
details: https://anonhg.NetBSD.org/src/rev/c06c55bd18a4
branches: trunk
changeset: 376111:c06c55bd18a4
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Jun 01 20:48:30 2023 +0000
description:
ld.elf_so: Test variations on PR toolchain/50277.
XXX pullup-10
diffstat:
tests/libexec/ld.elf_so/t_tls_extern.c | 74 +++++++++++++++++++++++++++++++--
1 files changed, 68 insertions(+), 6 deletions(-)
diffs (104 lines):
diff -r 60b0942daa28 -r c06c55bd18a4 tests/libexec/ld.elf_so/t_tls_extern.c
--- a/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 01 20:40:18 2023 +0000
+++ b/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 01 20:48:30 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_tls_extern.c,v 1.2 2023/05/31 00:46:11 riastradh Exp $ */
+/* $NetBSD: t_tls_extern.c,v 1.3 2023/06/01 20:48:30 riastradh Exp $ */
/*-
* Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -33,20 +33,79 @@
#define ATF_REQUIRE_DL(x) ATF_REQUIRE_MSG(x, "%s: %s", #x, dlerror())
-ATF_TC(tls_extern_static);
-ATF_TC_HEAD(tls_extern_static, tc)
+ATF_TC(tls_extern_static_defuse);
+ATF_TC_HEAD(tls_extern_static_defuse, tc)
{
- atf_tc_set_md_var(tc, "descr", "extern __thread for static TLS works");
+ atf_tc_set_md_var(tc, "descr", "extern __thread for static TLS works,"
+ " loading def then use");
}
-ATF_TC_BODY(tls_extern_static, tc)
+ATF_TC_BODY(tls_extern_static_defuse, tc)
{
void *def, *use;
int *(*fdef)(void), *(*fuse)(void);
int *pdef, *puse;
(void)dlerror();
+
+ ATF_REQUIRE_DL(def = dlopen("libh_def_static.so", 0));
+ ATF_REQUIRE_DL(use = dlopen("libh_use_static.so", 0));
+
+ ATF_REQUIRE_DL(fdef = dlsym(def, "fdef"));
+ ATF_REQUIRE_DL(fuse = dlsym(use, "fuse"));
+
+ pdef = (*fdef)();
+ puse = (*fuse)();
+ ATF_CHECK_EQ_MSG(pdef, puse,
+ "%p in defining library != %p in using library",
+ pdef, puse);
+}
+
+ATF_TC(tls_extern_static_usedef);
+ATF_TC_HEAD(tls_extern_static_usedef, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "extern __thread for static TLS works,"
+ " loading use then def");
+}
+ATF_TC_BODY(tls_extern_static_usedef, tc)
+{
+ void *def, *use;
+ int *(*fdef)(void), *(*fuse)(void);
+ int *pdef, *puse;
+
+ (void)dlerror();
+
+ ATF_REQUIRE_DL(use = dlopen("libh_use_static.so", 0));
+ ATF_REQUIRE_DL(def = dlopen("libh_def_static.so", 0));
+
+ ATF_REQUIRE_DL(fdef = dlsym(def, "fdef"));
+ ATF_REQUIRE_DL(fuse = dlsym(use, "fuse"));
+
+ pdef = (*fdef)();
+ puse = (*fuse)();
+ atf_tc_expect_fail("PR toolchain/50277:"
+ " rtld relocation bug with thread local storage");
+ ATF_CHECK_EQ_MSG(pdef, puse,
+ "%p in defining library != %p in using library",
+ pdef, puse);
+}
+
+ATF_TC(tls_extern_static_usedefnoload);
+ATF_TC_HEAD(tls_extern_static_usedefnoload, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "extern __thread for static TLS works,"
+ " loading use then def with RTLD_NOLOAD");
+}
+ATF_TC_BODY(tls_extern_static_usedefnoload, tc)
+{
+ void *def, *use;
+ int *(*fdef)(void), *(*fuse)(void);
+ int *pdef, *puse;
+
+ (void)dlerror();
+
ATF_REQUIRE_DL(use = dlopen("libh_use_static.so", 0));
ATF_REQUIRE_DL(def = dlopen("libh_def_static.so", RTLD_NOLOAD));
+
ATF_REQUIRE_DL(fdef = dlsym(def, "fdef"));
ATF_REQUIRE_DL(fuse = dlsym(use, "fuse"));
@@ -61,6 +120,9 @@ ATF_TC_BODY(tls_extern_static, tc)
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, tls_extern_static);
+
+ ATF_TP_ADD_TC(tp, tls_extern_static_defuse);
+ ATF_TP_ADD_TC(tp, tls_extern_static_usedef);
+ ATF_TP_ADD_TC(tp, tls_extern_static_usedefnoload);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index