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 <bsd.test.mk> .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 <atf-c.h> #include <dlfcn.h> -#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 <bsd.own.mk> 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 *