[PATCH] D39619: Correct atexit(3) support in TSan/NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 15:33:13 PDT 2017


krytarowski added a comment.

> Maybe wait for @dvyukov input?

It would be nice to get feedback from !NetBSD tests whether it works correctly.

This code in the past and after my change levites over OS-specific implementations and assumptions.



================
Comment at: lib/tsan/rtl/tsan_interceptors.cc:457
+    // NetBSD does not preserve the 2nd argument if dso is equal to 0
+    // Store ctx in a local stack-like structure
+    res = REAL(__cxa_atexit)((void (*)(void *a))at_exit_wrapper, 0, 0);
----------------
vitalybuka wrote:
> maybe
> 
> ```
> int res = REAL(__cxa_atexit)((void (*)(void *a))at_exit_wrapper, dso ? ctx : 0, dso);
> if (!dso) {
>   ...
> }
> ```
There are now two `at_exit_wrapper` functions so I would need to inline the `?`: operator into the first argument as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D39619





More information about the llvm-commits mailing list