This patch removes UBSan stubs from ASan and TSan code. We don't embed
UBSan to ASan and UBSan because that would lead to undefined references
to C++ stuff when linking with -static-libasan. AFAIK, sanitizer
developers use different libraries for C and CXX runtimes, but I think
this is out of scope of this merge.
2015-10-13 Maxim Ostapenko <m.ostape...@partner.samsung.com>
* tsan/tsan_defs.h: Define TSAN_CONTAINS_UBSAN to 0.
* asan/asan_flags.cc (InitializeFlags): Do not initialize UBSan flags.
* asan/asan_rtl.cc (AsanInitInternal): Do not init UBSan.
Index: libsanitizer/asan/asan_flags.cc
===================================================================
--- libsanitizer/asan/asan_flags.cc (revision 250059)
+++ libsanitizer/asan/asan_flags.cc (working copy)
@@ -86,15 +86,6 @@
RegisterCommonFlags(&lsan_parser);
#endif
-#if CAN_SANITIZE_UB
- __ubsan::Flags *uf = __ubsan::flags();
- uf->SetDefaults();
-
- FlagParser ubsan_parser;
- __ubsan::RegisterUbsanFlags(&ubsan_parser, uf);
- RegisterCommonFlags(&ubsan_parser);
-#endif
-
// Override from ASan compile definition.
const char *asan_compile_def = MaybeUseAsanDefaultOptionsCompileDefinition();
asan_parser.ParseString(asan_compile_def);
@@ -102,20 +93,11 @@
// Override from user-specified string.
const char *asan_default_options = MaybeCallAsanDefaultOptions();
asan_parser.ParseString(asan_default_options);
-#if CAN_SANITIZE_UB
- const char *ubsan_default_options = __ubsan::MaybeCallUbsanDefaultOptions();
- ubsan_parser.ParseString(ubsan_default_options);
-#endif
-
// Override from command line.
asan_parser.ParseString(GetEnv("ASAN_OPTIONS"));
#if CAN_SANITIZE_LEAKS
lsan_parser.ParseString(GetEnv("LSAN_OPTIONS"));
#endif
-#if CAN_SANITIZE_UB
- ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS"));
-#endif
-
// Let activation flags override current settings. On Android they come
// from a system property. On other platforms this is no-op.
if (!flags()->start_deactivated) {
Index: libsanitizer/asan/asan_rtl.cc
===================================================================
--- libsanitizer/asan/asan_rtl.cc (revision 250059)
+++ libsanitizer/asan/asan_rtl.cc (working copy)
@@ -513,10 +513,6 @@
}
#endif // CAN_SANITIZE_LEAKS
-#if CAN_SANITIZE_UB
- __ubsan::InitAsPlugin();
-#endif
-
InitializeSuppressions();
VReport(1, "AddressSanitizer Init done\n");
Index: libsanitizer/tsan/rtl/tsan_defs.h
===================================================================
--- libsanitizer/tsan/tsan_defs.h (revision 250059)
+++ libsanitizer/tsan/tsan_defs.h (working copy)
@@ -29,7 +29,7 @@
#endif
#ifndef TSAN_CONTAINS_UBSAN
-# define TSAN_CONTAINS_UBSAN (CAN_SANITIZE_UB && !defined(SANITIZER_GO))
+# define TSAN_CONTAINS_UBSAN 0
#endif
namespace __tsan {