CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Nov 24 17:40:20 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c Log Message: t_dlinfo, t_rtld_r_debug: Audit ATF_REQUIRE/CHECK, sprinkle messages. Make sure to use ATF_REQUIRE when the subsequent code doesn't work if the check fails. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_dlinfo.c cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Nov 24 17:40:20 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c Log Message: t_dlinfo, t_rtld_r_debug: Audit ATF_REQUIRE/CHECK, sprinkle messages. Make sure to use ATF_REQUIRE when the subsequent code doesn't work if the check fails. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_dlinfo.c cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_dlinfo.c diff -u src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c:1.8 --- src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7 Fri Nov 24 17:40:09 2023 +++ src/tests/libexec/ld.elf_so/t_dlinfo.c Fri Nov 24 17:40:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $ */ +/* $NetBSD: t_dlinfo.c,v 1.8 2023/11/24 17:40:20 riastradh Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_self, tc int rv; rv = dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ); - ATF_CHECK_EQ(rv, 0); + ATF_REQUIRE_EQ_MSG(rv, 0, "dlinfo: %s", dlerror()); ATF_CHECK((strstr(map->l_name, "t_dlinfo") != NULL)); } @@ -61,7 +61,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_inval, t int rv; rv = dlinfo(NULL, RTLD_DI_LINKMAP, ); - ATF_CHECK_EQ(rv, -1); + ATF_CHECK_EQ_MSG(rv, -1, "rv=%d", rv); } ATF_TC(rtld_dlinfo_linkmap_dlopen); @@ -76,12 +76,12 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen, int rv; handle = dlopen("libutil.so", RTLD_LAZY); - ATF_CHECK(handle); + ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror()); rv = dlinfo(handle, RTLD_DI_LINKMAP, ); - ATF_CHECK_EQ(rv, 0); + ATF_REQUIRE_EQ_MSG(rv, 0, "dlinfo: %s", dlerror()); ATF_CHECK((strstr(map->l_name, "libutil.so") != NULL)); - dlclose(handle); + ATF_CHECK_EQ_MSG(dlclose(handle), 0, "dlclose: %s", dlerror()); } ATF_TC(rtld_dlinfo_linkmap_dlopen_iter); @@ -95,7 +95,7 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i void *handle; handle = dlopen("libutil.so", RTLD_LAZY); - ATF_CHECK(handle); + ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror()); ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ), 0, "dlinfo: %s", dlerror()); @@ -105,10 +105,10 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i for (; map; map = map->l_prev) if (strstr(map->l_name, "libutil.so") != NULL) break; - + ATF_REQUIRE_MSG(map, "dlopen()d object not found from linkmap"); ATF_REQUIRE_MSG(dlopen(map->l_name, RTLD_LAZY) != NULL, - "could not dlopen() name in linkmap"); + "could not dlopen() name in linkmap: %s", dlerror()); } ATF_TP_ADD_TCS(tp) Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.5 --- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4 Fri Nov 24 17:40:09 2023 +++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Fri Nov 24 17:40:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $ */ +/* $NetBSD: t_rtld_r_debug.c,v 1.5 2023/11/24 17:40:20 riastradh Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -104,7 +104,9 @@ check_r_debug_return_link_map(const char loader = NULL; debug = get_rtld_r_debug(); ATF_CHECK(debug != NULL); - ATF_CHECK(debug->r_version == R_DEBUG_VERSION); + ATF_CHECK_EQ_MSG(debug->r_version, R_DEBUG_VERSION, + "debug->r_version=%d R_DEBUG_VERSION=%d", + debug->r_version, R_DEBUG_VERSION); map = debug->r_map; ATF_CHECK(map != NULL); @@ -120,8 +122,12 @@ check_r_debug_return_link_map(const char ATF_CHECK(found); ATF_CHECK(loader != NULL); ATF_CHECK(debug->r_brk != NULL); - ATF_CHECK(debug->r_state == RT_CONSISTENT); - ATF_CHECK(debug->r_ldbase == loader); + ATF_CHECK_EQ_MSG(debug->r_state, RT_CONSISTENT, + "debug->r_state=%d RT_CONSISTENT=%d", + debug->r_state, RT_CONSISTENT); + ATF_CHECK_EQ_MSG(debug->r_ldbase, loader, + "debug->r_ldbase=%p loader=%p", + debug->r_ldbase, loader); } ATF_TC(self); @@ -146,15 +152,15 @@ ATF_TC_BODY(dlopen, tc) struct link_map *map, *r_map; handle = dlopen("libutil.so", RTLD_LAZY); - ATF_CHECK(handle); + ATF_REQUIRE_MSG(handle, "dlopen: %s", dlerror()); check_r_debug_return_link_map("libutil.so", _map); ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, ), 0, "dlinfo: %s", dlerror()); - ATF_CHECK(map == r_map); - dlclose(handle); + ATF_CHECK_EQ_MSG(map, r_map, "map=%p r_map=%p", map, r_map); + ATF_CHECK_EQ_MSG(dlclose(handle), 0, "dlclose: %s", dlerror()); } ATF_TP_ADD_TCS(tp)
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Nov 24 17:40:09 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c Log Message: rtld tests: Don't use RZ for dlinfo. Use ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror()) instead, in order to accurately report the error on failure. RZ is only for functions like pthread_create(3) that return zero on success and errno(3) code on failure, but dlinfo returns -1 on failure and sets dlerror() to report the nature of the error. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_dlinfo.c diff -u src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6 src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7 --- src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6 Tue Jul 9 16:24:01 2019 +++ src/tests/libexec/ld.elf_so/t_dlinfo.c Fri Nov 24 17:40:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlinfo.c,v 1.6 2019/07/09 16:24:01 maya Exp $ */ +/* $NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,8 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i handle = dlopen("libutil.so", RTLD_LAZY); ATF_CHECK(handle); - RZ(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, )); + ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, ), 0, + "dlinfo: %s", dlerror()); for (; map->l_next; map = map->l_next) continue; Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4 --- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3 Tue Sep 29 16:35:42 2020 +++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Fri Nov 24 17:40:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_rtld_r_debug.c,v 1.3 2020/09/29 16:35:42 roy Exp $ */ +/* $NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -150,7 +150,8 @@ ATF_TC_BODY(dlopen, tc) check_r_debug_return_link_map("libutil.so", _map); - RZ(dlinfo(handle, RTLD_DI_LINKMAP, )); + ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, ), 0, + "dlinfo: %s", dlerror()); ATF_CHECK(map == r_map); dlclose(handle);
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Nov 24 17:40:09 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c Log Message: rtld tests: Don't use RZ for dlinfo. Use ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror()) instead, in order to accurately report the error on failure. RZ is only for functions like pthread_create(3) that return zero on success and errno(3) code on failure, but dlinfo returns -1 on failure and sets dlerror() to report the nature of the error. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Jun 2 19:08:01 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently. If a symbol has already been resolved as dynamic TLS, any library that tries to use it as static TLS cannot be dlopened. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.8 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.9 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.8 Thu Jun 1 23:47:24 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Fri Jun 2 19:08:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tls_extern.c,v 1.8 2023/06/01 23:47:24 riastradh Exp $ */ +/* $NetBSD: t_tls_extern.c,v 1.9 2023/06/02 19:08:01 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -113,13 +113,20 @@ ATF_TC_BODY(dynamic_abusedefnoload, tc) ATF_TC(dynamic_defabuse_eager); ATF_TC_HEAD(dynamic_defabuse_eager, tc) { - atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," + atf_tc_set_md_var(tc, "descr", "dlopen refuses extern __thread for TLS," " loading dynamic def then static use eagerly"); } ATF_TC_BODY(dynamic_defabuse_eager, tc) { - tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", - DEF_USE_EAGER, /*xfail*/true); + void *def; + int *(*fdef)(void); + + ATF_REQUIRE_DL(def = dlopen("libh_def_dynamic.so", 0)); + ATF_REQUIRE_DL(fdef = dlsym(def, "fdef")); + (void)(*fdef)(); + atf_tc_expect_fail("rtld fails to detect dynamic-then-static abuse"); + ATF_CHECK_EQ_MSG(NULL, dlopen("libh_abuse_dynamic.so", 0), + "dlopen failed to detect static-then-dynamic abuse"); } ATF_TC(dynamic_defabuse_lazy);
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Fri Jun 2 19:08:01 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: tls_extern dynamic_defabuse_eager must xfail differently. If a symbol has already been resolved as dynamic TLS, any library that tries to use it as static TLS cannot be dlopened. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 23:47:24 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Separately test eager and lazy resolution of def tls ptr. eager: before loading use library lazy: after loading use library XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.7 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.8 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.7 Thu Jun 1 22:26:51 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 1 23:47:24 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tls_extern.c,v 1.7 2023/06/01 22:26:51 riastradh Exp $ */ +/* $NetBSD: t_tls_extern.c,v 1.8 2023/06/01 23:47:24 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -34,7 +34,8 @@ #define ATF_REQUIRE_DL(x) ATF_REQUIRE_MSG(x, "%s: %s", #x, dlerror()) enum order { - DEF_USE, + DEF_USE_EAGER, + DEF_USE_LAZY, USE_DEF, USE_DEF_NOLOAD, }; @@ -50,25 +51,32 @@ tls_extern(const char *libdef, const cha (void)dlerror(); switch (order) { - case DEF_USE: + case DEF_USE_EAGER: ATF_REQUIRE_DL(def = dlopen(libdef, 0)); + ATF_REQUIRE_DL(fdef = dlsym(def, "fdef")); + pdef = (*fdef)(); ATF_REQUIRE_DL(use = dlopen(libuse, 0)); + ATF_REQUIRE_DL(fuse = dlsym(use, "fuse")); + puse = (*fuse)(); break; + case DEF_USE_LAZY: + ATF_REQUIRE_DL(def = dlopen(libdef, 0)); + ATF_REQUIRE_DL(use = dlopen(libuse, 0)); + goto lazy; case USE_DEF: ATF_REQUIRE_DL(use = dlopen(libuse, 0)); ATF_REQUIRE_DL(def = dlopen(libdef, 0)); - break; + goto lazy; case USE_DEF_NOLOAD: ATF_REQUIRE_DL(use = dlopen(libuse, 0)); ATF_REQUIRE_DL(def = dlopen(libdef, RTLD_NOLOAD)); +lazy: ATF_REQUIRE_DL(fdef = dlsym(def, "fdef")); + ATF_REQUIRE_DL(fuse = dlsym(use, "fuse")); + pdef = (*fdef)(); + puse = (*fuse)(); break; } - ATF_REQUIRE_DL(fdef = dlsym(def, "fdef")); - ATF_REQUIRE_DL(fuse = dlsym(use, "fuse")); - - pdef = (*fdef)(); - puse = (*fuse)(); if (xfail) { atf_tc_expect_fail("PR toolchain/50277:" " rtld relocation bug with thread local storage"); @@ -102,28 +110,52 @@ ATF_TC_BODY(dynamic_abusedefnoload, tc) USE_DEF_NOLOAD, /*xfail*/true); } -ATF_TC(dynamic_defabuse); -ATF_TC_HEAD(dynamic_defabuse, tc) +ATF_TC(dynamic_defabuse_eager); +ATF_TC_HEAD(dynamic_defabuse_eager, tc) +{ + atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," + " loading dynamic def then static use eagerly"); +} +ATF_TC_BODY(dynamic_defabuse_eager, tc) +{ + tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", + DEF_USE_EAGER, /*xfail*/true); +} + +ATF_TC(dynamic_defabuse_lazy); +ATF_TC_HEAD(dynamic_defabuse_lazy, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," - " loading dynamic def then static use"); + " loading dynamic def then static use lazily"); } -ATF_TC_BODY(dynamic_defabuse, tc) +ATF_TC_BODY(dynamic_defabuse_lazy, tc) { tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", - DEF_USE, /*xfail*/true); + DEF_USE_LAZY, /*xfail*/true); +} + +ATF_TC(dynamic_defuse_eager); +ATF_TC_HEAD(dynamic_defuse_eager, tc) +{ + atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," + " loading def then use eagerly"); +} +ATF_TC_BODY(dynamic_defuse_eager, tc) +{ + tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", + DEF_USE_EAGER, /*xfail*/false); } -ATF_TC(dynamic_defuse); -ATF_TC_HEAD(dynamic_defuse, tc) +ATF_TC(dynamic_defuse_lazy); +ATF_TC_HEAD(dynamic_defuse_lazy, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," - " loading def then use"); + " loading def then use lazyly"); } -ATF_TC_BODY(dynamic_defuse, tc) +ATF_TC_BODY(dynamic_defuse_lazy, tc) { tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", - DEF_USE, /*xfail*/false); + DEF_USE_LAZY, /*xfail*/false); } ATF_TC(dynamic_usedef); @@ -174,28 +206,52 @@ ATF_TC_BODY(static_abusedefnoload, tc) USE_DEF_NOLOAD, /*xfail*/true); } -ATF_TC(static_defabuse); -ATF_TC_HEAD(static_defabuse, tc) +ATF_TC(static_defabuse_eager); +ATF_TC_HEAD(static_defabuse_eager, tc) +{ + atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," + " loading static def then dynamic use eagerly"); +} +ATF_TC_BODY(static_defabuse_eager, tc) +{ + tls_extern("libh_def_static.so", "libh_abuse_static.so", + DEF_USE_EAGER, /*xfail*/true); +} + +ATF_TC(static_defabuse_lazy); +ATF_TC_HEAD(static_defabuse_lazy, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," - " loading static def then dynamic use"); + " loading static def then dynamic use lazyly"); }
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 23:47:24 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Separately test eager and lazy resolution of def tls ptr. eager: before loading use library lazy: after loading use library XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 22:26:51 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Shorter test names. No functional non-cosmetic change intended. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 22:26:51 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Shorter test names. No functional non-cosmetic change intended. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.6 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.7 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.6 Thu Jun 1 22:26:40 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 1 22:26:51 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tls_extern.c,v 1.6 2023/06/01 22:26:40 riastradh Exp $ */ +/* $NetBSD: t_tls_extern.c,v 1.7 2023/06/01 22:26:51 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -78,145 +78,145 @@ tls_extern(const char *libdef, const cha pdef, puse); } -ATF_TC(tls_extern_dynamic_abusedef); -ATF_TC_HEAD(tls_extern_dynamic_abusedef, tc) +ATF_TC(dynamic_abusedef); +ATF_TC_HEAD(dynamic_abusedef, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," " loading static use than dynamic def"); } -ATF_TC_BODY(tls_extern_dynamic_abusedef, tc) +ATF_TC_BODY(dynamic_abusedef, tc) { tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", USE_DEF, /*xfail*/true); } -ATF_TC(tls_extern_dynamic_abusedefnoload); -ATF_TC_HEAD(tls_extern_dynamic_abusedefnoload, tc) +ATF_TC(dynamic_abusedefnoload); +ATF_TC_HEAD(dynamic_abusedefnoload, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," " loading static use then dynamic def with RTLD_NOLOAD"); } -ATF_TC_BODY(tls_extern_dynamic_abusedefnoload, tc) +ATF_TC_BODY(dynamic_abusedefnoload, tc) { tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", USE_DEF_NOLOAD, /*xfail*/true); } -ATF_TC(tls_extern_dynamic_defabuse); -ATF_TC_HEAD(tls_extern_dynamic_defabuse, tc) +ATF_TC(dynamic_defabuse); +ATF_TC_HEAD(dynamic_defabuse, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," " loading dynamic def then static use"); } -ATF_TC_BODY(tls_extern_dynamic_defabuse, tc) +ATF_TC_BODY(dynamic_defabuse, tc) { tls_extern("libh_def_dynamic.so", "libh_abuse_dynamic.so", DEF_USE, /*xfail*/true); } -ATF_TC(tls_extern_dynamic_defuse); -ATF_TC_HEAD(tls_extern_dynamic_defuse, tc) +ATF_TC(dynamic_defuse); +ATF_TC_HEAD(dynamic_defuse, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," " loading def then use"); } -ATF_TC_BODY(tls_extern_dynamic_defuse, tc) +ATF_TC_BODY(dynamic_defuse, tc) { tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", DEF_USE, /*xfail*/false); } -ATF_TC(tls_extern_dynamic_usedef); -ATF_TC_HEAD(tls_extern_dynamic_usedef, tc) +ATF_TC(dynamic_usedef); +ATF_TC_HEAD(dynamic_usedef, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," " loading use then def"); } -ATF_TC_BODY(tls_extern_dynamic_usedef, tc) +ATF_TC_BODY(dynamic_usedef, tc) { tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", USE_DEF, /*xfail*/false); } -ATF_TC(tls_extern_dynamic_usedefnoload); -ATF_TC_HEAD(tls_extern_dynamic_usedefnoload, tc) +ATF_TC(dynamic_usedefnoload); +ATF_TC_HEAD(dynamic_usedefnoload, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," " loading use then def with RTLD_NOLOAD"); } -ATF_TC_BODY(tls_extern_dynamic_usedefnoload, tc) +ATF_TC_BODY(dynamic_usedefnoload, tc) { tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", USE_DEF_NOLOAD, /*xfail*/false); } -ATF_TC(tls_extern_static_abusedef); -ATF_TC_HEAD(tls_extern_static_abusedef, tc) +ATF_TC(static_abusedef); +ATF_TC_HEAD(static_abusedef, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," " loading dynamic use then static def"); } -ATF_TC_BODY(tls_extern_static_abusedef, tc) +ATF_TC_BODY(static_abusedef, tc) { tls_extern("libh_def_static.so", "libh_abuse_static.so", USE_DEF, /*xfail*/true); } -ATF_TC(tls_extern_static_abusedefnoload); -ATF_TC_HEAD(tls_extern_static_abusedefnoload, tc) +ATF_TC(static_abusedefnoload); +ATF_TC_HEAD(static_abusedefnoload, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," " loading dynamic use then static def with RTLD_NOLOAD"); } -ATF_TC_BODY(tls_extern_static_abusedefnoload, tc) +ATF_TC_BODY(static_abusedefnoload, tc) { tls_extern("libh_def_static.so", "libh_abuse_static.so", USE_DEF_NOLOAD, /*xfail*/true); } -ATF_TC(tls_extern_static_defabuse); -ATF_TC_HEAD(tls_extern_static_defabuse, tc) +ATF_TC(static_defabuse); +ATF_TC_HEAD(static_defabuse, tc) { atf_tc_set_md_var(tc, "descr", "extern __thread for TLS works," "
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 22:24:52 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Factor out logic in TLS tests to make writing more easier. No functional change intended. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.4 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.5 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.4 Thu Jun 1 20:50:18 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 1 22:24:52 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tls_extern.c,v 1.4 2023/06/01 20:50:18 riastradh Exp $ */ +/* $NetBSD: t_tls_extern.c,v 1.5 2023/06/01 22:24:52 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -33,13 +33,15 @@ #define ATF_REQUIRE_DL(x) ATF_REQUIRE_MSG(x, "%s: %s", #x, dlerror()) -ATF_TC(tls_extern_dynamic_defuse); -ATF_TC_HEAD(tls_extern_dynamic_defuse, tc) -{ - atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," - " loading def then use"); -} -ATF_TC_BODY(tls_extern_dynamic_defuse, tc) +enum order { + DEF_USE, + USE_DEF, + USE_DEF_NOLOAD, +}; + +static void +tls_extern(const char *libdef, const char *libuse, enum order order, +bool xfail) { void *def, *use; int *(*fdef)(void), *(*fuse)(void); @@ -47,19 +49,47 @@ ATF_TC_BODY(tls_extern_dynamic_defuse, t (void)dlerror(); - ATF_REQUIRE_DL(def = dlopen("libh_def_dynamic.so", 0)); - ATF_REQUIRE_DL(use = dlopen("libh_use_dynamic.so", 0)); + switch (order) { + case DEF_USE: + ATF_REQUIRE_DL(def = dlopen(libdef, 0)); + ATF_REQUIRE_DL(use = dlopen(libuse, 0)); + break; + case USE_DEF: + ATF_REQUIRE_DL(use = dlopen(libuse, 0)); + ATF_REQUIRE_DL(def = dlopen(libdef, 0)); + break; + case USE_DEF_NOLOAD: + ATF_REQUIRE_DL(use = dlopen(libuse, 0)); + ATF_REQUIRE_DL(def = dlopen(libdef, RTLD_NOLOAD)); + break; + } ATF_REQUIRE_DL(fdef = dlsym(def, "fdef")); ATF_REQUIRE_DL(fuse = dlsym(use, "fuse")); pdef = (*fdef)(); puse = (*fuse)(); + if (xfail) { + 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_dynamic_defuse); +ATF_TC_HEAD(tls_extern_dynamic_defuse, tc) +{ + atf_tc_set_md_var(tc, "descr", "extern __thread for dynamic TLS works," + " loading def then use"); +} +ATF_TC_BODY(tls_extern_dynamic_defuse, tc) +{ + tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", + DEF_USE, /*xfail*/false); +} + ATF_TC(tls_extern_dynamic_usedef); ATF_TC_HEAD(tls_extern_dynamic_usedef, tc) { @@ -68,23 +98,8 @@ ATF_TC_HEAD(tls_extern_dynamic_usedef, t } ATF_TC_BODY(tls_extern_dynamic_usedef, tc) { - void *def, *use; - int *(*fdef)(void), *(*fuse)(void); - int *pdef, *puse; - - (void)dlerror(); - - ATF_REQUIRE_DL(use = dlopen("libh_use_dynamic.so", 0)); - ATF_REQUIRE_DL(def = dlopen("libh_def_dynamic.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); + tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", + USE_DEF, /*xfail*/false); } ATF_TC(tls_extern_dynamic_usedefnoload); @@ -95,23 +110,8 @@ ATF_TC_HEAD(tls_extern_dynamic_usedefnol } ATF_TC_BODY(tls_extern_dynamic_usedefnoload, tc) { - void *def, *use; - int *(*fdef)(void), *(*fuse)(void); - int *pdef, *puse; - - (void)dlerror(); - - ATF_REQUIRE_DL(use = dlopen("libh_use_dynamic.so", 0)); - ATF_REQUIRE_DL(def = dlopen("libh_def_dynamic.so", RTLD_NOLOAD)); - - 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); + tls_extern("libh_def_dynamic.so", "libh_use_dynamic.so", + USE_DEF_NOLOAD, /*xfail*/false); } ATF_TC(tls_extern_static_defuse); @@ -122,23 +122,8 @@ ATF_TC_HEAD(tls_extern_static_defuse, 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); + tls_extern("libh_def_static.so",
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 22:24:52 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Factor out logic in TLS tests to make writing more easier. No functional change intended. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 20:48:30 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Test variations on PR toolchain/50277. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.2 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.3 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.2 Wed May 31 00:46:11 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Thu Jun 1 20:48:30 2023 @@ -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(); }
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Thu Jun 1 20:48:30 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: t_tls_extern.c Log Message: ld.elf_so: Test variations on PR toolchain/50277. XXX pullup-10 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/libexec/ld.elf_so/t_tls_extern.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Wed May 31 01:06:43 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: Makefile Log Message: ld.elf_so: Nix inadvertently committed private test program. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/libexec/ld.elf_so/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/Makefile diff -u src/tests/libexec/ld.elf_so/Makefile:1.14 src/tests/libexec/ld.elf_so/Makefile:1.15 --- src/tests/libexec/ld.elf_so/Makefile:1.14 Wed May 31 00:46:11 2023 +++ src/tests/libexec/ld.elf_so/Makefile Wed May 31 01:06:43 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14 2023/05/31 00:46:11 riastradh Exp $ +# $NetBSD: Makefile,v 1.15 2023/05/31 01:06:43 riastradh Exp $ # NOMAN= # defined @@ -68,9 +68,6 @@ SRCS.h_dl_symver_v2= h_dl_symver.c V2ODIR!= cd ${.CURDIR}/helper_symver_dso2 && ${PRINTOBJDIR} LDADD.h_dl_symver_v2= -L${V2ODIR} -lh_helper_symver_dso -PROGS+= h_tls_extern -LDADD.h_tls_extern+= -Wl,-rpath,${TESTSDIR} - .include .else
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Wed May 31 01:06:43 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: Makefile Log Message: ld.elf_so: Nix inadvertently committed private test program. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/libexec/ld.elf_so/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Wed May 31 00:46:11 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: Makefile t_tls_extern.c src/tests/libexec/ld.elf_so/helper_use_static: Makefile h_use_static.c Log Message: ld.elf_so: Fix extern TLS test to match PR toolchain/50277. Now it's actually testing the problem. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/libexec/ld.elf_so/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/t_tls_extern.c cvs rdiff -u -r1.1 -r1.2 \ src/tests/libexec/ld.elf_so/helper_use_static/Makefile \ src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/Makefile diff -u src/tests/libexec/ld.elf_so/Makefile:1.13 src/tests/libexec/ld.elf_so/Makefile:1.14 --- src/tests/libexec/ld.elf_so/Makefile:1.13 Wed May 31 00:18:44 2023 +++ src/tests/libexec/ld.elf_so/Makefile Wed May 31 00:46:11 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2023/05/31 00:18:44 riastradh Exp $ +# $NetBSD: Makefile,v 1.14 2023/05/31 00:46:11 riastradh Exp $ # NOMAN= # defined @@ -14,6 +14,7 @@ SUBDIR+= helper_dso1 helper_dso3 .WAIT h data SUBDIR+= helper_def_static +SUBDIR+= .WAIT SUBDIR+= helper_use_static TESTSDIR= ${TESTSBASE}/libexec/ld.elf_so @@ -67,6 +68,9 @@ SRCS.h_dl_symver_v2= h_dl_symver.c V2ODIR!= cd ${.CURDIR}/helper_symver_dso2 && ${PRINTOBJDIR} LDADD.h_dl_symver_v2= -L${V2ODIR} -lh_helper_symver_dso +PROGS+= h_tls_extern +LDADD.h_tls_extern+= -Wl,-rpath,${TESTSDIR} + .include .else Index: src/tests/libexec/ld.elf_so/t_tls_extern.c diff -u src/tests/libexec/ld.elf_so/t_tls_extern.c:1.1 src/tests/libexec/ld.elf_so/t_tls_extern.c:1.2 --- src/tests/libexec/ld.elf_so/t_tls_extern.c:1.1 Wed May 31 00:18:44 2023 +++ src/tests/libexec/ld.elf_so/t_tls_extern.c Wed May 31 00:46:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_tls_extern.c,v 1.1 2023/05/31 00:18:44 riastradh Exp $ */ +/* $NetBSD: t_tls_extern.c,v 1.2 2023/05/31 00:46:11 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #include -#define ATF_CHECK_DL(x) ATF_CHECK_MSG(x, "%s: %s", #x, dlerror()) +#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) @@ -45,10 +45,10 @@ ATF_TC_BODY(tls_extern_static, tc) int *pdef, *puse; (void)dlerror(); - ATF_CHECK_DL(def = dlopen("libh_def_static.so", RTLD_LAZY)); - ATF_CHECK_DL(use = dlopen("libh_use_static.so", RTLD_LAZY)); - ATF_CHECK_DL(fdef = dlsym(def, "fdef")); - ATF_CHECK_DL(fuse = dlsym(use, "fuse")); + 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")); pdef = (*fdef)(); puse = (*fuse)(); Index: src/tests/libexec/ld.elf_so/helper_use_static/Makefile diff -u src/tests/libexec/ld.elf_so/helper_use_static/Makefile:1.1 src/tests/libexec/ld.elf_so/helper_use_static/Makefile:1.2 --- src/tests/libexec/ld.elf_so/helper_use_static/Makefile:1.1 Wed May 31 00:18:44 2023 +++ src/tests/libexec/ld.elf_so/helper_use_static/Makefile Wed May 31 00:46:11 2023 @@ -1,10 +1,13 @@ -# $NetBSD: Makefile,v 1.1 2023/05/31 00:18:44 riastradh Exp $ +# $NetBSD: Makefile,v 1.2 2023/05/31 00:46:11 riastradh Exp $ .include LIB= h_use_static SRCS= h_use_static.c +DEF_DIR!= cd ${.CURDIR}/../helper_def_static && ${PRINTOBJDIR} +LDADD+= -Wl,-rpath,${TESTSDIR} -L${DEF_DIR} -lh_def_static + LIBDIR= ${TESTSBASE}/libexec/ld.elf_so SHLIBDIR= ${TESTSBASE}/libexec/ld.elf_so SHLIB_MAJOR= 1 Index: src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c diff -u src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c:1.1 src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c:1.2 --- src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c:1.1 Wed May 31 00:18:44 2023 +++ src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c Wed May 31 00:46:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: h_use_static.c,v 1.1 2023/05/31 00:18:44 riastradh Exp $ */ +/* $NetBSD: h_use_static.c,v 1.2 2023/05/31 00:46:11 riastradh Exp $ */ /*- * Copyright (c) 2023 The NetBSD Foundation, Inc. @@ -26,7 +26,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -__thread int mysym __attribute__((tls_model("initial-exec"))) = 0; +extern __thread int mysym __attribute__((tls_model("initial-exec"))); int *fuse(void); int *
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: riastradh Date: Wed May 31 00:46:11 UTC 2023 Modified Files: src/tests/libexec/ld.elf_so: Makefile t_tls_extern.c src/tests/libexec/ld.elf_so/helper_use_static: Makefile h_use_static.c Log Message: ld.elf_so: Fix extern TLS test to match PR toolchain/50277. Now it's actually testing the problem. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/libexec/ld.elf_so/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/t_tls_extern.c cvs rdiff -u -r1.1 -r1.2 \ src/tests/libexec/ld.elf_so/helper_use_static/Makefile \ src/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/tests/libexec/ld.elf_so
On 21/06/2022 17:24, Christos Zoulas wrote: Module Name:src Committed By: christos Date: Tue Jun 21 16:24:37 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_ifunc.c Log Message: sort; it is the same list as in h_ifunc_static.c; perhaps it should be a HAVE_ something? Thanks. I agree a HAVE_ something (in a arch/foo.h file) would be better. Nick
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: christos Date: Tue Jun 21 16:24:37 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_ifunc.c Log Message: sort; it is the same list as in h_ifunc_static.c; perhaps it should be a HAVE_ something? To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/libexec/ld.elf_so/t_ifunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: christos Date: Tue Jun 21 16:24:37 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_ifunc.c Log Message: sort; it is the same list as in h_ifunc_static.c; perhaps it should be a HAVE_ something? To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/libexec/ld.elf_so/t_ifunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_ifunc.c diff -u src/tests/libexec/ld.elf_so/t_ifunc.c:1.12 src/tests/libexec/ld.elf_so/t_ifunc.c:1.13 --- src/tests/libexec/ld.elf_so/t_ifunc.c:1.12 Tue Jun 21 02:52:17 2022 +++ src/tests/libexec/ld.elf_so/t_ifunc.c Tue Jun 21 12:24:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ifunc.c,v 1.12 2022/06/21 06:52:17 skrll Exp $ */ +/* $NetBSD: t_ifunc.c,v 1.13 2022/06/21 16:24:37 christos Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -39,8 +39,8 @@ defined(__aarch64__) || \ defined(__arm__) || \ defined(__i386__) || \ -defined(__sparc__) || \ defined(__powerpc__) || \ +defined(__sparc__) || \ defined(__x86_64__) #define LINKER_SUPPORT 1 #else
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: skrll Date: Mon Jun 13 19:49:34 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_ifunc.c Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/libexec/ld.elf_so/t_ifunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_ifunc.c diff -u src/tests/libexec/ld.elf_so/t_ifunc.c:1.9 src/tests/libexec/ld.elf_so/t_ifunc.c:1.10 --- src/tests/libexec/ld.elf_so/t_ifunc.c:1.9 Tue Jul 9 16:24:01 2019 +++ src/tests/libexec/ld.elf_so/t_ifunc.c Mon Jun 13 19:49:33 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ifunc.c,v 1.9 2019/07/09 16:24:01 maya Exp $ */ +/* $NetBSD: t_ifunc.c,v 1.10 2022/06/13 19:49:33 skrll Exp $ */ /* * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include "h_macros.h" -#if defined( __arm__) || defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__sparc__) +#if defined(__arm__) || defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__sparc__) #define LINKER_SUPPORT 1 #else #define LINKER_SUPPORT 0
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: skrll Date: Mon Jun 13 19:49:34 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_ifunc.c Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/libexec/ld.elf_so/t_ifunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: skrll Date: Fri Jan 14 07:34:07 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_dlerror-false.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/libexec/ld.elf_so/t_dlerror-false.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/t_dlerror-false.c diff -u src/tests/libexec/ld.elf_so/t_dlerror-false.c:1.2 src/tests/libexec/ld.elf_so/t_dlerror-false.c:1.3 --- src/tests/libexec/ld.elf_so/t_dlerror-false.c:1.2 Fri Jan 13 21:30:42 2017 +++ src/tests/libexec/ld.elf_so/t_dlerror-false.c Fri Jan 14 07:34:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlerror-false.c,v 1.2 2017/01/13 21:30:42 christos Exp $ */ +/* $NetBSD: t_dlerror-false.c,v 1.3 2022/01/14 07:34:07 skrll Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -46,9 +46,9 @@ ATF_TC_BODY(rtld_dlerror_false, tc) { void *handle, *sym; char *error; - + /* - * + * * Test for dlerror() being set by a successful library open. * Requires that the rpath be set to something that does not * include libm.so. @@ -58,7 +58,7 @@ ATF_TC_BODY(rtld_dlerror_false, tc) error = dlerror(); ATF_CHECK(error == NULL); ATF_CHECK(handle != NULL); - + sym = dlsym(handle, "sin"); error = dlerror(); ATF_CHECK(sym != NULL); @@ -68,7 +68,7 @@ ATF_TC_BODY(rtld_dlerror_false, tc) error = dlerror(); ATF_CHECK(error == NULL); - + } ATF_TP_ADD_TCS(tp)
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: skrll Date: Fri Jan 14 07:34:07 UTC 2022 Modified Files: src/tests/libexec/ld.elf_so: t_dlerror-false.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/libexec/ld.elf_so/t_dlerror-false.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: christos Date: Tue May 14 19:07:07 UTC 2019 Modified Files: src/tests/libexec/ld.elf_so: Makefile Makefile.inc Log Message: clang ifunc's on powerpc require secure-plt. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/libexec/ld.elf_so/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/libexec/ld.elf_so/Makefile diff -u src/tests/libexec/ld.elf_so/Makefile:1.9 src/tests/libexec/ld.elf_so/Makefile:1.10 --- src/tests/libexec/ld.elf_so/Makefile:1.9 Tue Jul 11 11:21:36 2017 +++ src/tests/libexec/ld.elf_so/Makefile Tue May 14 15:07:07 2019 @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.9 2017/07/11 15:21:36 joerg Exp $ +# $NetBSD: Makefile,v 1.10 2019/05/14 19:07:07 christos Exp $ # NOMAN= # defined +.include "Makefile.inc" .include .if ${MKPIC} != "no" Index: src/tests/libexec/ld.elf_so/Makefile.inc diff -u src/tests/libexec/ld.elf_so/Makefile.inc:1.1 src/tests/libexec/ld.elf_so/Makefile.inc:1.2 --- src/tests/libexec/ld.elf_so/Makefile.inc:1.1 Sat Jun 11 14:03:19 2011 +++ src/tests/libexec/ld.elf_so/Makefile.inc Tue May 14 15:07:07 2019 @@ -1 +1,5 @@ .include "../Makefile.inc" + +.if ${MACHINE_ARCH} == "powerpc" +CFLAGS += -msecure-plt +.endif
CVS commit: src/tests/libexec/ld.elf_so
Module Name:src Committed By: christos Date: Tue May 14 19:07:07 UTC 2019 Modified Files: src/tests/libexec/ld.elf_so: Makefile Makefile.inc Log Message: clang ifunc's on powerpc require secure-plt. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/libexec/ld.elf_so/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/libexec/ld.elf_so/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/tests/libexec/ld.elf_so/helper_dso1
Module Name: src Committed By: joerg Date: Sat Apr 2 12:53:33 UTC 2011 Modified Files: src/tests/libexec/ld.elf_so/helper_dso1: h_helper_dso1.c Log Message: Don't fail on platforms without TLS BTW, should we skip building ld.elf_so tests in MKPIC=no case? (i.e. move them into src/distrib/sets/lists/tests/shl.mi) --- Izumi Tsutsui