Files
sourcekit-lsp/Sources/CSKTestSupport/CSKTestSupport.c
Ben Langmuir 6da67ecf50 [linux] Avoid running static destructors due to SR-12668
To prevent crashes during `exit` caused by SR-12668, avoid running
static destructors. During testing, we do this by interposing
`__cxa_exit` to prevent registration of destructors. This depends on the
previous commit that disabled RTLD_DEEPBIND. In the sourcekit-lsp
executable, since we control the exit points, we can make a less
invasive change to just use `_Exit` instead of `exit` to avoid cleanups.

This should hopefully fix the CI issues we have seen when testing with
--parallel.

rdar://61837752
2020-04-24 15:25:43 -07:00

20 lines
730 B
C

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifdef __linux__
// For testing, override __cxa_atexit to prevent registration of static
// destructors due to SR-12668.
int __cxa_atexit(void (*f) (void *), void *arg, void *dso_handle) {
return 0;
}
#endif