Blame src/regression/tls_get_new-dtv.c
|
Szabolcs Nagy |
79af0f |
// __tls_get_new did not allocate new dtv for threads properly
|
|
Szabolcs Nagy |
79af0f |
#include <pthread.h>
|
|
Szabolcs Nagy |
79af0f |
#include <dlfcn.h>
|
|
Szabolcs Nagy |
79af0f |
#include "test.h"
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
#define N 10
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
#define T(c) ((c) || (t_error(#c " failed\n"),0))
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
static pthread_barrier_t b;
|
|
Szabolcs Nagy |
79af0f |
static void *mod;
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
static void *start(void *a)
|
|
Szabolcs Nagy |
79af0f |
{
|
|
Szabolcs Nagy |
79af0f |
void *(*f)(void);
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
pthread_barrier_wait(&b);
|
|
Szabolcs Nagy |
79af0f |
T(f = dlsym(mod, "f"));
|
|
Szabolcs Nagy |
79af0f |
f();
|
|
Szabolcs Nagy |
79af0f |
return 0;
|
|
Szabolcs Nagy |
79af0f |
}
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
int main()
|
|
Szabolcs Nagy |
79af0f |
{
|
|
Szabolcs Nagy |
79af0f |
pthread_t td[N];
|
|
Szabolcs Nagy |
79af0f |
int i;
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
pthread_barrier_init(&b, 0, N+1);
|
|
Szabolcs Nagy |
79af0f |
for (i=0; i
|
|
Szabolcs Nagy |
79af0f |
T(!pthread_create(td+i, 0, start, 0));
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
T(mod = dlopen("tls_get_new-dtv_dso.so", RTLD_NOW));
|
|
Szabolcs Nagy |
79af0f |
pthread_barrier_wait(&b);
|
|
Szabolcs Nagy |
79af0f |
|
|
Szabolcs Nagy |
79af0f |
for (i=0; i
|
|
Szabolcs Nagy |
79af0f |
T(!pthread_join(td[i], 0));
|
|
Szabolcs Nagy |
79af0f |
return t_status;
|
|
Szabolcs Nagy |
79af0f |
}
|