1*7c3d14c8STreehugger Robot // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_0.so 2*7c3d14c8STreehugger Robot // RUN: %clangxx_tsan -O1 %s -DLIB -fPIC -fno-sanitize=thread -shared -o %T/libignore_lib2_1.so 3*7c3d14c8STreehugger Robot // RUN: %clangxx_tsan -O1 %s -o %t 4*7c3d14c8STreehugger Robot // RUN: %env_tsan_opts=suppressions='%s.supp' %deflake %run %t | FileCheck %s 5*7c3d14c8STreehugger Robot 6*7c3d14c8STreehugger Robot // Tests that called_from_lib suppression matched against 2 libraries 7*7c3d14c8STreehugger Robot // causes program crash (this is not supported). 8*7c3d14c8STreehugger Robot 9*7c3d14c8STreehugger Robot #ifndef LIB 10*7c3d14c8STreehugger Robot 11*7c3d14c8STreehugger Robot #include <dlfcn.h> 12*7c3d14c8STreehugger Robot #include <stdio.h> 13*7c3d14c8STreehugger Robot #include <libgen.h> 14*7c3d14c8STreehugger Robot #include <string> 15*7c3d14c8STreehugger Robot main(int argc,char ** argv)16*7c3d14c8STreehugger Robotint main(int argc, char **argv) { 17*7c3d14c8STreehugger Robot std::string lib0 = std::string(dirname(argv[0])) + "/libignore_lib2_0.so"; 18*7c3d14c8STreehugger Robot std::string lib1 = std::string(dirname(argv[0])) + "/libignore_lib2_1.so"; 19*7c3d14c8STreehugger Robot dlopen(lib0.c_str(), RTLD_GLOBAL | RTLD_NOW); 20*7c3d14c8STreehugger Robot dlopen(lib1.c_str(), RTLD_GLOBAL | RTLD_NOW); 21*7c3d14c8STreehugger Robot fprintf(stderr, "OK\n"); 22*7c3d14c8STreehugger Robot } 23*7c3d14c8STreehugger Robot 24*7c3d14c8STreehugger Robot #else // #ifdef LIB 25*7c3d14c8STreehugger Robot libfunc()26*7c3d14c8STreehugger Robotextern "C" void libfunc() { 27*7c3d14c8STreehugger Robot } 28*7c3d14c8STreehugger Robot 29*7c3d14c8STreehugger Robot #endif // #ifdef LIB 30*7c3d14c8STreehugger Robot 31*7c3d14c8STreehugger Robot // CHECK: ThreadSanitizer: called_from_lib suppression 'ignore_lib2' is matched against 2 libraries 32*7c3d14c8STreehugger Robot // CHECK-NOT: OK 33*7c3d14c8STreehugger Robot 34