| 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/linux/sysroot.gni") |
| 6 |
| 5 # Base compiler configuration. | 7 # Base compiler configuration. |
| 6 config("compiler") { | 8 config("compiler") { |
| 7 include_dirs = [ "//", root_gen_dir ] | 9 include_dirs = [ "//", root_gen_dir ] |
| 8 if (is_win) { | 10 if (is_win) { |
| 9 cflags = [ | 11 cflags = [ |
| 10 "/Gy", # Enable function-level linking. | 12 "/Gy", # Enable function-level linking. |
| 11 "/GS", # Enable buffer security checking. | 13 "/GS", # Enable buffer security checking. |
| 12 "/EHsc", # Assume C functions can't throw exceptions and don't catch | 14 "/EHsc", # Assume C functions can't throw exceptions and don't catch |
| 13 # structured exceptions (only C++ ones). | 15 # structured exceptions (only C++ ones). |
| 14 ] | 16 ] |
| (...skipping 23 matching lines...) Expand all Loading... |
| 38 } else if (is_linux) { | 40 } else if (is_linux) { |
| 39 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] | 41 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] |
| 40 } | 42 } |
| 41 | 43 |
| 42 if (is_mac) { | 44 if (is_mac) { |
| 43 # Mac-specific compiler flags setup. | 45 # Mac-specific compiler flags setup. |
| 44 # ---------------------------------- | 46 # ---------------------------------- |
| 45 | 47 |
| 46 # These flags are shared between the C compiler and linker. | 48 # These flags are shared between the C compiler and linker. |
| 47 common_mac_flags = [ | 49 common_mac_flags = [ |
| 48 # Set which SDK to use. | 50 "-isysroot", sysroot, |
| 49 # TODO(brettw) this needs to be configurable somehow. | |
| 50 "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOS
X.platform/Developer/SDKs/MacOSX10.7.sdk", | |
| 51 | |
| 52 "-mmacosx-version-min=10.6", | 51 "-mmacosx-version-min=10.6", |
| 53 ] | 52 ] |
| 54 | 53 |
| 55 # CPU architecture. | 54 # CPU architecture. |
| 56 if (cpu_arch == "x64") { | 55 if (cpu_arch == "x64") { |
| 57 common_mac_flags += "-arch x86_64" | 56 common_mac_flags += "-arch x86_64" |
| 58 } else if (cpu_arch == "x32") { | 57 } else if (cpu_arch == "x32") { |
| 59 common_mac_flags += "-arch i386" | 58 common_mac_flags += "-arch i386" |
| 60 } | 59 } |
| 61 | 60 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 # Experimentation found that using four linking threads | 115 # Experimentation found that using four linking threads |
| 117 # saved ~20% of link time. | 116 # saved ~20% of link time. |
| 118 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 | 117 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_t
hread/thread/281527606915bb36 |
| 119 # Only apply this to the target linker, since the host | 118 # Only apply this to the target linker, since the host |
| 120 # linker might not be gold, but isn't used much anyway. | 119 # linker might not be gold, but isn't used much anyway. |
| 121 "-Wl,--threads", | 120 "-Wl,--threads", |
| 122 "-Wl,--thread-count=4", | 121 "-Wl,--thread-count=4", |
| 123 ] | 122 ] |
| 124 } | 123 } |
| 125 | 124 |
| 125 if (sysroot != "") { |
| 126 cflags += "--sysroot=" + sysroot |
| 127 ldflags += "--sysroot=" + sysroot |
| 128 } |
| 129 |
| 126 ldflags += [ | 130 ldflags += [ |
| 127 "-fPIC", | 131 "-fPIC", |
| 128 "-pthread", | 132 "-pthread", |
| 129 "-Wl,-z,noexecstack", | 133 "-Wl,-z,noexecstack", |
| 130 "-Wl,-z,now", | 134 "-Wl,-z,now", |
| 131 "-Wl,-z,relro", | 135 "-Wl,-z,relro", |
| 132 ] | 136 ] |
| 133 } | 137 } |
| 134 | 138 |
| 135 # Clang-specific compiler flags setup. | 139 # Clang-specific compiler flags setup. |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } else { | 409 } else { |
| 406 cflags = [ "-g1" ] | 410 cflags = [ "-g1" ] |
| 407 } | 411 } |
| 408 } | 412 } |
| 409 | 413 |
| 410 config("no_symbols") { | 414 config("no_symbols") { |
| 411 if (!is_win) { | 415 if (!is_win) { |
| 412 cflags = [ "-g0" ] | 416 cflags = [ "-g0" ] |
| 413 } | 417 } |
| 414 } | 418 } |
| OLD | NEW |