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 if (current_cpu == "arm") { | 7 if (current_cpu == "arm") { |
8 import("//build/config/arm.gni") | 8 import("//build/config/arm.gni") |
9 } | 9 } |
10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 # Not exporting C++ inline functions can generally be applied anywhere | 161 # Not exporting C++ inline functions can generally be applied anywhere |
162 # so we do so here. Normal function visibility is controlled by | 162 # so we do so here. Normal function visibility is controlled by |
163 # //build/config/gcc:symbol_visibility_hidden. | 163 # //build/config/gcc:symbol_visibility_hidden. |
164 "-fvisibility-inlines-hidden", | 164 "-fvisibility-inlines-hidden", |
165 ] | 165 ] |
166 | 166 |
167 # Stack protection. | 167 # Stack protection. |
168 if (is_mac) { | 168 if (is_mac) { |
169 cflags += [ "-fstack-protector-all" ] | 169 cflags += [ "-fstack-protector-all" ] |
170 } else if (is_linux) { | 170 } else if (is_posix && !is_chromeos && !is_nacl) { |
171 cflags += [ | 171 # TODO(phajdan.jr): Use -fstack-protector-strong when our gcc supports it. |
172 "-fstack-protector", | 172 cflags += [ "--param=ssp-buffer-size=4" ] |
173 "--param=ssp-buffer-size=4", | 173 if (is_android && (current_cpu == "arm64" || current_cpu == "x86")) { |
174 ] | 174 cflags += [ "-fno-stack-protector" ] |
| 175 } else { |
| 176 cflags += [ "-fstack-protector" ] |
| 177 } |
175 } | 178 } |
176 | 179 |
177 # Linker warnings. | 180 # Linker warnings. |
178 if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { | 181 if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { |
179 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 182 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
180 ldflags += [ "-Wl,--fatal-warnings" ] | 183 ldflags += [ "-Wl,--fatal-warnings" ] |
181 } | 184 } |
182 | 185 |
183 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and | 186 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and |
184 # MemorySanitizer | 187 # MemorySanitizer |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 518 } |
516 | 519 |
517 # Android-specific flags setup. | 520 # Android-specific flags setup. |
518 # ----------------------------- | 521 # ----------------------------- |
519 if (is_android) { | 522 if (is_android) { |
520 cflags += [ | 523 cflags += [ |
521 "-ffunction-sections", | 524 "-ffunction-sections", |
522 "-funwind-tables", | 525 "-funwind-tables", |
523 "-fno-short-enums", | 526 "-fno-short-enums", |
524 ] | 527 ] |
525 if (!is_clang) { | 528 if (is_clang) { |
| 529 rebased_android_toolchain_root = |
| 530 rebase_path(android_toolchain_root, root_build_dir) |
| 531 cflags += [ |
| 532 # TODO(hans) Enable integrated-as (crbug.com/124610). |
| 533 "-no-integrated-as", |
| 534 "-B${rebased_android_toolchain_root}/bin", # Else /usr/bin/as gets pick
ed up. |
| 535 ] |
| 536 } else { |
526 # Clang doesn't support these flags. | 537 # Clang doesn't support these flags. |
527 cflags += [ "-finline-limit=64" ] | 538 cflags += [ "-finline-limit=64" ] |
528 } | 539 } |
529 if (is_asan) { | 540 if (is_asan) { |
530 # Android build relies on -Wl,--gc-sections removing unreachable code. | 541 # Android build relies on -Wl,--gc-sections removing unreachable code. |
531 # ASan instrumentation for globals inhibits this and results in a library | 542 # ASan instrumentation for globals inhibits this and results in a library |
532 # with unresolvable relocations. | 543 # with unresolvable relocations. |
533 # TODO(eugenis): find a way to reenable this. | 544 # TODO(eugenis): find a way to reenable this. |
534 cflags += [ "-mllvm -asan-globals=0" ] | 545 cflags += [ "-mllvm -asan-globals=0" ] |
535 } | 546 } |
536 | 547 |
537 defines += [ "ANDROID" ] | 548 defines += [ "ANDROID" ] |
538 | 549 |
539 # The NDK has these things, but doesn't define the constants | 550 # The NDK has these things, but doesn't define the constants |
540 # to say that it does. Define them here instead. | 551 # to say that it does. Define them here instead. |
541 defines += [ "HAVE_SYS_UIO_H" ] | 552 defines += [ "HAVE_SYS_UIO_H" ] |
542 | 553 |
543 # Use gold for Android for most CPU architectures. | 554 # Use gold for Android for most CPU architectures. |
544 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") { | 555 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") { |
545 ldflags += [ "-fuse-ld=gold" ] | 556 ldflags += [ "-fuse-ld=gold" ] |
546 if (is_clang) { | 557 if (is_clang) { |
547 # Let clang find the ld.gold in the NDK. | 558 # Let clang find the ld.gold in the NDK. |
548 ldflags += [ "--gcc-toolchain=" + | 559 ldflags += [ "--gcc-toolchain=$rebased_android_toolchain_root" ] |
549 rebase_path(android_toolchain_root, root_build_dir) ] | |
550 } | 560 } |
551 } | 561 } |
552 | 562 |
553 ldflags += [ | 563 ldflags += [ |
554 "-Wl,--no-undefined", | 564 "-Wl,--no-undefined", |
555 | 565 |
556 # Don't allow visible symbols from libgcc or libc++ to be | 566 # Don't allow visible symbols from libgcc or libc++ to be |
557 # re-exported. | 567 # re-exported. |
558 "-Wl,--exclude-libs=libgcc.a", | 568 "-Wl,--exclude-libs=libgcc.a", |
559 "-Wl,--exclude-libs=libc++_static.a", | 569 "-Wl,--exclude-libs=libc++_static.a", |
560 | 570 |
561 # Don't allow visible symbols from libraries that contain | 571 # Don't allow visible symbols from libraries that contain |
562 # assembly code with symbols that aren't hidden properly. | 572 # assembly code with symbols that aren't hidden properly. |
563 # http://crbug.com/448386 | 573 # http://crbug.com/448386 |
564 "-Wl,--exclude-libs=libvpx_assembly_arm.a", | 574 "-Wl,--exclude-libs=libvpx_assembly_arm.a", |
565 ] | 575 ] |
566 if (current_cpu == "arm") { | 576 if (current_cpu == "arm") { |
567 ldflags += [ | 577 ldflags += [ |
568 # Enable identical code folding to reduce size. | 578 # Enable identical code folding to reduce size. |
569 "-Wl,--icf=safe", | 579 "-Wl,--icf=safe", |
570 ] | 580 ] |
571 } | 581 } |
572 | 582 |
573 if (is_clang) { | 583 if (is_clang) { |
574 if (current_cpu == "arm") { | 584 if (current_cpu == "arm") { |
575 cflags += [ "-target arm-linux-androideabi" ] | 585 cflags += [ |
576 ldflags += [ "-target arm-linux-androideabi" ] | 586 "-target", |
| 587 "arm-linux-androideabi", |
| 588 ] |
| 589 ldflags += [ |
| 590 "-target", |
| 591 "arm-linux-androideabi", |
| 592 ] |
577 } else if (current_cpu == "x86") { | 593 } else if (current_cpu == "x86") { |
578 cflags += [ "-target i686-linux-androideabi" ] | 594 cflags += [ |
579 ldflags += [ "-target i686-linux-androideabi" ] | 595 "-target", |
| 596 "i686-linux-androideabi", |
| 597 ] |
| 598 ldflags += [ |
| 599 "-target", |
| 600 "i686-linux-androideabi", |
| 601 ] |
580 } | 602 } |
581 } | 603 } |
582 } | 604 } |
583 | 605 |
584 # Pass the same C/C++ flags to the objective C/C++ compiler. | 606 # Pass the same C/C++ flags to the objective C/C++ compiler. |
585 cflags_objc += cflags_c | 607 cflags_objc += cflags_c |
586 cflags_objcc += cflags_cc | 608 cflags_objcc += cflags_cc |
587 } | 609 } |
588 | 610 |
589 config("compiler_arm_fpu") { | 611 config("compiler_arm_fpu") { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 # availability is newer than the deployment target. This is not | 862 # availability is newer than the deployment target. This is not |
841 # required when compiling Chrome for iOS. | 863 # required when compiling Chrome for iOS. |
842 default_warning_flags += [ "-Wpartial-availability" ] | 864 default_warning_flags += [ "-Wpartial-availability" ] |
843 } | 865 } |
844 } | 866 } |
845 | 867 |
846 if (gcc_version >= 48) { | 868 if (gcc_version >= 48) { |
847 default_warning_flags_cc += [ | 869 default_warning_flags_cc += [ |
848 # See comment for -Wno-c++11-narrowing. | 870 # See comment for -Wno-c++11-narrowing. |
849 "-Wno-narrowing", | 871 "-Wno-narrowing", |
850 | |
851 # TODO(thakis): Remove, http://crbug.com/263960 | |
852 "-Wno-literal-suffix", | |
853 ] | 872 ] |
| 873 if (!is_clang) { |
| 874 default_warning_flags_cc += [ |
| 875 # TODO(thakis): Remove, http://crbug.com/263960 |
| 876 "-Wno-literal-suffix", |
| 877 ] |
| 878 } |
854 } | 879 } |
855 | 880 |
856 # Suppress warnings about ABI changes on ARM (Clang doesn't give this | 881 # Suppress warnings about ABI changes on ARM (Clang doesn't give this |
857 # warning). | 882 # warning). |
858 if (current_cpu == "arm" && !is_clang) { | 883 if (current_cpu == "arm" && !is_clang) { |
859 default_warning_flags += [ "-Wno-psabi" ] | 884 default_warning_flags += [ "-Wno-psabi" ] |
860 } | 885 } |
861 | 886 |
862 if (is_android) { | 887 if (is_android) { |
863 # Disable any additional warnings enabled by the Android build system but | 888 # Disable any additional warnings enabled by the Android build system but |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 cflags += [ "-gsplit-dwarf" ] | 1306 cflags += [ "-gsplit-dwarf" ] |
1282 } | 1307 } |
1283 } | 1308 } |
1284 } | 1309 } |
1285 | 1310 |
1286 config("no_symbols") { | 1311 config("no_symbols") { |
1287 if (!is_win) { | 1312 if (!is_win) { |
1288 cflags = [ "-g0" ] | 1313 cflags = [ "-g0" ] |
1289 } | 1314 } |
1290 } | 1315 } |
OLD | NEW |