| 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 declare_args() { | 5 declare_args() { |
| 6 # The optimization level to use for debug builds. | 6 # The optimization level to use for debug builds. |
| 7 if (is_android) { | 7 if (is_android) { |
| 8 # On Android we kind of optimize some things that don't affect debugging | 8 # On Android we kind of optimize some things that don't affect debugging |
| 9 # much even when optimization is disabled to get the binary size down. | 9 # much even when optimization is disabled to get the binary size down. |
| 10 debug_optimization_level = "s" | 10 debug_optimization_level = "s" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 # well-defined C/C++ and Clang can optimize such checks away in | 123 # well-defined C/C++ and Clang can optimize such checks away in |
| 124 # release builds, but they may be used in asserts in debug builds. | 124 # release builds, but they may be used in asserts in debug builds. |
| 125 extra_flags = [ | 125 extra_flags = [ |
| 126 "-Wno-undefined-bool-conversion", | 126 "-Wno-undefined-bool-conversion", |
| 127 "-Wno-tautological-undefined-compare", | 127 "-Wno-tautological-undefined-compare", |
| 128 ] | 128 ] |
| 129 cflags_cc += extra_flags | 129 cflags_cc += extra_flags |
| 130 cflags_objcc += extra_flags | 130 cflags_objcc += extra_flags |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (is_clang) { |
| 134 # This is here so that all files get recompiled after a clang roll and |
| 135 # when turning clang on or off. (defines are passed via the command line, |
| 136 # and build system rebuild things when their commandline changes). Nothing |
| 137 # should ever read this define. |
| 138 defines += |
| 139 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", |
| 140 [ "--print-revision" ], |
| 141 "trim string") ] |
| 142 } |
| 143 |
| 133 # Mac-specific compiler flags setup. | 144 # Mac-specific compiler flags setup. |
| 134 # ---------------------------------- | 145 # ---------------------------------- |
| 135 if (is_mac) { | 146 if (is_mac) { |
| 136 # These flags are shared between the C compiler and linker. | 147 # These flags are shared between the C compiler and linker. |
| 137 common_mac_flags = [ "-fno-exceptions" ] | 148 common_mac_flags = [ "-fno-exceptions" ] |
| 138 | 149 |
| 139 # CPU architecture. | 150 # CPU architecture. |
| 140 if (current_cpu == "x64") { | 151 if (current_cpu == "x64") { |
| 141 common_mac_flags += [ | 152 common_mac_flags += [ |
| 142 "-arch", | 153 "-arch", |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 cflags += [ "-mllvm -asan-globals=0" ] | 358 cflags += [ "-mllvm -asan-globals=0" ] |
| 348 } | 359 } |
| 349 | 360 |
| 350 defines += [ "ANDROID" ] | 361 defines += [ "ANDROID" ] |
| 351 | 362 |
| 352 # The NDK has these things, but doesn't define the constants | 363 # The NDK has these things, but doesn't define the constants |
| 353 # to say that it does. Define them here instead. | 364 # to say that it does. Define them here instead. |
| 354 defines += [ "HAVE_SYS_UIO_H" ] | 365 defines += [ "HAVE_SYS_UIO_H" ] |
| 355 | 366 |
| 356 # Use gold for Android for most CPU architectures. | 367 # Use gold for Android for most CPU architectures. |
| 357 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || | 368 if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") { |
| 358 current_cpu == "arm64") { | |
| 359 ldflags += [ "-fuse-ld=gold" ] | 369 ldflags += [ "-fuse-ld=gold" ] |
| 360 if (is_clang) { | 370 if (is_clang) { |
| 361 # Let clang find the ld.gold in the NDK. | 371 # Let clang find the ld.gold in the NDK. |
| 362 ldflags += [ "--gcc-toolchain=" + | 372 ldflags += [ "--gcc-toolchain=" + |
| 363 rebase_path(android_toolchain_root, root_build_dir) ] | 373 rebase_path(android_toolchain_root, root_build_dir) ] |
| 364 } | 374 } |
| 365 } | 375 } |
| 366 | 376 |
| 367 ldflags += [ | 377 ldflags += [ |
| 368 # Don't re-export visible symbols from libraries. | 378 # Don't allow visible symbols from libgcc or libc++ to be |
| 369 "-Wl,--exclude-libs,ALL", | 379 # re-exported. |
| 380 "-Wl,--exclude-libs=libgcc.a", |
| 381 "-Wl,--exclude-libs=libc++_static.a", |
| 370 ] | 382 ] |
| 371 if (current_cpu == "arm") { | 383 if (current_cpu == "arm") { |
| 372 ldflags += [ | 384 ldflags += [ |
| 373 # Enable identical code folding to reduce size. | 385 # Enable identical code folding to reduce size. |
| 374 "-Wl,--icf=safe", | 386 "-Wl,--icf=safe", |
| 375 ] | 387 ] |
| 376 } | 388 } |
| 377 | 389 |
| 378 if (is_clang) { | 390 if (is_clang) { |
| 379 if (current_cpu == "arm") { | 391 if (current_cpu == "arm") { |
| 380 cflags += [ "--target=arm-linux-androideabi" ] | 392 cflags += [ "--target=arm-linux-androideabi" ] |
| 381 ldflags += [ "--target=arm-linux-androideabi" ] | 393 ldflags += [ "--target=arm-linux-androideabi" ] |
| 382 } else if (current_cpu == "arm64") { | |
| 383 cflags += [ "--target=aarch64-linux-android" ] | |
| 384 ldflags += [ "--target=aarch64-linux-android" ] | |
| 385 } else if (current_cpu == "x86") { | 394 } else if (current_cpu == "x86") { |
| 386 cflags += [ "--target=i686-linux-androideabi" ] | 395 cflags += [ "--target=x86-linux-androideabi" ] |
| 387 ldflags += [ "--target=i686-linux-androideabi" ] | 396 ldflags += [ "--target=x86-linux-androideabi" ] |
| 388 } else if (current_cpu == "x64") { | |
| 389 cflags += [ "--target=x86_64-linux-androideabi" ] | |
| 390 ldflags += [ "--target=x86_64-linux-androideabi" ] | |
| 391 } | 397 } |
| 392 } | 398 } |
| 393 } | 399 } |
| 394 | 400 |
| 395 # Assign any flags set for the C compiler to asmflags so that they are sent | 401 # Assign any flags set for the C compiler to asmflags so that they are sent |
| 396 # to the assembler. The Windows assembler takes different types of flags | 402 # to the assembler. The Windows assembler takes different types of flags |
| 397 # so only do so for posix platforms. | 403 # so only do so for posix platforms. |
| 398 if (is_posix) { | 404 if (is_posix) { |
| 399 asmflags += cflags | 405 asmflags += cflags |
| 400 asmflags += cflags_c | 406 asmflags += cflags_c |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), | 476 rebase_path("$android_libcpp_root/libcxx/include", root_build_dir), |
| 471 "-isystem" + rebase_path( | 477 "-isystem" + rebase_path( |
| 472 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/includ
e", | 478 "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/includ
e", |
| 473 root_build_dir), | 479 root_build_dir), |
| 474 "-isystem" + | 480 "-isystem" + |
| 475 rebase_path("$android_ndk_root/sources/android/support/include", | 481 rebase_path("$android_ndk_root/sources/android/support/include", |
| 476 root_build_dir), | 482 root_build_dir), |
| 477 ] | 483 ] |
| 478 | 484 |
| 479 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ] | 485 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ] |
| 486 libs += [ "$android_libcpp_library" ] |
| 480 | 487 |
| 481 libs += [ | 488 if (current_cpu == "mipsel") { |
| 482 "$android_libcpp_library", | 489 libs += [ |
| 483 "c++abi", | 490 # ld linker is used for mips Android, and ld does not accept library |
| 484 "android_support", | 491 # absolute path prefixed by "-l"; Since libgcc does not exist in mips |
| 485 ] | 492 # sysroot the proper library will be linked. |
| 486 | 493 # TODO(gordanac): Remove once gold linker is used for mips Android. |
| 487 if (current_cpu == "arm") { | 494 "gcc", |
| 488 libs += [ "unwind" ] | 495 ] |
| 496 } else { |
| 497 libs += [ |
| 498 # Manually link the libgcc.a that the cross compiler uses. This is |
| 499 # absolute because the linker will look inside the sysroot if it's not. |
| 500 rebase_path(android_libgcc_file), |
| 501 ] |
| 489 } | 502 } |
| 490 | 503 |
| 491 libs += [ | 504 libs += [ |
| 492 "gcc", | |
| 493 "c", | 505 "c", |
| 494 "dl", | 506 "dl", |
| 495 "m", | 507 "m", |
| 496 ] | 508 ] |
| 497 | 509 |
| 498 # Clang with libc++ does not require an explicit atomic library reference. | 510 # Clang with libc++ does not require an explicit atomic library reference. |
| 499 if (!is_clang) { | 511 if (!is_clang) { |
| 500 libs += [ "atomic" ] | 512 libs += [ "atomic" ] |
| 501 } | 513 } |
| 502 } | 514 } |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 786 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
| 775 } | 787 } |
| 776 ldflags = [ "/DEBUG" ] | 788 ldflags = [ "/DEBUG" ] |
| 777 } else { | 789 } else { |
| 778 cflags = [ | 790 cflags = [ |
| 779 "-g3", | 791 "-g3", |
| 780 "-ggdb3", | 792 "-ggdb3", |
| 781 ] | 793 ] |
| 782 } | 794 } |
| 783 } | 795 } |
| OLD | NEW |