summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/Makefile4
-rw-r--r--test/tls/tst-tls7.c18
-rw-r--r--test/tls/tst-tls8.c56
3 files changed, 76 insertions, 2 deletions
diff --git a/test/Makefile b/test/Makefile
index 7d56217cb..d3af44f80 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -36,8 +36,8 @@ ifeq ($(UCLIBC_HAS_THREADS),y)
ALL_SUBDIRS += pthread
endif
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- DIRS += tls
-ALL_SUBDIRS += tls
+ DIRS += tls nptl
+ALL_SUBDIRS += tls nptl
endif
diff --git a/test/tls/tst-tls7.c b/test/tls/tst-tls7.c
index 37f1a63e1..3397614ae 100644
--- a/test/tls/tst-tls7.c
+++ b/test/tls/tst-tls7.c
@@ -4,6 +4,10 @@
#include <link.h>
#include <tls.h>
+#ifdef __UCLIBC__
+#include "dl-elf.h"
+#include "dl-hash.h"
+#endif
#define TEST_FUNCTION do_test ()
@@ -30,6 +34,19 @@ do_test (void)
/* Dirty test code here: we peek into a private data structure.
We make sure that the module gets assigned the same ID every
time. The value of the first round is used. */
+#ifdef __UCLIBC__
+ if (modid == -1)
+ modid = ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid;
+ else if (((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid
+ != (size_t) modid)
+ {
+ printf ("round %d: modid now %zu, initially %d\n",
+ i,
+ ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid,
+ modid);
+ result = 1;
+ }
+#else
if (modid == -1)
modid = ((struct link_map *) h)->l_tls_modid;
else if (((struct link_map *) h)->l_tls_modid != (size_t) modid)
@@ -38,6 +55,7 @@ do_test (void)
i, ((struct link_map *) h)->l_tls_modid, modid);
result = 1;
}
+#endif
fp = dlsym (h, "in_dso2");
if (fp == NULL)
diff --git a/test/tls/tst-tls8.c b/test/tls/tst-tls8.c
index dd896c493..6adb0968b 100644
--- a/test/tls/tst-tls8.c
+++ b/test/tls/tst-tls8.c
@@ -4,6 +4,10 @@
#include <link.h>
#include <tls.h>
+#ifdef __UCLIBC__
+#include "dl-elf.h"
+#include "dl-hash.h"
+#endif
#define TEST_FUNCTION do_test ()
@@ -35,6 +39,19 @@ do_test (void)
/* Dirty test code here: we peek into a private data structure.
We make sure that the module gets assigned the same ID every
time. The value of the first round is used. */
+#ifdef __UCLIBC__
+ if (modid1 == (size_t) -1)
+ modid1 = ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid;
+ else if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+ != (size_t) modid1)
+ {
+ printf ("round %d: modid now %zd, initially %zd\n",
+ i,
+ ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+ modid1);
+ result = 1;
+ }
+#else
if (modid1 == (size_t) -1)
modid1 = ((struct link_map *) h1)->l_tls_modid;
else if (((struct link_map *) h1)->l_tls_modid != modid1)
@@ -43,6 +60,7 @@ do_test (void)
i, ((struct link_map *) h1)->l_tls_modid, modid1);
result = 1;
}
+#endif
fp1 = dlsym (h1, "in_dso2");
if (fp1 == NULL)
@@ -65,6 +83,19 @@ do_test (void)
/* Dirty test code here: we peek into a private data structure.
We make sure that the module gets assigned the same ID every
time. The value of the first round is used. */
+#ifdef __UCLIBC__
+ if (modid2 == (size_t) -1)
+ modid2 = ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid;
+ else if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+ != (size_t) modid2)
+ {
+ printf ("round %d: modid now %zd, initially %zd\n",
+ i,
+ ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+ modid2);
+ result = 1;
+ }
+#else
if (modid2 == (size_t) -1)
modid2 = ((struct link_map *) h1)->l_tls_modid;
else if (((struct link_map *) h1)->l_tls_modid != modid2)
@@ -73,6 +104,7 @@ do_test (void)
i, ((struct link_map *) h1)->l_tls_modid, modid2);
result = 1;
}
+#endif
bazp = dlsym (h2, "baz");
if (bazp == NULL)
@@ -106,12 +138,24 @@ do_test (void)
/* Dirty test code here: we peek into a private data structure.
We make sure that the module gets assigned the same ID every
time. The value of the first round is used. */
+#ifdef __UCLIBC__
+ if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+ != modid1)
+ {
+ printf ("round %d: modid now %zd, initially %zd\n",
+ i,
+ ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+ modid1);
+ result = 1;
+ }
+#else
if (((struct link_map *) h1)->l_tls_modid != modid1)
{
printf ("round %d: modid now %zd, initially %zd\n",
i, ((struct link_map *) h1)->l_tls_modid, modid1);
result = 1;
}
+#endif
fp1 = dlsym (h1, "in_dso2");
if (fp1 == NULL)
@@ -134,12 +178,24 @@ do_test (void)
/* Dirty test code here: we peek into a private data structure.
We make sure that the module gets assigned the same ID every
time. The value of the first round is used. */
+#ifdef __UCLIBC__
+ if (((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid
+ != modid2)
+ {
+ printf ("round %d: modid now %zd, initially %zd\n",
+ i,
+ ((struct link_map *)((struct dyn_elf *)h1)->dyn)->l_tls_modid,
+ modid2);
+ result = 1;
+ }
+#else
if (((struct link_map *) h1)->l_tls_modid != modid2)
{
printf ("round %d: modid now %zd, initially %zd\n",
i, ((struct link_map *) h1)->l_tls_modid, modid2);
result = 1;
}
+#endif
bazp = dlsym (h2, "baz");
if (bazp == NULL)