CCing gcc-help On Fri, Jun 13, 2025 at 4:32 PM Jakub Jelinek <jakub@xxxxxxxxxx> wrote: > On Fri, Jun 13, 2025 at 04:06:52PM +0530, HHN wrote: > > > > > > You shouldn't call __tsan_func_exit in user code, whether as () or as > > > (NULL), without including appropriate header (tsan_interface.h). > > > > Despite `__tsan_func_exit` being in `tsan_interface.h` in the gcc source, > > in GCC distributions I am unable to find it in the > > `sanitizer/tsan_interface.h` header > > Godbolt link <https://godbolt.org/z/PEzzMsn8z> showcasing this > > I am not very familiar with the gcc build and distribution process so > > forgive me if this is a naive misunderstanding > > There are two heaves, > libsanitizer/include/sanitizer/tsan_interface.h > is the user facing one, and > libsanitizer/tsan/tsan_interface.h > is the private one, implementation specific. > The function is declared in the latter, not the former. > > If you have a valid usecase, you should talk to upstream (llvm compiler-rt) > to make the API public, instead of trying to declare it on your own. > > > For example, consider the AnnotateHappens{After, Before} functions used > to > > silence tsan false positives > > These functions have been documented in the "ThreadSanitizer – data race > > detection in practice" paper Section 5 - Dynamic Annotations > > < > https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/35604.pdf > > > > but > > are not exposed to the user through any headers > > `extern <internal tsan function>` was the only way I could use such > > functions to silence false positives > > Again, talk to upstream to make it public/supported API. > > Jakub > > -- Hari Hara Naveen