mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-17 18:40:14 +00:00
d347a4ab1d
2003-07-31 Jakub Jelinek <jakub@redhat.com> * dlfcn/dlerror.c (once): New. (dlerror): Call __libc_once. (_dlerror_run): Remove once. 2003-07-31 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/ia64/bits/sigcontext.h (struct sigcontext): Sync with 2.5.7 and 2.5.73 kernel changes. 2003-07-31 Jakub Jelinek <jakub@redhat.com> * dlfcn/eval.c (funcall): Add noinline attribute to shut up warnings. * elf/rtld.c (dl_main): Cast ElfW(Addr) arguments with %Zx/%Zd formats to size_t. * elf/dl-lookup.c (_dl_debug_bindings): Likewise. * elf/tst-tls6.c (do_test): Use %zd format for l_tls_modid. * elf/tst-tls8.c (do_test): Use %zd format for modid1 and modid2. * gmon/tst-sprofil.c (main): Add parens to shut up warning. * iconv/tst-iconv3.c (main): Use %td instead of %zd for pointer difference argument. * stdio-common/tst-wc-printf.c (main): Cast arguments with %C format to wint_t. * stdlib/tst-limits.c (main): For WORD_BIT and LONG_BIT, use %d format and cast expected value to int. * sysdeps/generic/libc-start.c (STATIC): Add __attribute__((always_inline) if LIBC_START_MAIN is already defined. * sysdeps/powerpc/fpu/w_sqrt.c (a_nan, a_inf): Change from uint32_t to ieee_float_shape_type. (__sqrt): Avoid type punning. * sysdeps/powerpc/fpu/w_sqrtf.c (a_nan, a_inf): Change from uint32_t to ieee_float_shape_type. (__sqrtf): Avoid type punning. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Don't define refsym if in dl-conflict.c. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/unix/sysv/linux/i386/semctl.c (union semun): Add __old_buf. (__new_semctl): Shut up warning. * sysdeps/unix/sysv/linux/semctl.c (union semun): Add __old_buf. (__new_semctl): Shut up warning. * sysdeps/unix/sysv/linux/shmctl.c (__new_shmctl): Wrap long lines. Change old into union of __old_shmid_ds and __old_shminfo structs. Adjust all users. * wcsmbs/wcsmbs-tst1.c (main): Cast arguments with %C format to wint_t. 2003-07-31 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/utimes.c (__utimes): Fix actime and modtime computation. * sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise. * sysdeps/posix/utimes.c (__utimes): Likewise.
175 lines
3.9 KiB
C
175 lines
3.9 KiB
C
#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-tlsmod3.so";
|
|
static const char modname2[] = "tst-tlsmod4.so";
|
|
int result = 0;
|
|
int (*fp1) (void);
|
|
int (*fp2) (int, int *);
|
|
void *h1;
|
|
void *h2;
|
|
int i;
|
|
size_t modid1 = (size_t) -1;
|
|
size_t modid2 = (size_t) -1;
|
|
int *bazp;
|
|
|
|
for (i = 0; i < 10; ++i)
|
|
{
|
|
h1 = dlopen (modname1, RTLD_LAZY);
|
|
if (h1 == NULL)
|
|
{
|
|
printf ("cannot open '%s': %s\n", modname1, dlerror ());
|
|
exit (1);
|
|
}
|
|
|
|
/* 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. */
|
|
if (modid1 == (size_t) -1)
|
|
modid1 = ((struct link_map *) h1)->l_tls_modid;
|
|
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;
|
|
}
|
|
|
|
fp1 = dlsym (h1, "in_dso2");
|
|
if (fp1 == NULL)
|
|
{
|
|
printf ("cannot get symbol 'in_dso2' in %s\n", modname1);
|
|
exit (1);
|
|
}
|
|
|
|
result |= fp1 ();
|
|
|
|
|
|
|
|
h2 = dlopen (modname2, RTLD_LAZY);
|
|
if (h2 == NULL)
|
|
{
|
|
printf ("cannot open '%s': %s\n", modname2, dlerror ());
|
|
exit (1);
|
|
}
|
|
|
|
/* 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. */
|
|
if (modid2 == (size_t) -1)
|
|
modid2 = ((struct link_map *) h1)->l_tls_modid;
|
|
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;
|
|
}
|
|
|
|
bazp = dlsym (h2, "baz");
|
|
if (bazp == NULL)
|
|
{
|
|
printf ("cannot get symbol 'baz' in %s\n", modname2);
|
|
exit (1);
|
|
}
|
|
|
|
*bazp = 42 + i;
|
|
|
|
fp2 = dlsym (h2, "in_dso");
|
|
if (fp2 == NULL)
|
|
{
|
|
printf ("cannot get symbol 'in_dso' in %s\n", modname2);
|
|
exit (1);
|
|
}
|
|
|
|
result |= fp2 (42 + i, bazp);
|
|
|
|
dlclose (h1);
|
|
dlclose (h2);
|
|
|
|
|
|
h1 = dlopen (modname1, RTLD_LAZY);
|
|
if (h1 == NULL)
|
|
{
|
|
printf ("cannot open '%s': %s\n", modname1, dlerror ());
|
|
exit (1);
|
|
}
|
|
|
|
/* 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. */
|
|
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;
|
|
}
|
|
|
|
fp1 = dlsym (h1, "in_dso2");
|
|
if (fp1 == NULL)
|
|
{
|
|
printf ("cannot get symbol 'in_dso2' in %s\n", modname1);
|
|
exit (1);
|
|
}
|
|
|
|
result |= fp1 ();
|
|
|
|
|
|
|
|
h2 = dlopen (modname2, RTLD_LAZY);
|
|
if (h2 == NULL)
|
|
{
|
|
printf ("cannot open '%s': %s\n", modname2, dlerror ());
|
|
exit (1);
|
|
}
|
|
|
|
/* 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. */
|
|
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;
|
|
}
|
|
|
|
bazp = dlsym (h2, "baz");
|
|
if (bazp == NULL)
|
|
{
|
|
printf ("cannot get symbol 'baz' in %s\n", modname2);
|
|
exit (1);
|
|
}
|
|
|
|
*bazp = 62 + i;
|
|
|
|
fp2 = dlsym (h2, "in_dso");
|
|
if (fp2 == NULL)
|
|
{
|
|
printf ("cannot get symbol 'in_dso' in %s\n", modname2);
|
|
exit (1);
|
|
}
|
|
|
|
result |= fp2 (62 + i, bazp);
|
|
|
|
/* This time the dlclose calls are in reverse order. */
|
|
dlclose (h2);
|
|
dlclose (h1);
|
|
}
|
|
|
|
return result;
|
|
#else
|
|
return 0;
|
|
#endif
|
|
}
|
|
|
|
|
|
#include "../test-skeleton.c"
|