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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 913373002: Update Chomium's build files to work w/ latest GN binaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn_cpu_arch_changes
Patch Set: cleanup / review Created 5 years, 10 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
OLDNEW
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 (current_cpu == "arm") {
7 import("//build/config/arm.gni") 7 import("//build/config/arm.gni")
8 } 8 }
9 if (cpu_arch == "mipsel" || cpu_arch == "mips64el") { 9 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
10 import("//build/config/mips.gni") 10 import("//build/config/mips.gni")
11 } 11 }
12 if (is_posix) { 12 if (is_posix) {
13 import("//build/config/gcc/gcc_version.gni") 13 import("//build/config/gcc/gcc_version.gni")
14 } 14 }
15 15
16 import("//build/toolchain/ccache.gni") 16 import("//build/toolchain/ccache.gni")
17 17
18 declare_args() { 18 declare_args() {
19 # Normally, Android builds are lightly optimized, even for debug builds, to 19 # Normally, Android builds are lightly optimized, even for debug builds, to
20 # keep binary size down. Setting this flag to true disables such optimization 20 # keep binary size down. Setting this flag to true disables such optimization
21 android_full_debug = false 21 android_full_debug = false
22 22
23 # Whether to use the binary binutils checked into third_party/binutils. 23 # Whether to use the binary binutils checked into third_party/binutils.
24 # These are not multi-arch so cannot be used except on x86 and x86-64 (the 24 # These are not multi-arch so cannot be used except on x86 and x86-64 (the
25 # only two architectures that are currently checked in). Turn this off when 25 # only two architectures that are currently checked in). Turn this off when
26 # you are using a custom toolchain and need to control -B in cflags. 26 # you are using a custom toolchain and need to control -B in cflags.
27 linux_use_bundled_binutils = is_linux && cpu_arch == "x64" 27 linux_use_bundled_binutils = is_linux && current_cpu == "x64"
28 28
29 # Compile in such a way as to enable profiling of the generated code. For 29 # Compile in such a way as to enable profiling of the generated code. For
30 # example, don't omit the frame pointer and leave in symbols. 30 # example, don't omit the frame pointer and leave in symbols.
31 enable_profiling = false 31 enable_profiling = false
32 32
33 # Compile in such a way as to make it possible for the profiler to unwind full 33 # Compile in such a way as to make it possible for the profiler to unwind full
34 # stack frames. Setting this flag has a large effect on the performance of the 34 # stack frames. Setting this flag has a large effect on the performance of the
35 # generated code than just setting profiling, but gives the profiler more 35 # generated code than just setting profiling, but gives the profiler more
36 # information to analyze. 36 # information to analyze.
37 # Requires profiling to be set to true. 37 # Requires profiling to be set to true.
38 enable_full_stack_frames_for_profiling = false 38 enable_full_stack_frames_for_profiling = false
39 39
40 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of 40 # Use gold for linking on 64-bit Linux only (on 32-bit it runs out of
41 # address space, and it doesn't support cross-compiling). 41 # address space, and it doesn't support cross-compiling).
42 use_gold = is_linux && cpu_arch == "x64" 42 use_gold = is_linux && current_cpu == "x64"
43 43
44 # use_debug_fission: whether to use split DWARF debug info 44 # use_debug_fission: whether to use split DWARF debug info
45 # files. This can reduce link time significantly, but is incompatible 45 # files. This can reduce link time significantly, but is incompatible
46 # with some utilities such as icecc and ccache. Requires gold and 46 # with some utilities such as icecc and ccache. Requires gold and
47 # gcc >= 4.8 or clang. 47 # gcc >= 4.8 or clang.
48 # http://gcc.gnu.org/wiki/DebugFission 48 # http://gcc.gnu.org/wiki/DebugFission
49 use_debug_fission = 49 use_debug_fission =
50 !is_win && use_gold && linux_use_bundled_binutils && !use_ccache 50 !is_win && use_gold && linux_use_bundled_binutils && !use_ccache
51 } 51 }
52 52
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (is_mac) { 114 if (is_mac) {
115 cflags += [ "-fstack-protector-all" ] 115 cflags += [ "-fstack-protector-all" ]
116 } else if (is_linux) { 116 } else if (is_linux) {
117 cflags += [ 117 cflags += [
118 "-fstack-protector", 118 "-fstack-protector",
119 "--param=ssp-buffer-size=4", 119 "--param=ssp-buffer-size=4",
120 ] 120 ]
121 } 121 }
122 122
123 # Linker warnings. 123 # Linker warnings.
124 if (!(is_chromeos && cpu_arch == "arm") && !is_mac) { 124 if (!(is_chromeos && current_cpu == "arm") && !is_mac) {
125 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 125 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580
126 ldflags += [ "-Wl,--fatal-warnings" ] 126 ldflags += [ "-Wl,--fatal-warnings" ]
127 } 127 }
128 128
129 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and 129 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and
130 # MemorySanitizer 130 # MemorySanitizer
131 if (using_sanitizer) { 131 if (using_sanitizer) {
132 cflags += [ 132 cflags += [
133 "-fno-omit-frame-pointer", 133 "-fno-omit-frame-pointer",
134 "-gline-tables-only", 134 "-gline-tables-only",
(...skipping 30 matching lines...) Expand all
165 "value") ] 165 "value") ]
166 } 166 }
167 167
168 # Mac-specific compiler flags setup. 168 # Mac-specific compiler flags setup.
169 # ---------------------------------- 169 # ----------------------------------
170 if (is_mac || is_ios) { 170 if (is_mac || is_ios) {
171 # These flags are shared between the C compiler and linker. 171 # These flags are shared between the C compiler and linker.
172 common_mac_flags = [] 172 common_mac_flags = []
173 173
174 # CPU architecture. 174 # CPU architecture.
175 if (cpu_arch == "x64") { 175 if (current_cpu == "x64") {
176 common_mac_flags += [ 176 common_mac_flags += [
177 "-arch", 177 "-arch",
178 "x86_64", 178 "x86_64",
179 ] 179 ]
180 } else if (cpu_arch == "x86") { 180 } else if (current_cpu == "x86") {
181 common_mac_flags += [ 181 common_mac_flags += [
182 "-arch", 182 "-arch",
183 "i386", 183 "i386",
184 ] 184 ]
185 } 185 }
186 186
187 cflags += common_mac_flags 187 cflags += common_mac_flags
188 188
189 # Without this, the constructors and destructors of a C++ object inside 189 # Without this, the constructors and destructors of a C++ object inside
190 # an Objective C struct won't be called, which is very bad. 190 # an Objective C struct won't be called, which is very bad.
(...skipping 24 matching lines...) Expand all
215 if (enable_full_stack_frames_for_profiling) { 215 if (enable_full_stack_frames_for_profiling) {
216 cflags += [ 216 cflags += [
217 "-fno-inline", 217 "-fno-inline",
218 "-fno-optimize-sibling-calls", 218 "-fno-optimize-sibling-calls",
219 ] 219 ]
220 } 220 }
221 } 221 }
222 222
223 # CPU architecture. We may or may not be doing a cross compile now, so for 223 # CPU architecture. We may or may not be doing a cross compile now, so for
224 # simplicity we always explicitly set the architecture. 224 # simplicity we always explicitly set the architecture.
225 if (cpu_arch == "x64") { 225 if (current_cpu == "x64") {
226 cflags += [ 226 cflags += [
227 "-m64", 227 "-m64",
228 "-march=x86-64", 228 "-march=x86-64",
229 ] 229 ]
230 ldflags += [ "-m64" ] 230 ldflags += [ "-m64" ]
231 } else if (cpu_arch == "x86") { 231 } else if (current_cpu == "x86") {
232 cflags += [ "-m32" ] 232 cflags += [ "-m32" ]
233 ldflags += [ "-m32" ] 233 ldflags += [ "-m32" ]
234 if (is_clang) { 234 if (is_clang) {
235 cflags += [ 235 cflags += [
236 # Else building libyuv gives clang's register allocator issues, 236 # Else building libyuv gives clang's register allocator issues,
237 # see llvm.org/PR15798 / crbug.com/233709 237 # see llvm.org/PR15798 / crbug.com/233709
238 "-momit-leaf-frame-pointer", 238 "-momit-leaf-frame-pointer",
239 239
240 # Align the stack on 16-byte boundaries, http://crbug.com/418554. 240 # Align the stack on 16-byte boundaries, http://crbug.com/418554.
241 "-mstack-alignment=16", 241 "-mstack-alignment=16",
242 "-mstackrealign", 242 "-mstackrealign",
243 ] 243 ]
244 } 244 }
245 } else if (cpu_arch == "arm") { 245 } else if (current_cpu == "arm") {
246 # Don't set the compiler flags for the WebView build. These will come 246 # Don't set the compiler flags for the WebView build. These will come
247 # from the Android build system. 247 # from the Android build system.
248 if (!is_android_webview_build) { 248 if (!is_android_webview_build) {
249 cflags += [ 249 cflags += [
250 "-march=$arm_arch", 250 "-march=$arm_arch",
251 "-mfloat-abi=$arm_float_abi", 251 "-mfloat-abi=$arm_float_abi",
252 ] 252 ]
253 if (arm_tune != "") { 253 if (arm_tune != "") {
254 cflags += [ "-mtune=$arm_tune" ] 254 cflags += [ "-mtune=$arm_tune" ]
255 } 255 }
(...skipping 12 matching lines...) Expand all
268 # compiler (r5-r7). This can be verified using 268 # compiler (r5-r7). This can be verified using
269 # webkit_unit_tests' WTF.Checked_int8_t test. 269 # webkit_unit_tests' WTF.Checked_int8_t test.
270 "-fno-tree-sra", 270 "-fno-tree-sra",
271 271
272 # The following option is disabled to improve binary 272 # The following option is disabled to improve binary
273 # size and performance in gcc 4.9. 273 # size and performance in gcc 4.9.
274 "-fno-caller-saves", 274 "-fno-caller-saves",
275 ] 275 ]
276 } 276 }
277 } 277 }
278 } else if (cpu_arch == "mipsel") { 278 } else if (current_cpu == "mipsel") {
279 # Don't set the compiler flags for the WebView build. These will come 279 # Don't set the compiler flags for the WebView build. These will come
280 # from the Android build system. 280 # from the Android build system.
281 if (!is_android_webview_build) { 281 if (!is_android_webview_build) {
282 if (mips_arch_variant == "r6") { 282 if (mips_arch_variant == "r6") {
283 cflags += [ 283 cflags += [
284 "-mips32r6", 284 "-mips32r6",
285 "-Wa,-mips32r6", 285 "-Wa,-mips32r6",
286 ] 286 ]
287 if (is_android) { 287 if (is_android) {
288 ldflags += [ 288 ldflags += [
289 "-mips32r6", 289 "-mips32r6",
290 "-Wl,-melf32ltsmip", 290 "-Wl,-melf32ltsmip",
291 ] 291 ]
292 } 292 }
293 } else if (mips_arch_variant == "r2") { 293 } else if (mips_arch_variant == "r2") {
294 cflags += [ 294 cflags += [
295 "-mips32r2", 295 "-mips32r2",
296 "-Wa,-mips32r2", 296 "-Wa,-mips32r2",
297 ] 297 ]
298 } else if (mips_arch_variant == "r1") { 298 } else if (mips_arch_variant == "r1") {
299 cflags += [ 299 cflags += [
300 "-mips32", 300 "-mips32",
301 "-Wa,-mips32", 301 "-Wa,-mips32",
302 ] 302 ]
303 } 303 }
304 } 304 }
305 } else if (cpu_arch == "mips64el") { 305 } else if (current_cpu == "mips64el") {
306 # Don't set the compiler flags for the WebView build. These will come 306 # Don't set the compiler flags for the WebView build. These will come
307 # from the Android build system. 307 # from the Android build system.
308 if (!is_android_webview_build) { 308 if (!is_android_webview_build) {
309 if (mips_arch_variant == "r6") { 309 if (mips_arch_variant == "r6") {
310 cflags += [ 310 cflags += [
311 "-mips64r6", 311 "-mips64r6",
312 "-Wa,-mips64r6", 312 "-Wa,-mips64r6",
313 ] 313 ]
314 ldflags += [ "-mips64r6" ] 314 ldflags += [ "-mips64r6" ]
315 } else if (mips_arch_variant == "r2") { 315 } else if (mips_arch_variant == "r2") {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 430 }
431 431
432 defines += [ "ANDROID" ] 432 defines += [ "ANDROID" ]
433 if (!is_android_webview_build) { 433 if (!is_android_webview_build) {
434 # The NDK has these things, but doesn't define the constants 434 # The NDK has these things, but doesn't define the constants
435 # to say that it does. Define them here instead. 435 # to say that it does. Define them here instead.
436 defines += [ "HAVE_SYS_UIO_H" ] 436 defines += [ "HAVE_SYS_UIO_H" ]
437 } 437 }
438 438
439 # Use gold for Android for most CPU architectures. 439 # Use gold for Android for most CPU architectures.
440 if (cpu_arch == "x86" || cpu_arch == "x64" || cpu_arch == "arm") { 440 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
441 ldflags += [ "-fuse-ld=gold" ] 441 ldflags += [ "-fuse-ld=gold" ]
442 if (is_clang) { 442 if (is_clang) {
443 # Let clang find the ld.gold in the NDK. 443 # Let clang find the ld.gold in the NDK.
444 ldflags += [ "--gcc-toolchain=" + 444 ldflags += [ "--gcc-toolchain=" +
445 rebase_path(android_toolchain_root, root_build_dir) ] 445 rebase_path(android_toolchain_root, root_build_dir) ]
446 } 446 }
447 } 447 }
448 448
449 ldflags += [ 449 ldflags += [
450 "-Wl,--no-undefined", 450 "-Wl,--no-undefined",
451 451
452 # Don't export symbols from statically linked libraries. 452 # Don't export symbols from statically linked libraries.
453 "-Wl,--exclude-libs=ALL", 453 "-Wl,--exclude-libs=ALL",
454 ] 454 ]
455 if (cpu_arch == "arm") { 455 if (current_cpu == "arm") {
456 ldflags += [ 456 ldflags += [
457 # Enable identical code folding to reduce size. 457 # Enable identical code folding to reduce size.
458 "-Wl,--icf=safe", 458 "-Wl,--icf=safe",
459 ] 459 ]
460 } 460 }
461 461
462 if (is_clang) { 462 if (is_clang) {
463 if (cpu_arch == "arm") { 463 if (current_cpu == "arm") {
464 cflags += [ "-target arm-linux-androideabi" ] 464 cflags += [ "-target arm-linux-androideabi" ]
465 ldflags += [ "-target arm-linux-androideabi" ] 465 ldflags += [ "-target arm-linux-androideabi" ]
466 } else if (cpu_arch == "x86") { 466 } else if (current_cpu == "x86") {
467 cflags += [ "-target x86-linux-androideabi" ] 467 cflags += [ "-target x86-linux-androideabi" ]
468 ldflags += [ "-target x86-linux-androideabi" ] 468 ldflags += [ "-target x86-linux-androideabi" ]
469 } 469 }
470 } 470 }
471 } 471 }
472 } 472 }
473 473
474 config("compiler_arm_fpu") { 474 config("compiler_arm_fpu") {
475 if (cpu_arch == "arm" && !is_android_webview_build) { 475 if (current_cpu == "arm" && !is_android_webview_build) {
476 cflags = [ "-mfpu=$arm_fpu" ] 476 cflags = [ "-mfpu=$arm_fpu" ]
477 } 477 }
478 } 478 }
479 479
480 # runtime_library ------------------------------------------------------------- 480 # runtime_library -------------------------------------------------------------
481 # 481 #
482 # Sets the runtime library and associated options. 482 # Sets the runtime library and associated options.
483 # 483 #
484 # How do you determine what should go in here vs. "compiler" above? Consider if 484 # How do you determine what should go in here vs. "compiler" above? Consider if
485 # a target might choose to use a different runtime library (ignore for a moment 485 # a target might choose to use a different runtime library (ignore for a moment
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 # See comment for -Wno-c++11-narrowing. 819 # See comment for -Wno-c++11-narrowing.
820 "-Wno-narrowing", 820 "-Wno-narrowing",
821 821
822 # TODO(thakis): Remove, http://crbug.com/263960 822 # TODO(thakis): Remove, http://crbug.com/263960
823 "-Wno-literal-suffix", 823 "-Wno-literal-suffix",
824 ] 824 ]
825 } 825 }
826 826
827 # Suppress warnings about ABI changes on ARM (Clang doesn't give this 827 # Suppress warnings about ABI changes on ARM (Clang doesn't give this
828 # warning). 828 # warning).
829 if (cpu_arch == "arm" && !is_clang) { 829 if (current_cpu == "arm" && !is_clang) {
830 cflags += [ "-Wno-psabi" ] 830 cflags += [ "-Wno-psabi" ]
831 } 831 }
832 832
833 if (is_android) { 833 if (is_android) {
834 # Disable any additional warnings enabled by the Android build system but 834 # Disable any additional warnings enabled by the Android build system but
835 # which chromium does not build cleanly with (when treating warning as 835 # which chromium does not build cleanly with (when treating warning as
836 # errors). 836 # errors).
837 cflags += [ 837 cflags += [
838 "-Wno-extra", 838 "-Wno-extra",
839 "-Wno-ignored-qualifiers", 839 "-Wno-ignored-qualifiers",
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 cflags += [ "-gsplit-dwarf" ] 1042 cflags += [ "-gsplit-dwarf" ]
1043 } 1043 }
1044 } 1044 }
1045 } 1045 }
1046 1046
1047 config("no_symbols") { 1047 config("no_symbols") {
1048 if (!is_win) { 1048 if (!is_win) {
1049 cflags = [ "-g0" ] 1049 cflags = [ "-g0" ]
1050 } 1050 }
1051 } 1051 }
OLDNEW
« no previous file with comments | « build/config/arm.gni ('k') | build/config/features.gni » ('j') | ppapi/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698