llvm-project/compiler-rt/test
Sterling Augustine 38c356176b Fix include guard and properly order __deregister_frame_info.
Summary:
This patch fixes two problems with the crtbegin.c as written:

1. In do_init, register_frame_info is not guarded by a #define, but in
do_fini, deregister_frame_info is guarded by #ifndef
CRT_HAS_INITFINI_ARRAY. Thus when CRT_HAS_INITFINI_ARRAY is not
defined, frames are registered but then never deregistered.

The frame registry mechanism builds a linked-list from the .so's
static variable do_init.object, and when the .so is unloaded, this
memory becomes invalid and should be deregistered.

Further, libgcc's crtbegin treats the frame registry as independent
from the initfini array mechanism.

This patch fixes this by adding a new #define,
"EH_USE_FRAME_INFO_REGISTRY", which is set by the cmake option
COMPILER_RT_CRT_USE_EH_FRAME_REGISTRY Currently, do_init calls
register_frame_info, and then calls the binary's constructors. This
allows constructors to safely use libunwind. However, do_fini calls
deregister_frame_info and then calls the binary's destructors. This
prevents destructors from safely using libunwind.

This patch also switches that ordering, so that destructors can safely
use libunwind. As it happens, this is a fairly common scenario for
thread sanitizer.
2019-11-12 14:54:41 -08:00
..
BlocksRuntime Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan Reland "[compiler-rt] Fix tests after 03b84e4f6d0" 2019-11-08 14:28:32 -08:00
builtins [PowerPC][compiler-rt][builtins]Fix __fixunstfti builtin on PowerPC 2019-11-08 11:57:09 -06:00
cfi Add missing lld checks in sanitizer tests. 2019-10-28 10:32:46 -07:00
crt Fix include guard and properly order __deregister_frame_info. 2019-11-12 14:54:41 -08:00
dfsan compiler-rt: Rename .cc file in test/dfsan to cpp 2019-08-05 13:19:28 +00:00
fuzzer Add missing lld checks in sanitizer tests. 2019-10-28 10:32:46 -07:00
gwp_asan compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
hwasan [compiler-rt] libhwasan interceptor ABI intercept longjmp/setjmp 2019-10-30 14:04:40 +00:00
interception [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00
lsan [lsan] Fix deadlock in dl_iterate_phdr. 2019-09-19 19:52:57 +00:00
msan Reland "[compiler-rt] Fix tests after 03b84e4f6d0" 2019-11-08 14:28:32 -08:00
profile [profile] Add a mode to continuously sync counter updates to a file 2019-10-31 16:04:09 -07:00
safestack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
sanitizer_common [sanitizer_common] Create max_allocation_size_mb flag. 2019-10-30 11:26:05 -07:00
scudo compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
shadowcallstack compiler-rt: Remove .cc from all lit config files 2019-08-05 19:25:35 +00:00
tsan [CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms. Attempt #3. 2019-10-01 23:08:18 +00:00
ubsan Fix lld detection in standalone compiler-rt. 2019-10-24 14:46:10 -07:00
ubsan_minimal [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour 2019-10-10 09:25:02 +00:00
xray [XRay] Fixing one test case for FreeBSD 2019-08-28 14:18:05 +00:00
.clang-format [compiler-rt] Use "ColumnLimit: 0" instead of "clang-format off" in tests 2018-12-01 01:24:29 +00:00
CMakeLists.txt [compiler-rt] Run cpplint only for check-sanitizer 2019-09-12 01:35:11 +00:00
lit.common.cfg.py compiler-rt: Rename cc files below test/asan to cpp 2019-08-05 16:48:12 +00:00
lit.common.configured.in [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.* 2019-06-27 20:56:04 +00:00