4 // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %t-dir/libignore_lib3.so
5 // RUN: %clangxx_tsan -O1 %s %link_libcxx_tsan -o %t-dir/executable
6 // RUN: %env_tsan_opts=suppressions='%s.supp':verbosity=1 %run %t-dir/executable 2>&1 | FileCheck %s
8 // Tests that unloading of a library matched against called_from_lib suppression
11 // Some aarch64 kernels do not support non executable write pages
12 // REQUIRES: stable-runtime
23 int main(int argc
, char **argv
) {
24 std::string lib
= std::string(dirname(argv
[0])) + "/libignore_lib3.so";
27 // Try opening, closing and reopening the ignored lib.
28 for (unsigned int k
= 0; k
< 2; k
++) {
29 h
= dlopen(lib
.c_str(), RTLD_GLOBAL
| RTLD_NOW
);
31 exit(printf("failed to load the library (%d)\n", errno
));
32 f
= (void (*)())dlsym(h
, "libfunc");
34 exit(printf("failed to find the func (%d)\n", errno
));
38 fprintf(stderr
, "OK\n");
43 # include "ignore_lib_lib.h"
47 // CHECK: Matched called_from_lib suppression 'ignore_lib3.so'
48 // CHECK: library '{{.*}}ignore_lib3.so' that was matched against called_from_lib suppression 'ignore_lib3.so' is unloaded
49 // CHECK: Matched called_from_lib suppression 'ignore_lib3.so'
50 // CHECK: library '{{.*}}ignore_lib3.so' that was matched against called_from_lib suppression 'ignore_lib3.so' is unloaded