1 // RUN: %clang_tsan -O1 %s -DBUILD_LIB=1 -fno-sanitize=thread -shared -fPIC -o %dynamiclib %ld_flags_rpath_so
2 // RUN: %clang_tsan -O1 %s -o %t %ld_flags_rpath_exe
3 // RUN: %run %t | FileCheck %s
5 // Test that initialization/finalization hooks are called, even when they are
6 // not defined in the main executable, but by another another library that
7 // doesn't directly link against the TSan runtime.
13 extern "C" void __tsan_on_initialize() {
14 printf("__tsan_on_initialize()\n");
17 extern "C" int __tsan_on_finalize(int failed
) {
18 printf("__tsan_on_finalize()\n");
31 // CHECK: __tsan_on_initialize()
33 // CHECK: __tsan_on_finalize()