diff options
author | Alexey Samsonov <vonosmas@gmail.com> | 2015-01-02 21:28:37 +0000 |
---|---|---|
committer | Alexey Samsonov <vonosmas@gmail.com> | 2015-01-02 21:28:37 +0000 |
commit | 5445e3a45fb91761c7be96a35b9cdc7194881ccd (patch) | |
tree | 547504987ce7b2ff55d399d57d22fe78c3b52327 /lib/msan/msan.cc | |
parent | ee2d9890ccbda9ef229eeacc8ede3dd365284f4c (diff) |
Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""
Fix test failures by introducing CommonFlags::CopyFrom() to make sure
compiler doesn't insert memcpy() calls into runtime code.
Original commit message:
Protect CommonFlags singleton by adding const qualifier to
common_flags() accessor. The only ways to modify the flags are
SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and
OverrideCommonFlags() functions, which are only supposed to be
called during initialization.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan.cc')
-rw-r--r-- | lib/msan/msan.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc index 546ffa719..cb0ffd60e 100644 --- a/lib/msan/msan.cc +++ b/lib/msan/msan.cc @@ -144,14 +144,18 @@ static void ParseFlagsFromString(Flags *f, const char *str) { } static void InitializeFlags(Flags *f, const char *options) { - CommonFlags *cf = common_flags(); SetCommonFlagsDefaults(); - cf->external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH"); - cf->malloc_context_size = 20; - cf->handle_ioctl = true; - // FIXME: test and enable. - cf->check_printf = false; - cf->intercept_tls_get_addr = true; + { + CommonFlags cf; + cf.CopyFrom(*common_flags()); + cf.external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH"); + cf.malloc_context_size = 20; + cf.handle_ioctl = true; + // FIXME: test and enable. + cf.check_printf = false; + cf.intercept_tls_get_addr = true; + OverrideCommonFlags(cf); + } internal_memset(f, 0, sizeof(*f)); f->poison_heap_with_zeroes = false; |