tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

abi.gni (4311B)


      1 # Copyright 2017 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # Logic separated out from config.gni so that it can be used by compiler.gni
      6 # without introducing a circular dependency.
      7 
      8 # NOTE: Because Chrome OS builds may depend on targets built with the Android
      9 # toolchain, this GNI file may be read and processed from within Chrome OS
     10 # toolchains. Checking |is_android| here would therefore be too restrictive.
     11 assert(is_android || is_chromeos || is_robolectric)
     12 
     13 declare_args() {
     14   # Adds intrumentation to each function. Writes a file with the order that
     15   # functions are called at startup.
     16   use_order_profiling = false
     17 
     18   # Only effective if use_order_profiling = true. When this is true,
     19   # instrumentation switches from startup profiling after a delay, and
     20   # then waits for a devtools memory dump request to dump all
     21   # profiling information. When false, the same delay is used to switch from
     22   # startup, and then after a second delay all profiling information is dumped.
     23   # See base::android::orderfile::StartDelayedDump for more information.
     24   devtools_instrumentation_dumping = false
     25 
     26   # Build additional browser splits with HWASAN instrumentation enabled.
     27   build_hwasan_splits = false
     28 
     29   # Enable (webview) APKs that support multiple architectures. Generally
     30   # needed only for release builds or for webview testing. Slows down "gn gen"
     31   # and ninja parse time due to having to write rules for most native targets
     32   # a second time. Applicable only when target_cpu is 64-bit.
     33   enable_android_secondary_abi = is_official_build
     34 }
     35 
     36 assert(!devtools_instrumentation_dumping || use_order_profiling,
     37        "devtools_instrumentation_dumping requires use_order_profiling")
     38 
     39 if (target_cpu == "x86") {
     40   android_app_abi = "x86"
     41   android_abi_target = "i686-linux-android"
     42   sanitizer_arch = "i686"
     43 } else if (target_cpu == "arm") {
     44   import("//chromium/build/config/arm.gni")
     45   if (arm_version < 7) {
     46     android_app_abi = "armeabi"
     47   } else {
     48     android_app_abi = "armeabi-v7a"
     49   }
     50   android_abi_target = "arm-linux-androideabi"
     51   sanitizer_arch = "arm"
     52 } else if (target_cpu == "mipsel") {
     53   android_app_abi = "mips"
     54   android_abi_target = "mipsel-linux-android"
     55 } else if (target_cpu == "x64") {
     56   android_app_abi = "x86_64"
     57   android_abi_target = "x86_64-linux-android"
     58   sanitizer_arch = "x86_64"
     59 } else if (target_cpu == "arm64") {
     60   android_app_abi = "arm64-v8a"
     61   android_abi_target = "aarch64-linux-android"
     62   sanitizer_arch = "aarch64"
     63 } else if (target_cpu == "mips64el") {
     64   android_app_abi = "mips64"
     65 
     66   # Place holder for mips64 support, not tested.
     67   android_abi_target = "mips64el-linux-android"
     68 } else if (target_cpu == "riscv64") {
     69   android_app_abi = "riscv64"
     70 
     71   # Place holder for riscv64 support, not tested.
     72   android_abi_target = "riscv64-linux-android"
     73   sanitizer_arch = "riscv64"
     74 } else {
     75   assert(false, "Unknown Android ABI: " + target_cpu)
     76 }
     77 
     78 if (target_cpu == "arm64" || target_cpu == "x64" || target_cpu == "mips64el" ||
     79     target_cpu == "riscv64") {
     80   android_64bit_target_cpu = true
     81 } else if (target_cpu == "arm" || target_cpu == "x86" ||
     82            target_cpu == "mipsel") {
     83   android_64bit_target_cpu = false
     84 } else {
     85   assert(false, "Unknown target CPU: $target_cpu")
     86 }
     87 
     88 android_64bit_target_cpu =
     89     target_cpu == "arm64" || target_cpu == "x64" ||
     90     target_cpu == "mips64el" || target_cpu == "riscv64"
     91 
     92 # Do not define android_secondary_abi_cpu or android_app_secondary_abi for
     93 # target_cpu's that are 32-bit-only or 64-bit-only, as they are not used. The
     94 # presence of this variable may be used in conjunction with android_64bit_target_cpu
     95 # to identify target_cpu's that are 32-bit-only or 64-bit-only.
     96 if (enable_android_secondary_abi) {
     97   if (target_cpu == "arm64") {
     98     android_secondary_abi_cpu = "arm"
     99     android_app_secondary_abi = "armeabi-v7a"
    100   } else if (target_cpu == "x64") {
    101     android_secondary_abi_cpu = "x86"
    102     android_app_secondary_abi = "x86"
    103   } else if (target_cpu == "mips64el") {
    104     android_secondary_abi_cpu = "mipsel"
    105     android_app_secondary_abi = "mips"
    106   }
    107 
    108   if (defined(android_secondary_abi_cpu)) {
    109     android_secondary_abi_toolchain =
    110         "//chromium/build/toolchain/android:android_clang_${android_secondary_abi_cpu}"
    111   }
    112 }