Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2858)

Unified Diff: build/common.gypi

Issue 299403007: Add preliminary support for UBSan in Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/common.gypi
diff --git a/build/common.gypi b/build/common.gypi
index 0e9cdea0e66f2aabed661709c88fefc7db7fdf71..3c969be8a4086b48af5db489c506b66ca58a07aa 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -362,18 +362,23 @@
# See https://sites.google.com/a/chromium.org/dev/developers/testing/leaksanitizer
'lsan%': 0,
- # Enable building with TSAN (Clang's -fsanitize=thread option).
+ # Enable building with TSan (Clang's -fsanitize=thread option).
# -fsanitize=thread only works with clang, but tsan=1 implies clang=1
# See http://clang.llvm.org/docs/ThreadSanitizer.html
'tsan%': 0,
'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.txt',
- # Enable building with MSAN (Clang's -fsanitize=memory option).
+ # Enable building with MSan (Clang's -fsanitize=memory option).
# MemorySanitizer only works with clang, but msan=1 implies clang=1
# See http://clang.llvm.org/docs/MemorySanitizer.html
'msan%': 0,
'msan_blacklist%': '<(PRODUCT_DIR)/../../tools/msan/blacklist.txt',
+ # Enable building with UBSan (Clang's -fsanitize=undefined option).
+ # -fsanitize=undefined only works with clang, but ubsan=1 implies clang=1
+ # See http://clang.llvm.org/docs/UsersManual.html
+ 'ubsan%': 0,
+
# Use the dynamic libraries instrumented by one of the sanitizers
# instead of the standard system libraries.
'use_instrumented_libraries%': 0,
@@ -1042,6 +1047,7 @@
'msan_blacklist%': '<(msan_blacklist)',
'tsan%': '<(tsan)',
'tsan_blacklist%': '<(tsan_blacklist)',
+ 'ubsan%': '<(ubsan)',
'use_instrumented_libraries%': '<(use_instrumented_libraries)',
'use_custom_libcxx%': '<(use_custom_libcxx)',
'clang_type_profiler%': '<(clang_type_profiler)',
@@ -1429,7 +1435,7 @@
# compiler_version works with clang.
# TODO(glider): set clang to 1 earlier for ASan and TSan builds so
# that it takes effect here.
- ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0', {
+ ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan==0', {
'binutils_version%': '<!pymod_do_main(compiler_version target assembler)',
}],
# On Android we know the binutils version in the toolchain.
@@ -2018,6 +2024,9 @@
'clang%': 1,
'use_allocator%': 'none',
}],
+ ['ubsan==1', {
+ 'clang%': 1,
+ }],
['asan==1 and OS=="mac"', {
# TODO(glider): we do not strip ASan binaries until the dynamic ASan
# runtime is fully adopted. See http://crbug.com/242503.
@@ -3781,7 +3790,7 @@
}],
# Common options for AddressSanitizer, LeakSanitizer,
# ThreadSanitizer and MemorySanitizer.
- ['asan==1 or lsan==1 or tsan==1 or msan==1', {
+ ['asan==1 or lsan==1 or tsan==1 or msan==1 or ubsan==1', {
'target_conditions': [
['_toolset=="target"', {
'cflags': [
@@ -3791,6 +3800,12 @@
'cflags!': [
'-fomit-frame-pointer',
],
+ }],
+ ],
+ }],
+ ['asan==1 or lsan==1 or tsan==1 or msan==1', {
+ 'target_conditions': [
+ ['_toolset=="target"', {
'ldflags!': [
# Functions interposed by the sanitizers can make ld think
# that some libraries aren't needed when they actually are,
@@ -3831,6 +3846,23 @@
}],
],
}],
+ ['ubsan==1', {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '-fsanitize=undefined',
+ # -fsanitize=vptr is incompatible with -fno-rtti.
+ '-fno-sanitize=vptr',
+ '-w', # http://crbug.com/162783
+ ],
+ 'ldflags': [
+ '-fsanitize=undefined',
+ # -fsanitize=vptr is incompatible with -fno-rtti.
+ '-fno-sanitize=vptr',
+ ],
+ }],
+ ],
+ }],
['asan_coverage!=0', {
'target_conditions': [
['_toolset=="target"', {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698