================ @@ -43,6 +44,21 @@ static __rtsan::Context &GetContextForThisThreadImpl() { return *current_thread_context; } +#else + +// On FreeBSD, pthread api cannot be used as calloc is called under the hood +// at library initialization time. +static __thread Context *ctx = nullptr; + +static __rtsan::Context &GetContextForThisThreadImpl() { + if (ctx == nullptr) { + ctx = static_cast<Context *>(MmapOrDie(sizeof(Context), "RtsanContext")); + new (ctx) Context(); ---------------- devnexen wrote:
Yes I tried that originally but it freezes I ll try again or trying to make pthread api works. https://github.com/llvm/llvm-project/pull/125389 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits