Blame src/functional/tls_align_dlopen.c
|
nsz |
462b4f |
#include <dlfcn.h>
|
|
nsz |
462b4f |
#include "test.h"
|
|
nsz |
462b4f |
|
|
nsz |
462b4f |
int main()
|
|
nsz |
462b4f |
{
|
|
nsz |
462b4f |
int i;
|
|
nsz |
462b4f |
void *h;
|
|
nsz |
462b4f |
struct {
|
|
nsz |
462b4f |
char *name;
|
|
nsz |
cdfd9b |
unsigned size;
|
|
nsz |
cdfd9b |
unsigned align;
|
|
nsz |
cdfd9b |
unsigned long addr;
|
|
nsz |
462b4f |
} *t;
|
|
nsz |
462b4f |
|
|
nsz |
462b4f |
h = dlopen("./tls_align_dso.so", RTLD_LAZY);
|
|
nsz |
462b4f |
if (!h)
|
|
Szabolcs Nagy |
cfa23c |
t_error("dlopen failed\n");
|
|
nsz |
462b4f |
t = dlsym(h, "t");
|
|
nsz |
462b4f |
if (!t)
|
|
Szabolcs Nagy |
cfa23c |
t_error("dlsym failed\n");
|
|
nsz |
462b4f |
|
|
nsz |
462b4f |
for (i = 0; i < 4; i++) {
|
|
nsz |
462b4f |
if (!t[i].name)
|
|
Szabolcs Nagy |
cfa23c |
t_error("name is not set for t[%d]\n", i);
|
|
nsz |
462b4f |
if (t[i].addr & (t[i].align-1))
|
|
Szabolcs Nagy |
cfa23c |
t_error("bad alignment: %s, size: %u, align: %u, addr: 0x%lx\n",
|
|
nsz |
cdfd9b |
t[i].name, t[i].size, t[i].align, t[i].addr);
|
|
nsz |
462b4f |
}
|
|
Szabolcs Nagy |
cfa23c |
return t_status;
|
|
nsz |
462b4f |
}
|