| 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 | |
| 72 # If true, optimize for size. Does not affect windows builds. | 68 # If true, optimize for size. Does not affect windows builds. |
| 73 # Linux & Mac favor speed over size. | 69 # Linux & Mac favor speed over size. |
| 74 # TODO(brettw) it's weird that Mac and desktop Linux are different. We should | 70 # TODO(brettw) it's weird that Mac and desktop Linux are different. We should |
| 75 # explore favoring size over speed in this case as well. | 71 # explore favoring size over speed in this case as well. |
| 76 optimize_for_size = is_android || is_ios | 72 optimize_for_size = is_android || is_ios |
| 77 | 73 |
| 78 # Enable fatal linker warnings. Building Chromium with certain versions | 74 # Enable fatal linker warnings. Building Chromium with certain versions |
| 79 # of binutils can cause linker warning. | 75 # of binutils can cause linker warning. |
| 80 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 | 76 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 |
| 81 fatal_linker_warnings = true | 77 fatal_linker_warnings = true |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 298 } |
| 303 | 299 |
| 304 # Linux/Android common flags setup. | 300 # Linux/Android common flags setup. |
| 305 # --------------------------------- | 301 # --------------------------------- |
| 306 if (is_linux || is_android) { | 302 if (is_linux || is_android) { |
| 307 if (use_pic) { | 303 if (use_pic) { |
| 308 cflags += [ "-fPIC" ] | 304 cflags += [ "-fPIC" ] |
| 309 ldflags += [ "-fPIC" ] | 305 ldflags += [ "-fPIC" ] |
| 310 } | 306 } |
| 311 | 307 |
| 312 cflags += [ "-pipe" ] # Use pipes for communicating between sub-processes.
Faster. | 308 # Use pipes for communicating between sub-processes. Faster. |
| 309 cflags += [ "-pipe" ] |
| 313 | 310 |
| 314 ldflags += [ | 311 ldflags += [ |
| 315 "-Wl,-z,noexecstack", | 312 "-Wl,-z,noexecstack", |
| 316 "-Wl,-z,now", | 313 "-Wl,-z,now", |
| 317 "-Wl,-z,relro", | 314 "-Wl,-z,relro", |
| 318 ] | 315 ] |
| 319 if (!using_sanitizer) { | 316 if (!using_sanitizer) { |
| 320 if (!use_cfi_diag) { | 317 if (!use_cfi_diag) { |
| 321 ldflags += [ "-Wl,-z,defs" ] | 318 ldflags += [ "-Wl,-z,defs" ] |
| 322 } | 319 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 # saved ~20% of link time. | 365 # saved ~20% of link time. |
| 369 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 | 366 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 |
| 370 # Only apply this to the target linker, since the host | 367 # Only apply this to the target linker, since the host |
| 371 # linker might not be gold, but isn't used much anyway. | 368 # linker might not be gold, but isn't used much anyway. |
| 372 "-Wl,--threads", | 369 "-Wl,--threads", |
| 373 "-Wl,--thread-count=4", | 370 "-Wl,--thread-count=4", |
| 374 ] | 371 ] |
| 375 } | 372 } |
| 376 } | 373 } |
| 377 | 374 |
| 378 if (gdb_index) { | |
| 379 ldflags += [ "-Wl,--gdb-index" ] | |
| 380 } | |
| 381 | |
| 382 # TODO(thestig): Make this flag work with GN. | 375 # TODO(thestig): Make this flag work with GN. |
| 383 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { | 376 #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan |
| is_msan)) { |
| 384 # ldflags += [ | 377 # ldflags += [ |
| 385 # "-Wl,--detect-odr-violations", | 378 # "-Wl,--detect-odr-violations", |
| 386 # ] | 379 # ] |
| 387 #} | 380 #} |
| 388 } else if (linux_use_bundled_binutils) { | 381 } else if (linux_use_bundled_binutils) { |
| 389 # Gold is the default linker for the bundled binutils so we explicitly | 382 # Gold is the default linker for the bundled binutils so we explicitly |
| 390 # enable the bfd linker when use_gold is not set. | 383 # enable the bfd linker when use_gold is not set. |
| 391 ldflags += [ "-fuse-ld=bfd" ] | 384 ldflags += [ "-fuse-ld=bfd" ] |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 "-g2", | 1648 "-g2", |
| 1656 ] | 1649 ] |
| 1657 } else { | 1650 } else { |
| 1658 cflags = [ "-g2" ] | 1651 cflags = [ "-g2" ] |
| 1659 } | 1652 } |
| 1660 if (use_debug_fission) { | 1653 if (use_debug_fission) { |
| 1661 cflags += [ "-gsplit-dwarf" ] | 1654 cflags += [ "-gsplit-dwarf" ] |
| 1662 } | 1655 } |
| 1663 asmflags = cflags | 1656 asmflags = cflags |
| 1664 ldflags = [] | 1657 ldflags = [] |
| 1658 |
| 1659 # TODO(thakis): Figure out if there's a way to make this go for 32-bit, |
| 1660 # currently we get "warning: |
| 1661 # obj/native_client/src/trusted/service_runtime/sel_asm/nacl_switch_32.o: |
| 1662 # DWARF info may be corrupt; offsets in a range list entry are in different |
| 1663 # sections" there. Maybe just a bug in nacl_switch_32.S. |
| 1664 if (!is_mac && !is_ios && !is_nacl && target_cpu != "x86") { |
| 1665 ldflags += [ "-Wl,--gdb-index" ] |
| 1666 } |
| 1665 } | 1667 } |
| 1666 } | 1668 } |
| 1667 | 1669 |
| 1668 # Minimal symbols. | 1670 # Minimal symbols. |
| 1669 config("minimal_symbols") { | 1671 config("minimal_symbols") { |
| 1670 if (is_win) { | 1672 if (is_win) { |
| 1671 # Linker symbols for backtraces only. | 1673 # Linker symbols for backtraces only. |
| 1672 cflags = [] | 1674 cflags = [] |
| 1673 ldflags = [ "/DEBUG" ] | 1675 ldflags = [ "/DEBUG" ] |
| 1674 } else { | 1676 } else { |
| 1675 if (is_android) { | 1677 if (is_android) { |
| 1676 # Breakpad can't handle DWARF 4 symbols properly yet, so use DWARF 3 | 1678 # Breakpad can't handle DWARF 4 symbols properly yet, so use DWARF 3 |
| 1677 # explicitly on android where we are hitting https://crbug.com/638485. | 1679 # explicitly on android where we are hitting https://crbug.com/638485. |
| 1678 # The arguments MUST be in this order because of a gcc arg parsing bug. | 1680 # The arguments MUST be in this order because of a gcc arg parsing bug. |
| 1679 cflags = [ | 1681 cflags = [ |
| 1680 "-gdwarf-3", | 1682 "-gdwarf-3", |
| 1681 "-g1", | 1683 "-g1", |
| 1682 ] | 1684 ] |
| 1683 } else { | 1685 } else { |
| 1684 cflags = [ "-g1" ] | 1686 cflags = [ "-g1" ] |
| 1685 } | 1687 } |
| 1686 if (use_debug_fission) { | 1688 |
| 1687 cflags += [ "-gsplit-dwarf" ] | 1689 # Note: -gsplit-dwarf implicitly turns on -g2 with clang, so don't pass it. |
| 1688 } | |
| 1689 asmflags = cflags | 1690 asmflags = cflags |
| 1690 ldflags = [] | 1691 ldflags = [] |
| 1691 } | 1692 } |
| 1692 } | 1693 } |
| 1693 | 1694 |
| 1694 # No symbols. | 1695 # No symbols. |
| 1695 config("no_symbols") { | 1696 config("no_symbols") { |
| 1696 if (!is_win) { | 1697 if (!is_win) { |
| 1697 cflags = [ "-g0" ] | 1698 cflags = [ "-g0" ] |
| 1698 asmflags = cflags | 1699 asmflags = cflags |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1714 | 1715 |
| 1715 if (is_ios || is_mac) { | 1716 if (is_ios || is_mac) { |
| 1716 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1717 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1717 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1718 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1718 config("enable_arc") { | 1719 config("enable_arc") { |
| 1719 common_flags = [ "-fobjc-arc" ] | 1720 common_flags = [ "-fobjc-arc" ] |
| 1720 cflags_objc = common_flags | 1721 cflags_objc = common_flags |
| 1721 cflags_objcc = common_flags | 1722 cflags_objcc = common_flags |
| 1722 } | 1723 } |
| 1723 } | 1724 } |
| OLD | NEW |