2002-10-21 Roland McGrath <roland@redhat.com>

* elf/tst-tls9.c, elf/tst-tls9-static.c: New files.
	* elf/tst-tlsmod5.c, elf/tst-tlsmod6.c: New files.
	* elf/Makefile (tests): Add tst-tls9.
	(tests-static): Add tst-tls9-static.
	(tst-tls9-static-ENV): New variable.
	($(objpfx)tst-tls9-static, $(objpfx)tst-tls9-static.out): New targets.
This commit is contained in:
Roland McGrath 2002-10-22 06:22:38 +00:00
parent 82bbb29edd
commit 6ef518c323
5 changed files with 77 additions and 1 deletions

View File

@ -69,6 +69,7 @@ distribute := rtld-Rules \
unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \ unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \ unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \ tst-tlsmod1.c tst-tlsmod2.c tst-tlsmod3.c tst-tlsmod4.c \
tst-tlsmod5.c tst-tlsmod6.c \
circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \ circlemod1.c circlemod1a.c circlemod2.c circlemod2a.c \
circlemod3.c circlemod3a.c nodlopenmod2.c \ circlemod3.c circlemod3a.c nodlopenmod2.c \
tls-macros.h tls-macros.h
@ -115,9 +116,14 @@ vpath %.c ../locale/programs
endif endif
endif endif
tests = tst-tls1 tst-tls2 tests = tst-tls1 tst-tls2 tst-tls9
ifeq (yes,$(build-static)) ifeq (yes,$(build-static))
tests-static = tst-tls1-static tst-tls2-static tests-static = tst-tls1-static tst-tls2-static
ifeq (yesyesyes,$(build-static)$(build-shared)$(elf))
tests-static += tst-tls9-static
tst-tls9-static-ENV = \
LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
endif
tests += $(tests-static) tests += $(tests-static)
endif endif
ifeq (yes,$(build-shared)) ifeq (yes,$(build-shared))
@ -147,6 +153,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \ reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
reldep7mod1 reldep7mod2 \ reldep7mod1 reldep7mod2 \
tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \ tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4 \
tst-tlsmod5 tst-tlsmod6 \
circlemod1 circlemod1a circlemod2 circlemod2a \ circlemod1 circlemod1a circlemod2 circlemod2a \
circlemod3 circlemod3a circlemod3 circlemod3a
modules-vis-yes = vismod1 vismod2 vismod3 modules-vis-yes = vismod1 vismod2 vismod3
@ -347,6 +354,9 @@ $(objpfx)reldep6mod3.so: $(objpfx)reldep6mod2.so
$(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so $(objpfx)reldep6mod4.so: $(objpfx)reldep6mod1.so
$(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so $(objpfx)tst-tlsmod3.so: $(objpfx)tst-tlsmod2.so
LDFLAGS-tst-tlsmod5.so = -nostdlib
LDFLAGS-tst-tlsmod6.so = -nostdlib
# filtmod1.so has a special rule # filtmod1.so has a special rule
$(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
$(build-module) $(build-module)
@ -523,3 +533,11 @@ $(objpfx)tst-tls7.out: $(objpfx)tst-tlsmod3.so
$(objpfx)tst-tls8: $(libdl) $(objpfx)tst-tls8: $(libdl)
$(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so $(objpfx)tst-tls8.out: $(objpfx)tst-tlsmod3.so $(objpfx)tst-tlsmod4.so
$(objpfx)tst-tls9: $(libdl)
$(objpfx)tst-tls9.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
ifdef libdl
$(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
$(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
endif

1
elf/tst-tls9-static.c Normal file
View File

@ -0,0 +1 @@
#include "tst-tls9.c"

43
elf/tst-tls9.c Normal file
View File

@ -0,0 +1,43 @@
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <link.h>
#include <tls.h>
#define TEST_FUNCTION do_test ()
static int
do_test (void)
{
#ifdef USE_TLS
static const char modname1[] = "tst-tlsmod5.so";
static const char modname2[] = "tst-tlsmod6.so";
int result = 0;
void *h1 = dlopen (modname1, RTLD_LAZY);
if (h1 == NULL)
{
printf ("cannot open '%s': %s\n", modname1, dlerror ());
result = 1;
}
void *h2 = dlopen (modname2, RTLD_LAZY);
if (h2 == NULL)
{
printf ("cannot open '%s': %s\n", modname2, dlerror ());
result = 1;
}
if (h1 != NULL)
dlclose (h1);
if (h2 != NULL)
dlclose (h2);
return result;
#else
return 0;
#endif
}
#include "../test-skeleton.c"

7
elf/tst-tlsmod5.c Normal file
View File

@ -0,0 +1,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(foo);
#endif

7
elf/tst-tlsmod6.c Normal file
View File

@ -0,0 +1,7 @@
#include <tls.h>
#ifdef USE_TLS
#include "tls-macros.h"
COMMON_INT_DEF(bar);
#endif