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 if (cpu_arch == "arm") { | 6 if (cpu_arch == "arm") { |
7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
8 } | 8 } |
9 if (is_posix) { | 9 if (is_posix) { |
10 import("//build/config/gcc/gcc_version.gni") | 10 import("//build/config/gcc/gcc_version.gni") |
11 } | 11 } |
12 | 12 |
13 declare_args() { | 13 declare_args() { |
14 # Normally, Android builds are lightly optimized, even for debug builds, to | 14 # Normally, Android builds are lightly optimized, even for debug builds, to |
15 # keep binary size down. Setting this flag to true disables such optimization | 15 # keep binary size down. Setting this flag to true disables such optimization |
16 android_full_debug = false | 16 android_full_debug = false |
17 } | 17 } |
18 | 18 |
| 19 use_gold = is_linux && cpu_arch == "x64" |
| 20 |
| 21 # linux_use_debug_fission: whether to use split DWARF debug info |
| 22 # files. This can reduce link time significantly, but is incompatible |
| 23 # with some utilities such as icecc and ccache. Requires gold and |
| 24 # gcc >= 4.8 or clang. |
| 25 # http://gcc.gnu.org/wiki/DebugFission |
| 26 # |
| 27 # TODO(GYP) enable this. Currently this gives errors from objcopy, presumably |
| 28 # because some other symbol or toolchain setting isn't correct. |
| 29 #use_debug_fission = use_gold |
| 30 use_debug_fission = false |
| 31 |
19 # default_include_dirs --------------------------------------------------------- | 32 # default_include_dirs --------------------------------------------------------- |
20 # | 33 # |
21 # This is a separate config so that third_party code (which would not use the | 34 # This is a separate config so that third_party code (which would not use the |
22 # source root and might have conflicting versions of some headers) can remove | 35 # source root and might have conflicting versions of some headers) can remove |
23 # this and specify their own include paths. | 36 # this and specify their own include paths. |
24 config("default_include_dirs") { | 37 config("default_include_dirs") { |
25 include_dirs = [ | 38 include_dirs = [ |
26 "//", | 39 "//", |
27 root_gen_dir, | 40 root_gen_dir, |
28 ] | 41 ] |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 "-Wl,-z,noexecstack", | 188 "-Wl,-z,noexecstack", |
176 "-Wl,-z,now", | 189 "-Wl,-z,now", |
177 "-Wl,-z,relro", | 190 "-Wl,-z,relro", |
178 ] | 191 ] |
179 } | 192 } |
180 | 193 |
181 # Linux-specific compiler flags setup. | 194 # Linux-specific compiler flags setup. |
182 # ------------------------------------ | 195 # ------------------------------------ |
183 if (is_linux) { | 196 if (is_linux) { |
184 cflags += [ "-pthread" ] | 197 cflags += [ "-pthread" ] |
185 | |
186 if (cpu_arch == "x64") { | |
187 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of | |
188 # address space, and it doesn't support cross-compiling). | |
189 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", | |
190 root_build_dir) | |
191 ldflags += [ | |
192 "-B$gold_path", | |
193 | |
194 # There seems to be a conflict of --icf and -pie in gold which can | |
195 # generate crashy binaries. As a security measure, -pie takes | |
196 # precedence for now. | |
197 # TODO(brettw) common.gypi has this only for target toolset. | |
198 #"-Wl,--icf=safe", | |
199 "-Wl,--icf=none", | |
200 | |
201 # Experimentation found that using four linking threads | |
202 # saved ~20% of link time. | |
203 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr
ead/thread/281527606915bb36 | |
204 # Only apply this to the target linker, since the host | |
205 # linker might not be gold, but isn't used much anyway. | |
206 # TODO(raymes): Disable threading because gold is frequently | |
207 # crashing on the bots: crbug.com/161942. | |
208 #"-Wl,--threads", | |
209 #"-Wl,--thread-count=4", | |
210 ] | |
211 } | |
212 | |
213 ldflags += [ | 198 ldflags += [ |
214 "-pthread", | 199 "-pthread", |
215 ] | 200 ] |
216 } | 201 } |
| 202 if (use_gold) { |
| 203 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of |
| 204 # address space, and it doesn't support cross-compiling). |
| 205 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", |
| 206 root_build_dir) |
| 207 ldflags += [ |
| 208 "-B$gold_path", |
| 209 |
| 210 # Newer gccs and clangs support -fuse-ld, use the flag to force gold |
| 211 # selection. |
| 212 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html |
| 213 "-fuse-ld=gold", |
| 214 |
| 215 # There seems to be a conflict of --icf and -pie in gold which can |
| 216 # generate crashy binaries. As a security measure, -pie takes |
| 217 # precedence for now. |
| 218 # TODO(brettw) common.gypi has this only for target toolset. |
| 219 #"-Wl,--icf=safe", |
| 220 "-Wl,--icf=none", |
| 221 |
| 222 # Experimentation found that using four linking threads |
| 223 # saved ~20% of link time. |
| 224 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_threa
d/thread/281527606915bb36 |
| 225 # Only apply this to the target linker, since the host |
| 226 # linker might not be gold, but isn't used much anyway. |
| 227 # TODO(raymes): Disable threading because gold is frequently |
| 228 # crashing on the bots: crbug.com/161942. |
| 229 #"-Wl,--threads", |
| 230 #"-Wl,--thread-count=4", |
| 231 ] |
| 232 } |
217 | 233 |
218 # Clang-specific compiler flags setup. | 234 # Clang-specific compiler flags setup. |
219 # ------------------------------------ | 235 # ------------------------------------ |
220 if (is_clang) { | 236 if (is_clang) { |
221 cflags += [ | 237 cflags += [ |
222 "-fcolor-diagnostics", | 238 "-fcolor-diagnostics", |
223 ] | 239 ] |
224 cflags_cc += [ | 240 cflags_cc += [ |
225 "-std=gnu++11", | 241 "-std=gnu++11", |
226 ] | 242 ] |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 } | 885 } |
870 | 886 |
871 # Symbols ---------------------------------------------------------------------- | 887 # Symbols ---------------------------------------------------------------------- |
872 | 888 |
873 config("symbols") { | 889 config("symbols") { |
874 if (is_win) { | 890 if (is_win) { |
875 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 891 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
876 ldflags = [ "/DEBUG" ] | 892 ldflags = [ "/DEBUG" ] |
877 } else { | 893 } else { |
878 cflags = [ "-g2" ] | 894 cflags = [ "-g2" ] |
| 895 if (use_debug_fission) { |
| 896 cflags += [ "-gsplit-dwarf" ] |
| 897 } |
879 } | 898 } |
880 } | 899 } |
881 | 900 |
882 config("minimal_symbols") { | 901 config("minimal_symbols") { |
883 if (is_win) { | 902 if (is_win) { |
884 # Linker symbols for backtraces only. | 903 # Linker symbols for backtraces only. |
885 ldflags = [ "/DEBUG" ] | 904 ldflags = [ "/DEBUG" ] |
886 } else { | 905 } else { |
887 cflags = [ "-g1" ] | 906 cflags = [ "-g1" ] |
| 907 if (use_debug_fission) { |
| 908 cflags += [ "-gsplit-dwarf" ] |
| 909 } |
888 } | 910 } |
889 } | 911 } |
890 | 912 |
891 config("no_symbols") { | 913 config("no_symbols") { |
892 if (!is_win) { | 914 if (!is_win) { |
893 cflags = [ "-g0" ] | 915 cflags = [ "-g0" ] |
894 } | 916 } |
895 } | 917 } |
OLD | NEW |