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

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

Issue 1043913002: Remove most android_webview_build conditions from build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and rebase Created 5 years, 8 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
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/features.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 (current_cpu == "arm") { 6 if (current_cpu == "arm") {
7 import("//build/config/arm.gni") 7 import("//build/config/arm.gni")
8 } 8 }
9 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 9 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
10 import("//build/config/mips.gni") 10 import("//build/config/mips.gni")
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 # Else building libyuv gives clang's register allocator issues, 239 # Else building libyuv gives clang's register allocator issues,
240 # see llvm.org/PR15798 / crbug.com/233709 240 # see llvm.org/PR15798 / crbug.com/233709
241 "-momit-leaf-frame-pointer", 241 "-momit-leaf-frame-pointer",
242 242
243 # Align the stack on 16-byte boundaries, http://crbug.com/418554. 243 # Align the stack on 16-byte boundaries, http://crbug.com/418554.
244 "-mstack-alignment=16", 244 "-mstack-alignment=16",
245 "-mstackrealign", 245 "-mstackrealign",
246 ] 246 ]
247 } 247 }
248 } else if (current_cpu == "arm") { 248 } else if (current_cpu == "arm") {
249 # Don't set the compiler flags for the WebView build. These will come 249 cflags += [
250 # from the Android build system. 250 "-march=$arm_arch",
251 if (!is_android_webview_build) { 251 "-mfloat-abi=$arm_float_abi",
252 ]
253 if (arm_tune != "") {
254 cflags += [ "-mtune=$arm_tune" ]
255 }
256 if (arm_use_thumb) {
257 cflags += [ "-mthumb" ]
258 if (is_android && !is_clang) { # Clang doesn't support this option.
259 cflags += [ "-mthumb-interwork" ]
260 }
261 }
262 if (!is_clang) {
263 # Clang doesn't support these flags.
252 cflags += [ 264 cflags += [
253 "-march=$arm_arch", 265 # The tree-sra optimization (scalar replacement for
254 "-mfloat-abi=$arm_float_abi", 266 # aggregates enabling subsequent optimizations) leads to
267 # invalid code generation when using the Android NDK's
268 # compiler (r5-r7). This can be verified using
269 # webkit_unit_tests' WTF.Checked_int8_t test.
270 "-fno-tree-sra",
271
272 # The following option is disabled to improve binary
273 # size and performance in gcc 4.9.
274 "-fno-caller-saves",
255 ] 275 ]
256 if (arm_tune != "") { 276 }
257 cflags += [ "-mtune=$arm_tune" ] 277 } else if (current_cpu == "mipsel") {
258 } 278 if (mips_arch_variant == "r6") {
259 if (arm_use_thumb) { 279 cflags += [
260 cflags += [ "-mthumb" ] 280 "-mips32r6",
261 if (is_android && !is_clang) { # Clang doesn't support this option. 281 "-Wa,-mips32r6",
262 cflags += [ "-mthumb-interwork" ] 282 ]
263 } 283 if (is_android) {
264 } 284 ldflags += [
265 if (!is_clang) { 285 "-mips32r6",
266 # Clang doesn't support these flags. 286 "-Wl,-melf32ltsmip",
267 cflags += [
268 # The tree-sra optimization (scalar replacement for
269 # aggregates enabling subsequent optimizations) leads to
270 # invalid code generation when using the Android NDK's
271 # compiler (r5-r7). This can be verified using
272 # webkit_unit_tests' WTF.Checked_int8_t test.
273 "-fno-tree-sra",
274
275 # The following option is disabled to improve binary
276 # size and performance in gcc 4.9.
277 "-fno-caller-saves",
278 ] 287 ]
279 } 288 }
289 } else if (mips_arch_variant == "r2") {
290 cflags += [
291 "-mips32r2",
292 "-Wa,-mips32r2",
293 ]
294 if (mips_float_abi == "hard" && mips_fpu_mode != "") {
295 cflags += [ "-m$mips_fpu_mode" ]
296 }
297 } else if (mips_arch_variant == "r1") {
298 cflags += [
299 "-mips32",
300 "-Wa,-mips32",
301 ]
280 } 302 }
281 } else if (current_cpu == "mipsel") {
282 # Don't set the compiler flags for the WebView build. These will come
283 # from the Android build system.
284 if (!is_android_webview_build) {
285 if (mips_arch_variant == "r6") {
286 cflags += [
287 "-mips32r6",
288 "-Wa,-mips32r6",
289 ]
290 if (is_android) {
291 ldflags += [
292 "-mips32r6",
293 "-Wl,-melf32ltsmip",
294 ]
295 }
296 } else if (mips_arch_variant == "r2") {
297 cflags += [
298 "-mips32r2",
299 "-Wa,-mips32r2",
300 ]
301 if (mips_float_abi == "hard" && mips_fpu_mode != "") {
302 cflags += [ "-m$mips_fpu_mode" ]
303 }
304 } else if (mips_arch_variant == "r1") {
305 cflags += [
306 "-mips32",
307 "-Wa,-mips32",
308 ]
309 }
310 303
311 if (mips_dsp_rev == 1) { 304 if (mips_dsp_rev == 1) {
312 cflags += [ "-mdsp" ] 305 cflags += [ "-mdsp" ]
313 } else if (mips_dsp_rev == 2) { 306 } else if (mips_dsp_rev == 2) {
314 cflags += [ "-mdspr2" ] 307 cflags += [ "-mdspr2" ]
315 } 308 }
316 309
317 cflags += [ "-m${mips_float_abi}-float" ] 310 cflags += [ "-m${mips_float_abi}-float" ]
318 }
319 } else if (current_cpu == "mips64el") { 311 } else if (current_cpu == "mips64el") {
320 # Don't set the compiler flags for the WebView build. These will come 312 if (mips_arch_variant == "r6") {
321 # from the Android build system. 313 cflags += [
322 if (!is_android_webview_build) { 314 "-mips64r6",
323 if (mips_arch_variant == "r6") { 315 "-Wa,-mips64r6",
324 cflags += [ 316 ]
325 "-mips64r6", 317 ldflags += [ "-mips64r6" ]
326 "-Wa,-mips64r6", 318 } else if (mips_arch_variant == "r2") {
327 ] 319 cflags += [
328 ldflags += [ "-mips64r6" ] 320 "-mips64r2",
329 } else if (mips_arch_variant == "r2") { 321 "-Wa,-mips64r2",
330 cflags += [ 322 ]
331 "-mips64r2", 323 ldflags += [ "-mips64r2" ]
332 "-Wa,-mips64r2",
333 ]
334 ldflags += [ "-mips64r2" ]
335 }
336 } 324 }
337 } 325 }
338 326
339 defines += [ "_FILE_OFFSET_BITS=64" ] 327 defines += [ "_FILE_OFFSET_BITS=64" ]
340 328
341 # Omit unwind support in official builds to save space. We can use breakpad 329 # Omit unwind support in official builds to save space. We can use breakpad
342 # for these builds. 330 # for these builds.
343 if (is_chrome_branded && is_official_build) { 331 if (is_chrome_branded && is_official_build) {
344 cflags += [ 332 cflags += [
345 "-fno-unwind-tables", 333 "-fno-unwind-tables",
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (is_android) { 414 if (is_android) {
427 cflags += [ 415 cflags += [
428 "-ffunction-sections", 416 "-ffunction-sections",
429 "-funwind-tables", 417 "-funwind-tables",
430 "-fno-short-enums", 418 "-fno-short-enums",
431 ] 419 ]
432 if (!is_clang) { 420 if (!is_clang) {
433 # Clang doesn't support these flags. 421 # Clang doesn't support these flags.
434 cflags += [ "-finline-limit=64" ] 422 cflags += [ "-finline-limit=64" ]
435 } 423 }
436 if (is_android_webview_build) {
437 # Android predefines this as 1; undefine it here so Chromium can redefine
438 # it later to be 2 for chromium code and unset for third party code. This
439 # works because cflags are added before defines.
440 # TODO(brettw) the above comment seems incorrect. We specify defines
441 # before cflags on our compiler command lines.
442 cflags += [ "-U_FORTIFY_SOURCE" ]
443 }
444
445 if (is_asan) { 424 if (is_asan) {
446 # Android build relies on -Wl,--gc-sections removing unreachable code. 425 # Android build relies on -Wl,--gc-sections removing unreachable code.
447 # ASan instrumentation for globals inhibits this and results in a library 426 # ASan instrumentation for globals inhibits this and results in a library
448 # with unresolvable relocations. 427 # with unresolvable relocations.
449 # TODO(eugenis): find a way to reenable this. 428 # TODO(eugenis): find a way to reenable this.
450 cflags += [ "-mllvm -asan-globals=0" ] 429 cflags += [ "-mllvm -asan-globals=0" ]
451 } 430 }
452 431
453 defines += [ "ANDROID" ] 432 defines += [ "ANDROID" ]
454 if (!is_android_webview_build) { 433
455 # The NDK has these things, but doesn't define the constants 434 # The NDK has these things, but doesn't define the constants
456 # to say that it does. Define them here instead. 435 # to say that it does. Define them here instead.
457 defines += [ "HAVE_SYS_UIO_H" ] 436 defines += [ "HAVE_SYS_UIO_H" ]
458 }
459 437
460 # Use gold for Android for most CPU architectures. 438 # Use gold for Android for most CPU architectures.
461 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") { 439 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
462 ldflags += [ "-fuse-ld=gold" ] 440 ldflags += [ "-fuse-ld=gold" ]
463 if (is_clang) { 441 if (is_clang) {
464 # Let clang find the ld.gold in the NDK. 442 # Let clang find the ld.gold in the NDK.
465 ldflags += [ "--gcc-toolchain=" + 443 ldflags += [ "--gcc-toolchain=" +
466 rebase_path(android_toolchain_root, root_build_dir) ] 444 rebase_path(android_toolchain_root, root_build_dir) ]
467 } 445 }
468 } 446 }
(...skipping 24 matching lines...) Expand all
493 ldflags += [ "-target arm-linux-androideabi" ] 471 ldflags += [ "-target arm-linux-androideabi" ]
494 } else if (current_cpu == "x86") { 472 } else if (current_cpu == "x86") {
495 cflags += [ "-target x86-linux-androideabi" ] 473 cflags += [ "-target x86-linux-androideabi" ]
496 ldflags += [ "-target x86-linux-androideabi" ] 474 ldflags += [ "-target x86-linux-androideabi" ]
497 } 475 }
498 } 476 }
499 } 477 }
500 } 478 }
501 479
502 config("compiler_arm_fpu") { 480 config("compiler_arm_fpu") {
503 if (current_cpu == "arm" && !is_android_webview_build) { 481 if (current_cpu == "arm") {
504 cflags = [ "-mfpu=$arm_fpu" ] 482 cflags = [ "-mfpu=$arm_fpu" ]
505 } 483 }
506 } 484 }
507 485
508 # runtime_library ------------------------------------------------------------- 486 # runtime_library -------------------------------------------------------------
509 # 487 #
510 # Sets the runtime library and associated options. 488 # Sets the runtime library and associated options.
511 # 489 #
512 # How do you determine what should go in here vs. "compiler" above? Consider if 490 # How do you determine what should go in here vs. "compiler" above? Consider if
513 # a target might choose to use a different runtime library (ignore for a moment 491 # a target might choose to use a different runtime library (ignore for a moment
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 cflags += [ 655 cflags += [
678 # Don't warn about printf format problems. This is off by default in gcc 656 # Don't warn about printf format problems. This is off by default in gcc
679 # but on in Ubuntu's gcc(!). 657 # but on in Ubuntu's gcc(!).
680 "-Wno-format", 658 "-Wno-format",
681 ] 659 ]
682 cflags_cc += [ 660 cflags_cc += [
683 # Don't warn about hash_map in third-party code. 661 # Don't warn about hash_map in third-party code.
684 "-Wno-deprecated", 662 "-Wno-deprecated",
685 ] 663 ]
686 } 664 }
687
688 if (is_android_webview_build) {
689 # There is a class of warning which:
690 # 1) Android always enables and also treats as errors
691 # 2) Chromium ignores in third party code
692 # So we re-enable those warnings when building Android.
693 cflags += [
694 "-Wno-address",
695 "-Wno-format-security",
696 "-Wno-return-type",
697 "-Wno-sequence-point",
698 ]
699 cflags_cc += [ "-Wno-non-virtual-dtor" ]
700 }
701 } 665 }
702 666
703 # rtti ------------------------------------------------------------------------ 667 # rtti ------------------------------------------------------------------------
704 # 668 #
705 # Allows turning Run-Time Type Identification on or off. 669 # Allows turning Run-Time Type Identification on or off.
706 670
707 config("rtti") { 671 config("rtti") {
708 if (is_win) { 672 if (is_win) {
709 cflags_cc = [ "/GR" ] 673 cflags_cc = [ "/GR" ]
710 } 674 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 cflags += [ "-gsplit-dwarf" ] 1074 cflags += [ "-gsplit-dwarf" ]
1111 } 1075 }
1112 } 1076 }
1113 } 1077 }
1114 1078
1115 config("no_symbols") { 1079 config("no_symbols") {
1116 if (!is_win) { 1080 if (!is_win) {
1117 cflags = [ "-g0" ] 1081 cflags = [ "-g0" ]
1118 } 1082 }
1119 } 1083 }
OLDNEW
« no previous file with comments | « build/config/android/config.gni ('k') | build/config/features.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698