aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFModuleDefinition.cpp
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-07-18 20:18:32 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-07-18 20:18:32 +0000
commite43f27666d110432dd027d1f9c5dd13b4e403610 (patch)
treee499b83e686370b406e23dc348b70739ee6ff3c6 /llvm/lib/Object/COFFModuleDefinition.cpp
parent169d96a2032804ccabed125b442bfa5bef0f6ca7 (diff)
downloadllvm-e43f27666d110432dd027d1f9c5dd13b4e403610.zip
llvm-e43f27666d110432dd027d1f9c5dd13b4e403610.tar.gz
llvm-e43f27666d110432dd027d1f9c5dd13b4e403610.tar.bz2
Don't call exit() from atexit handlers on Darwin
Summary: Calling exit() from an atexit handler is undefined behavior. On Linux, it's unavoidable, since we cannot intercept exit (_exit isn't called if a user program uses return instead of exit()), and I haven't seen it cause issues regardless. However, on Darwin, I have a fairly complex internal test that hangs roughly once in every 300 runs after leak reporting finishes, which is resolved with this patch, and is presumably due to the undefined behavior (since the Die() is the only thing that happens after the end of leak reporting). In addition, this is the way TSan works as well, where an atexit handler+Die() is used on Linux, and an _exit() interceptor is used on Darwin. I'm not sure if it's intentionally structured that way in TSan, since TSan sets up the atexit handler and the _exit() interceptor on both platforms, but I have observed that on Darwin, only the _exit() interceptor is used, and on Linux the atexit handler is used. There is some additional related discussion here: https://reviews.llvm.org/D35085 Reviewers: alekseyshl, kubamracek Subscribers: eugenis, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D35513 llvm-svn: 308353
Diffstat (limited to 'llvm/lib/Object/COFFModuleDefinition.cpp')
0 files changed, 0 insertions, 0 deletions