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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # IMPORTANT: 5 # IMPORTANT:
6 # Please don't directly include this file if you are building via gyp_chromium, 6 # Please don't directly include this file if you are building via gyp_chromium,
7 # since gyp_chromium is automatically forcing its inclusion. 7 # since gyp_chromium is automatically forcing its inclusion.
8 { 8 {
9 # Variables expected to be overriden on the GYP command line (-D) or by 9 # Variables expected to be overriden on the GYP command line (-D) or by
10 # ~/.gyp/include.gypi. 10 # ~/.gyp/include.gypi.
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 # Enable building with SyzyAsan. 356 # Enable building with SyzyAsan.
357 # See https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo 357 # See https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo
358 'syzyasan%': 0, 358 'syzyasan%': 0,
359 359
360 # Enable building with LSan (Clang's -fsanitize=leak option). 360 # Enable building with LSan (Clang's -fsanitize=leak option).
361 # -fsanitize=leak only works with clang, but lsan=1 implies clang=1 361 # -fsanitize=leak only works with clang, but lsan=1 implies clang=1
362 # See https://sites.google.com/a/chromium.org/dev/developers/testing/leaks anitizer 362 # See https://sites.google.com/a/chromium.org/dev/developers/testing/leaks anitizer
363 'lsan%': 0, 363 'lsan%': 0,
364 364
365 # Enable building with TSAN (Clang's -fsanitize=thread option). 365 # Enable building with TSan (Clang's -fsanitize=thread option).
366 # -fsanitize=thread only works with clang, but tsan=1 implies clang=1 366 # -fsanitize=thread only works with clang, but tsan=1 implies clang=1
367 # See http://clang.llvm.org/docs/ThreadSanitizer.html 367 # See http://clang.llvm.org/docs/ThreadSanitizer.html
368 'tsan%': 0, 368 'tsan%': 0,
369 'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.tx t', 369 'tsan_blacklist%': '<(PRODUCT_DIR)/../../tools/valgrind/tsan_v2/ignores.tx t',
370 370
371 # Enable building with MSAN (Clang's -fsanitize=memory option). 371 # Enable building with MSan (Clang's -fsanitize=memory option).
372 # MemorySanitizer only works with clang, but msan=1 implies clang=1 372 # MemorySanitizer only works with clang, but msan=1 implies clang=1
373 # See http://clang.llvm.org/docs/MemorySanitizer.html 373 # See http://clang.llvm.org/docs/MemorySanitizer.html
374 'msan%': 0, 374 'msan%': 0,
375 'msan_blacklist%': '<(PRODUCT_DIR)/../../tools/msan/blacklist.txt', 375 'msan_blacklist%': '<(PRODUCT_DIR)/../../tools/msan/blacklist.txt',
376 376
377 # Enable building with UBSan (Clang's -fsanitize=undefined option).
378 # -fsanitize=undefined only works with clang, but ubsan=1 implies clang=1
379 # See http://clang.llvm.org/docs/UsersManual.html
380 'ubsan%': 0,
381
377 # Use the dynamic libraries instrumented by one of the sanitizers 382 # Use the dynamic libraries instrumented by one of the sanitizers
378 # instead of the standard system libraries. 383 # instead of the standard system libraries.
379 'use_instrumented_libraries%': 0, 384 'use_instrumented_libraries%': 0,
380 385
381 # Use libc++ (third_party/libc++ and third_party/libc++abi) instead of 386 # Use libc++ (third_party/libc++ and third_party/libc++abi) instead of
382 # stdlibc++ as standard library. This is intended to use for instrumented 387 # stdlibc++ as standard library. This is intended to use for instrumented
383 # builds. 388 # builds.
384 'use_custom_libcxx%': 0, 389 'use_custom_libcxx%': 0,
385 390
386 # Use a modified version of Clang to intercept allocated types and sizes 391 # Use a modified version of Clang to intercept allocated types and sizes
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 'asan%': '<(asan)', 1040 'asan%': '<(asan)',
1036 'asan_coverage%': '<(asan_coverage)', 1041 'asan_coverage%': '<(asan_coverage)',
1037 'use_sanitizer_options%': '<(use_sanitizer_options)', 1042 'use_sanitizer_options%': '<(use_sanitizer_options)',
1038 'syzyasan%': '<(syzyasan)', 1043 'syzyasan%': '<(syzyasan)',
1039 'syzygy_optimize%': '<(syzygy_optimize)', 1044 'syzygy_optimize%': '<(syzygy_optimize)',
1040 'lsan%': '<(lsan)', 1045 'lsan%': '<(lsan)',
1041 'msan%': '<(msan)', 1046 'msan%': '<(msan)',
1042 'msan_blacklist%': '<(msan_blacklist)', 1047 'msan_blacklist%': '<(msan_blacklist)',
1043 'tsan%': '<(tsan)', 1048 'tsan%': '<(tsan)',
1044 'tsan_blacklist%': '<(tsan_blacklist)', 1049 'tsan_blacklist%': '<(tsan_blacklist)',
1050 'ubsan%': '<(ubsan)',
1045 'use_instrumented_libraries%': '<(use_instrumented_libraries)', 1051 'use_instrumented_libraries%': '<(use_instrumented_libraries)',
1046 'use_custom_libcxx%': '<(use_custom_libcxx)', 1052 'use_custom_libcxx%': '<(use_custom_libcxx)',
1047 'clang_type_profiler%': '<(clang_type_profiler)', 1053 'clang_type_profiler%': '<(clang_type_profiler)',
1048 'order_profiling%': '<(order_profiling)', 1054 'order_profiling%': '<(order_profiling)',
1049 'order_text_section%': '<(order_text_section)', 1055 'order_text_section%': '<(order_text_section)',
1050 'enable_extensions%': '<(enable_extensions)', 1056 'enable_extensions%': '<(enable_extensions)',
1051 'enable_plugin_installation%': '<(enable_plugin_installation)', 1057 'enable_plugin_installation%': '<(enable_plugin_installation)',
1052 'enable_plugins%': '<(enable_plugins)', 1058 'enable_plugins%': '<(enable_plugins)',
1053 'enable_session_service%': '<(enable_session_service)', 1059 'enable_session_service%': '<(enable_session_service)',
1054 'enable_themes%': '<(enable_themes)', 1060 'enable_themes%': '<(enable_themes)',
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 'syzygy_optimize%': 0, 1428 'syzygy_optimize%': 0,
1423 }], 1429 }],
1424 # Get binutils version so we can enable debug fission if we can. 1430 # Get binutils version so we can enable debug fission if we can.
1425 ['os_posix==1 and OS!="mac" and OS!="ios"', { 1431 ['os_posix==1 and OS!="mac" and OS!="ios"', {
1426 'conditions': [ 1432 'conditions': [
1427 # compiler_version doesn't work with clang 1433 # compiler_version doesn't work with clang
1428 # TODO(mithro): Land https://codereview.chromium.org/199793014/ so 1434 # TODO(mithro): Land https://codereview.chromium.org/199793014/ so
1429 # compiler_version works with clang. 1435 # compiler_version works with clang.
1430 # TODO(glider): set clang to 1 earlier for ASan and TSan builds so 1436 # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
1431 # that it takes effect here. 1437 # that it takes effect here.
1432 ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0', { 1438 ['clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan== 0', {
1433 'binutils_version%': '<!pymod_do_main(compiler_version target assemb ler)', 1439 'binutils_version%': '<!pymod_do_main(compiler_version target assemb ler)',
1434 }], 1440 }],
1435 # On Android we know the binutils version in the toolchain. 1441 # On Android we know the binutils version in the toolchain.
1436 ['OS=="android"', { 1442 ['OS=="android"', {
1437 'binutils_version%': 222, 1443 'binutils_version%': 222,
1438 }], 1444 }],
1439 ['host_arch=="x64"', { 1445 ['host_arch=="x64"', {
1440 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin', 1446 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
1441 }], 1447 }],
1442 ['host_arch=="ia32"', { 1448 ['host_arch=="ia32"', {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 ['clang_use_chrome_plugins==1 and OS!="win"', { 2017 ['clang_use_chrome_plugins==1 and OS!="win"', {
2012 'clang_chrome_plugins_flags': [ 2018 'clang_chrome_plugins_flags': [
2013 '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)' 2019 '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
2014 ], 2020 ],
2015 }], 2021 }],
2016 2022
2017 ['asan==1', { 2023 ['asan==1', {
2018 'clang%': 1, 2024 'clang%': 1,
2019 'use_allocator%': 'none', 2025 'use_allocator%': 'none',
2020 }], 2026 }],
2027 ['ubsan==1', {
2028 'clang%': 1,
2029 }],
2021 ['asan==1 and OS=="mac"', { 2030 ['asan==1 and OS=="mac"', {
2022 # TODO(glider): we do not strip ASan binaries until the dynamic ASan 2031 # TODO(glider): we do not strip ASan binaries until the dynamic ASan
2023 # runtime is fully adopted. See http://crbug.com/242503. 2032 # runtime is fully adopted. See http://crbug.com/242503.
2024 'mac_strip_release': 0, 2033 'mac_strip_release': 0,
2025 }], 2034 }],
2026 ['lsan==1', { 2035 ['lsan==1', {
2027 'clang%': 1, 2036 'clang%': 1,
2028 }], 2037 }],
2029 ['tsan==1', { 2038 ['tsan==1', {
2030 'clang%': 1, 2039 'clang%': 1,
(...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
3774 ], 3783 ],
3775 }], 3784 }],
3776 ['clang==1 and "<(GENERATOR)"=="ninja"', { 3785 ['clang==1 and "<(GENERATOR)"=="ninja"', {
3777 'cflags': [ 3786 'cflags': [
3778 # See http://crbug.com/110262 3787 # See http://crbug.com/110262
3779 '-fcolor-diagnostics', 3788 '-fcolor-diagnostics',
3780 ], 3789 ],
3781 }], 3790 }],
3782 # Common options for AddressSanitizer, LeakSanitizer, 3791 # Common options for AddressSanitizer, LeakSanitizer,
3783 # ThreadSanitizer and MemorySanitizer. 3792 # ThreadSanitizer and MemorySanitizer.
3784 ['asan==1 or lsan==1 or tsan==1 or msan==1', { 3793 ['asan==1 or lsan==1 or tsan==1 or msan==1 or ubsan==1', {
3785 'target_conditions': [ 3794 'target_conditions': [
3786 ['_toolset=="target"', { 3795 ['_toolset=="target"', {
3787 'cflags': [ 3796 'cflags': [
3788 '-fno-omit-frame-pointer', 3797 '-fno-omit-frame-pointer',
3789 '-gline-tables-only', 3798 '-gline-tables-only',
3790 ], 3799 ],
3791 'cflags!': [ 3800 'cflags!': [
3792 '-fomit-frame-pointer', 3801 '-fomit-frame-pointer',
3793 ], 3802 ],
3803 }],
3804 ],
3805 }],
3806 ['asan==1 or lsan==1 or tsan==1 or msan==1', {
3807 'target_conditions': [
3808 ['_toolset=="target"', {
3794 'ldflags!': [ 3809 'ldflags!': [
3795 # Functions interposed by the sanitizers can make ld think 3810 # Functions interposed by the sanitizers can make ld think
3796 # that some libraries aren't needed when they actually are, 3811 # that some libraries aren't needed when they actually are,
3797 # http://crbug.com/234010. As workaround, disable --as-needed. 3812 # http://crbug.com/234010. As workaround, disable --as-needed.
3798 '-Wl,--as-needed', 3813 '-Wl,--as-needed',
3799 ], 3814 ],
3800 'defines': [ 3815 'defines': [
3801 'MEMORY_TOOL_REPLACES_ALLOCATOR', 3816 'MEMORY_TOOL_REPLACES_ALLOCATOR',
3802 ], 3817 ],
3803 }], 3818 }],
(...skipping 20 matching lines...) Expand all
3824 }], 3839 }],
3825 ], 3840 ],
3826 'conditions': [ 3841 'conditions': [
3827 ['OS=="mac"', { 3842 ['OS=="mac"', {
3828 'cflags': [ 3843 'cflags': [
3829 '-mllvm -asan-globals=0', # http://crbug.com/352073 3844 '-mllvm -asan-globals=0', # http://crbug.com/352073
3830 ], 3845 ],
3831 }], 3846 }],
3832 ], 3847 ],
3833 }], 3848 }],
3849 ['ubsan==1', {
3850 'target_conditions': [
3851 ['_toolset=="target"', {
3852 'cflags': [
3853 '-fsanitize=undefined',
3854 # -fsanitize=vptr is incompatible with -fno-rtti.
3855 '-fno-sanitize=vptr',
3856 '-w', # http://crbug.com/162783
3857 ],
3858 'ldflags': [
3859 '-fsanitize=undefined',
3860 # -fsanitize=vptr is incompatible with -fno-rtti.
3861 '-fno-sanitize=vptr',
3862 ],
3863 }],
3864 ],
3865 }],
3834 ['asan_coverage!=0', { 3866 ['asan_coverage!=0', {
3835 'target_conditions': [ 3867 'target_conditions': [
3836 ['_toolset=="target"', { 3868 ['_toolset=="target"', {
3837 'cflags': [ 3869 'cflags': [
3838 '-mllvm -asan-coverage=<(asan_coverage)', 3870 '-mllvm -asan-coverage=<(asan_coverage)',
3839 ], 3871 ],
3840 }], 3872 }],
3841 ], 3873 ],
3842 }], 3874 }],
3843 ['lsan==1', { 3875 ['lsan==1', {
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
5380 # settings in target dicts. SYMROOT is a special case, because many other 5412 # settings in target dicts. SYMROOT is a special case, because many other
5381 # Xcode variables depend on it, including variables such as 5413 # Xcode variables depend on it, including variables such as
5382 # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something 5414 # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something
5383 # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the 5415 # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
5384 # files to appear (when present) in the UI as actual files and not red 5416 # files to appear (when present) in the UI as actual files and not red
5385 # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR, 5417 # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
5386 # and therefore SYMROOT, needs to be set at the project level. 5418 # and therefore SYMROOT, needs to be set at the project level.
5387 'SYMROOT': '<(DEPTH)/xcodebuild', 5419 'SYMROOT': '<(DEPTH)/xcodebuild',
5388 }, 5420 },
5389 } 5421 }
OLDNEW
« 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