|
Packit Service |
82fcde |
#include <dlfcn.h>
|
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <stdlib.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
static const char modname[] = "tst-tlsmod2.so";
|
|
Packit Service |
82fcde |
int result = 0;
|
|
Packit Service |
82fcde |
int *foop;
|
|
Packit Service |
82fcde |
int (*fp) (int, int *);
|
|
Packit Service |
82fcde |
void *h;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
h = dlopen (modname, RTLD_LAZY);
|
|
Packit Service |
82fcde |
if (h == NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("cannot open '%s': %s\n", modname, dlerror ());
|
|
Packit Service |
82fcde |
exit (1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
fp = dlsym (h, "in_dso");
|
|
Packit Service |
82fcde |
if (fp == NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
|
|
Packit Service |
82fcde |
exit (1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
result |= fp (0, NULL);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
foop = dlsym (h, "foo");
|
|
Packit Service |
82fcde |
if (foop == NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
|
|
Packit Service |
82fcde |
exit (1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
if (*foop != 16)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
puts ("foo != 16");
|
|
Packit Service |
82fcde |
result = 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
dlclose (h);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
return result;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <support/test-driver.c>
|