• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <dlfcn.h>
2 #include "test.h"
3 
main()4 int main()
5 {
6 	int i;
7 	void *h;
8 	struct {
9 		char *name;
10 		unsigned size;
11 		unsigned align;
12 		unsigned long addr;
13 	} *t;
14 
15 	h = dlopen("src/functional/tls_align_dso.so", RTLD_LAZY);
16 	if (!h)
17 		t_error("dlopen failed\n");
18 	t = dlsym(h, "t");
19 	if (!t)
20 		t_error("dlsym failed\n");
21 	else for (i = 0; i < 4; i++) {
22 		if (!t[i].name)
23 			t_error("name is not set for t[%d]\n", i);
24 		if (t[i].addr & (t[i].align-1))
25 			t_error("bad alignment: %s, size: %u, align: %u, addr: 0x%lx\n",
26 				t[i].name, t[i].size, t[i].align, t[i].addr);
27 	}
28 	return t_status;
29 }
30