This reverts commit 05e31438ac9491cfc72c48664480796de874c860. There was quite a bit of churn with this patch, everytime related to the executable no longer being in the same directory as the shared objects. This reland ensures that all of the executables in the tests touched are in the same directory as the shared objects in the substitutions.
35 lines
846 B
C++
35 lines
846 B
C++
// RUN: mkdir -p %t.dir && cd %t.dir
|
|
// RUN: %clang_tsan -O1 %s -DBUILD_LIB=1 -fno-sanitize=thread -shared -fPIC -o %dynamiclib %ld_flags_rpath_so
|
|
// RUN: %clang_tsan -O1 %s -o %t.dir/exe %ld_flags_rpath_exe
|
|
// RUN: %run %t.dir/exe | FileCheck %s
|
|
|
|
// Test that initialization/finalization hooks are called, even when they are
|
|
// not defined in the main executable, but by another another library that
|
|
// doesn't directly link against the TSan runtime.
|
|
|
|
#include <stdio.h>
|
|
|
|
#if BUILD_LIB
|
|
|
|
extern "C" void __tsan_on_initialize() {
|
|
printf("__tsan_on_initialize()\n");
|
|
}
|
|
|
|
extern "C" int __tsan_on_finalize(int failed) {
|
|
printf("__tsan_on_finalize()\n");
|
|
return failed;
|
|
}
|
|
|
|
#else // BUILD_LIB
|
|
|
|
int main() {
|
|
printf("main()\n");
|
|
return 0;
|
|
}
|
|
|
|
#endif // BUILD_LIB
|
|
|
|
// CHECK: __tsan_on_initialize()
|
|
// CHECK: main()
|
|
// CHECK: __tsan_on_finalize()
|