OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 import("//build/config/chromecast_build.gni") | 7 import("//build/config/chromecast_build.gni") |
8 import("//build/config/compiler/compiler.gni") | 8 import("//build/config/compiler/compiler.gni") |
9 import("//build/config/nacl/config.gni") | 9 import("//build/config/nacl/config.gni") |
10 import("//build/toolchain/cc_wrapper.gni") | 10 import("//build/toolchain/cc_wrapper.gni") |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 # it has, then we don't need to disable 4702 (unreachable code warning). | 58 # it has, then we don't need to disable 4702 (unreachable code warning). |
59 # The patch is preapplied to the internal toolchain and hence all bots. | 59 # The patch is preapplied to the internal toolchain and hence all bots. |
60 msvs_xtree_patched = false | 60 msvs_xtree_patched = false |
61 } | 61 } |
62 | 62 |
63 # Omit unwind support in official builds to save space. | 63 # Omit unwind support in official builds to save space. |
64 # We can use breakpad for these builds. | 64 # We can use breakpad for these builds. |
65 exclude_unwind_tables = (is_chrome_branded && is_official_build) || | 65 exclude_unwind_tables = (is_chrome_branded && is_official_build) || |
66 (is_chromecast && !is_cast_desktop_build && !is_debug) | 66 (is_chromecast && !is_cast_desktop_build && !is_debug) |
67 | 67 |
| 68 # If true, gold linker will save symbol table inside object files. |
| 69 # This speeds up gdb startup by 60% |
| 70 gdb_index = false |
| 71 |
68 # If true, optimize for size. Does not affect windows builds. | 72 # If true, optimize for size. Does not affect windows builds. |
69 # Linux & Mac favor speed over size. | 73 # Linux & Mac favor speed over size. |
70 # TODO(brettw) it's weird that Mac and desktop Linux are different. We should | 74 # TODO(brettw) it's weird that Mac and desktop Linux are different. We should |
71 # explore favoring size over speed in this case as well. | 75 # explore favoring size over speed in this case as well. |
72 optimize_for_size = is_android || is_ios | 76 optimize_for_size = is_android || is_ios |
73 | 77 |
74 # Enable fatal linker warnings. Building Chromium with certain versions | 78 # Enable fatal linker warnings. Building Chromium with certain versions |
75 # of binutils can cause linker warning. | 79 # of binutils can cause linker warning. |
76 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 | 80 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 |
77 fatal_linker_warnings = true | 81 fatal_linker_warnings = true |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 302 } |
299 | 303 |
300 # Linux/Android common flags setup. | 304 # Linux/Android common flags setup. |
301 # --------------------------------- | 305 # --------------------------------- |
302 if (is_linux || is_android) { | 306 if (is_linux || is_android) { |
303 if (use_pic) { | 307 if (use_pic) { |
304 cflags += [ "-fPIC" ] | 308 cflags += [ "-fPIC" ] |
305 ldflags += [ "-fPIC" ] | 309 ldflags += [ "-fPIC" ] |
306 } | 310 } |
307 | 311 |
308 # Use pipes for communicating between sub-processes. Faster. | 312 cflags += [ "-pipe" ] # Use pipes for communicating between sub-processes.
Faster. |
309 cflags += [ "-pipe" ] | |
310 | 313 |
311 ldflags += [ | 314 ldflags += [ |
312 "-Wl,-z,noexecstack", | 315 "-Wl,-z,noexecstack", |
313 "-Wl,-z,now", | 316 "-Wl,-z,now", |
314 "-Wl,-z,relro", | 317 "-Wl,-z,relro", |
315 ] | 318 ] |
316 if (!using_sanitizer) { | 319 if (!using_sanitizer) { |
317 if (!use_cfi_diag) { | 320 if (!use_cfi_diag) { |
318 ldflags += [ "-Wl,-z,defs" ] | 321 ldflags += [ "-Wl,-z,defs" ] |
319 } | 322 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 # saved ~20% of link time. | 368 # saved ~20% of link time. |
366 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 | 369 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 |
367 # Only apply this to the target linker, since the host | 370 # Only apply this to the target linker, since the host |
368 # linker might not be gold, but isn't used much anyway. | 371 # linker might not be gold, but isn't used much anyway. |
369 "-Wl,--threads", | 372 "-Wl,--threads", |
370 "-Wl,--thread-count=4", | 373 "-Wl,--thread-count=4", |
371 ] | 374 ] |
372 } | 375 } |
373 } | 376 } |
374 | 377 |
| 378 if (gdb_index) { |
| 379 ldflags += [ "-Wl,--gdb-index" ] |
| 380 } |
| 381 |
375 # TODO(thestig): Make this flag work with GN. | 382 # TODO(thestig): Make this flag work with GN. |
376 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { | 383 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { |
377 # ldflags += [ | 384 # ldflags += [ |
378 # "-Wl,--detect-odr-violations", | 385 # "-Wl,--detect-odr-violations", |
379 # ] | 386 # ] |
380 #} | 387 #} |
381 } else if (linux_use_bundled_binutils) { | 388 } else if (linux_use_bundled_binutils) { |
382 # Gold is the default linker for the bundled binutils so we explicitly | 389 # Gold is the default linker for the bundled binutils so we explicitly |
383 # enable the bfd linker when use_gold is not set. | 390 # enable the bfd linker when use_gold is not set. |
384 ldflags += [ "-fuse-ld=bfd" ] | 391 ldflags += [ "-fuse-ld=bfd" ] |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 "-g2", | 1655 "-g2", |
1649 ] | 1656 ] |
1650 } else { | 1657 } else { |
1651 cflags = [ "-g2" ] | 1658 cflags = [ "-g2" ] |
1652 } | 1659 } |
1653 if (use_debug_fission) { | 1660 if (use_debug_fission) { |
1654 cflags += [ "-gsplit-dwarf" ] | 1661 cflags += [ "-gsplit-dwarf" ] |
1655 } | 1662 } |
1656 asmflags = cflags | 1663 asmflags = cflags |
1657 ldflags = [] | 1664 ldflags = [] |
1658 if (!is_mac && !is_ios && !is_nacl) { | |
1659 ldflags += [ "-Wl,--gdb-index" ] | |
1660 } | |
1661 } | 1665 } |
1662 } | 1666 } |
1663 | 1667 |
1664 # Minimal symbols. | 1668 # Minimal symbols. |
1665 config("minimal_symbols") { | 1669 config("minimal_symbols") { |
1666 if (is_win) { | 1670 if (is_win) { |
1667 # Linker symbols for backtraces only. | 1671 # Linker symbols for backtraces only. |
1668 cflags = [] | 1672 cflags = [] |
1669 ldflags = [ "/DEBUG" ] | 1673 ldflags = [ "/DEBUG" ] |
1670 } else { | 1674 } else { |
1671 if (is_android) { | 1675 if (is_android) { |
1672 # Breakpad can't handle DWARF 4 symbols properly yet, so use DWARF 3 | 1676 # Breakpad can't handle DWARF 4 symbols properly yet, so use DWARF 3 |
1673 # explicitly on android where we are hitting https://crbug.com/638485. | 1677 # explicitly on android where we are hitting https://crbug.com/638485. |
1674 # The arguments MUST be in this order because of a gcc arg parsing bug. | 1678 # The arguments MUST be in this order because of a gcc arg parsing bug. |
1675 cflags = [ | 1679 cflags = [ |
1676 "-gdwarf-3", | 1680 "-gdwarf-3", |
1677 "-g1", | 1681 "-g1", |
1678 ] | 1682 ] |
1679 } else { | 1683 } else { |
1680 cflags = [ "-g1" ] | 1684 cflags = [ "-g1" ] |
1681 } | 1685 } |
1682 | 1686 if (use_debug_fission) { |
1683 # Note: -gsplit-dwarf implicitly turns on -g2 with clang, so don't pass it. | 1687 cflags += [ "-gsplit-dwarf" ] |
| 1688 } |
1684 asmflags = cflags | 1689 asmflags = cflags |
1685 ldflags = [] | 1690 ldflags = [] |
1686 } | 1691 } |
1687 } | 1692 } |
1688 | 1693 |
1689 # No symbols. | 1694 # No symbols. |
1690 config("no_symbols") { | 1695 config("no_symbols") { |
1691 if (!is_win) { | 1696 if (!is_win) { |
1692 cflags = [ "-g0" ] | 1697 cflags = [ "-g0" ] |
1693 asmflags = cflags | 1698 asmflags = cflags |
(...skipping 15 matching lines...) Expand all Loading... |
1709 | 1714 |
1710 if (is_ios || is_mac) { | 1715 if (is_ios || is_mac) { |
1711 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1716 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1712 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1717 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1713 config("enable_arc") { | 1718 config("enable_arc") { |
1714 common_flags = [ "-fobjc-arc" ] | 1719 common_flags = [ "-fobjc-arc" ] |
1715 cflags_objc = common_flags | 1720 cflags_objc = common_flags |
1716 cflags_objcc = common_flags | 1721 cflags_objcc = common_flags |
1717 } | 1722 } |
1718 } | 1723 } |
OLD | NEW |