1 /* RUN: %clang_msan -g %s -o %t
2 RUN: %clang_msan -g %s -DBUILD_SO -fPIC -o %t-so.so -shared
3 RUN: %run %t 2>&1 | FileCheck %s
16 typedef volatile long *(* get_t
)();
19 int main(int argc
, char *argv
[]) {
21 snprintf(path
, sizeof(path
), "%s-so.so", argv
[0]);
24 void *handle
= dlopen(path
, RTLD_LAZY
);
25 if (!handle
) fprintf(stderr
, "%s\n", dlerror());
27 GetTls
= (get_t
)dlsym(handle
, "GetTls");
28 assert(dlerror() == 0);
31 int ret
= dladdr(GetTls
, &info
);
33 printf ("fname: %s\n", info
.dli_fname
);
34 printf ("fbase: %p\n", info
.dli_fbase
);
35 printf ("sname: %s\n", info
.dli_sname
);
36 printf ("saddr: %p\n", info
.dli_saddr
);
38 // CHECK: sname: GetTls