diff options
author | Leonard Chan <leonardchan@google.com> | 2022-12-08 19:29:28 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2022-12-08 19:30:13 +0000 |
commit | f9b80ed7fb83fa585065cccadc8f033a9d566e74 (patch) | |
tree | a9f38eb188fbabdaa37bdc3f1269a7c964880189 /compiler-rt/cmake | |
parent | 32cc7d3497507c6e6a150d7cbd58308f9a1558b4 (diff) | |
download | llvm-f9b80ed7fb83fa585065cccadc8f033a9d566e74.tar.gz |
[compiler-rt] Add opt-in -ftrivial-auto-var-init flag for writing over uninitialized stack variiables
This might allow lsan to find more leaks that would have gone
undetected. When lsan searches for leaked pointers on the stack, if a
leaked pointer that was pushed to the stack in a prior function call
would not be scrubbed on a future function call, then the scan will see
the pointer on the stack and not mark it as leaked. Such holes can exist
in the lsan runtime where there may be uninitialized data. Adding
auto-var-init can scrub some of that data and might be able to catch
more leaks that would've gone undetected this way.
See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=111351 for more
details.
Differential Revision: https://reviews.llvm.org/D135716
Diffstat (limited to 'compiler-rt/cmake')
-rw-r--r-- | compiler-rt/cmake/config-ix.cmake | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 3f2d38c010bb..39cd9e80583b 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -93,6 +93,7 @@ check_cxx_compiler_flag("-Werror -msse4.2" COMPILER_RT_HAS_MSSE4_2_FLAG) check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG) check_cxx_compiler_flag("-Werror -mcrc" COMPILER_RT_HAS_MCRC_FLAG) check_cxx_compiler_flag(-fno-partial-inlining COMPILER_RT_HAS_FNO_PARTIAL_INLINING_FLAG) +check_cxx_compiler_flag(-Werror -ftrivial-auto-var-init=pattern COMPILER_RT_HAS_TRIVIAL_AUTO_INIT) if(NOT WIN32 AND NOT CYGWIN) # MinGW warns if -fvisibility-inlines-hidden is used. |