Make TSan runtime initialization and finalization hooks work
even if these hooks are not built in the main executable. When these
hooks are defined in another library that is not directly linked against
the TSan runtime (e.g., Swift runtime) we cannot rely on the "strong-def
overriding weak-def" mechanics and have to look them up via dlsym().
Let's also define hooks that are easier to use from C-only code:
extern "C" void __tsan_on_initialize(); extern "C" int __tsan_on_finalize(int failed);
For now, these will call through to the old hooks. Eventually, we want
to adopt the new hooks downstream and remove the old ones.
This is part of the effort to support Swift Tasks (async/await and
actors) in TSan.
rdar://74256720
@yln: Suggestion: Should we document the failed parameter and the return value? E.g.