summaryrefslogtreecommitdiff
path: root/tests/libexec
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-05-31 00:46:11 +0000
committerriastradh <riastradh@NetBSD.org>2023-05-31 00:46:11 +0000
commitfdb8cd5a0e8f37337f58a8d96be92f98c158098f (patch)
tree0918b0311c7cd0f7e6178286626fb90e2c0cd422 /tests/libexec
parent8f4e92485fadf48b2386d5447c1db17823ca6e3b (diff)
ld.elf_so: Fix extern TLS test to match PR toolchain/50277.
Now it's actually testing the problem.
Diffstat (limited to 'tests/libexec')
-rw-r--r--tests/libexec/ld.elf_so/Makefile6
-rw-r--r--tests/libexec/ld.elf_so/helper_use_static/Makefile5
-rw-r--r--tests/libexec/ld.elf_so/helper_use_static/h_use_static.c4
-rw-r--r--tests/libexec/ld.elf_so/t_tls_extern.c12
4 files changed, 17 insertions, 10 deletions
diff --git a/tests/libexec/ld.elf_so/Makefile b/tests/libexec/ld.elf_so/Makefile
index c0b9cb7e0cf..76acfd2eeca 100644
--- a/tests/libexec/ld.elf_so/Makefile
+++ b/tests/libexec/ld.elf_so/Makefile
@@ -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 helper_dso2 .WAIT \
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
diff --git a/tests/libexec/ld.elf_so/helper_use_static/Makefile b/tests/libexec/ld.elf_so/helper_use_static/Makefile
index 56b61d538a8..b3d9cbe1a3f 100644
--- a/tests/libexec/ld.elf_so/helper_use_static/Makefile
+++ b/tests/libexec/ld.elf_so/helper_use_static/Makefile
@@ -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
diff --git a/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c b/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c
index c732fae4c6e..02e3676bcf6 100644
--- a/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c
+++ b/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c
@@ -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 *
diff --git a/tests/libexec/ld.elf_so/t_tls_extern.c b/tests/libexec/ld.elf_so/t_tls_extern.c
index 89b4c7ca3de..ea42c2a3967 100644
--- a/tests/libexec/ld.elf_so/t_tls_extern.c
+++ b/tests/libexec/ld.elf_so/t_tls_extern.c
@@ -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)();