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: Fix extern TLS test to ma...



details:   https://anonhg.NetBSD.org/src/rev/a30b6859ae24
branches:  trunk
changeset: 376078:a30b6859ae24
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 31 00:46:11 2023 +0000

description:
ld.elf_so: Fix extern TLS test to match PR toolchain/50277.

Now it's actually testing the problem.

diffstat:

 tests/libexec/ld.elf_so/Makefile                         |   6 +++++-
 tests/libexec/ld.elf_so/helper_use_static/Makefile       |   5 ++++-
 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c |   4 ++--
 tests/libexec/ld.elf_so/t_tls_extern.c                   |  12 ++++++------
 4 files changed, 17 insertions(+), 10 deletions(-)

diffs (96 lines):

diff -r 156e8b157a43 -r a30b6859ae24 tests/libexec/ld.elf_so/Makefile
--- a/tests/libexec/ld.elf_so/Makefile  Wed May 31 00:18:44 2023 +0000
+++ b/tests/libexec/ld.elf_so/Makefile  Wed May 31 00:46:11 2023 +0000
@@ -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
diff -r 156e8b157a43 -r a30b6859ae24 tests/libexec/ld.elf_so/helper_use_static/Makefile
--- a/tests/libexec/ld.elf_so/helper_use_static/Makefile        Wed May 31 00:18:44 2023 +0000
+++ b/tests/libexec/ld.elf_so/helper_use_static/Makefile        Wed May 31 00:46:11 2023 +0000
@@ -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 -r 156e8b157a43 -r a30b6859ae24 tests/libexec/ld.elf_so/helper_use_static/h_use_static.c
--- a/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c  Wed May 31 00:18:44 2023 +0000
+++ b/tests/libexec/ld.elf_so/helper_use_static/h_use_static.c  Wed May 31 00:46:11 2023 +0000
@@ -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 -r 156e8b157a43 -r a30b6859ae24 tests/libexec/ld.elf_so/t_tls_extern.c
--- a/tests/libexec/ld.elf_so/t_tls_extern.c    Wed May 31 00:18:44 2023 +0000
+++ b/tests/libexec/ld.elf_so/t_tls_extern.c    Wed May 31 00:46:11 2023 +0000
@@ -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)();



Home | Main Index | Thread Index | Old Index