xref: /aosp_15_r20/external/cronet/build/config/android/abi.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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.
11assert(is_android || is_chromeos)
12
13declare_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  # This configuration has minimal coverage.
30  # Forces all APKs/bundles to be 64-bit only to improve build speed
31  # (no need to also build 32-bit library).
32  skip_secondary_abi_for_cq = false
33}
34
35assert(!devtools_instrumentation_dumping || use_order_profiling,
36       "devtools_instrumentation_dumping requires use_order_profiling")
37
38if (current_cpu == "x86") {
39  android_app_abi = "x86"
40  android_abi_target = "i686-linux-android"
41  sanitizer_arch = "i686"
42} else if (current_cpu == "arm") {
43  import("//build/config/arm.gni")
44  if (arm_version < 7) {
45    android_app_abi = "armeabi"
46  } else {
47    android_app_abi = "armeabi-v7a"
48  }
49  android_abi_target = "arm-linux-androideabi"
50  sanitizer_arch = "arm"
51} else if (current_cpu == "mipsel") {
52  android_app_abi = "mips"
53  android_abi_target = "mipsel-linux-android"
54} else if (current_cpu == "x64") {
55  android_app_abi = "x86_64"
56  android_abi_target = "x86_64-linux-android"
57  sanitizer_arch = "x86_64"
58} else if (current_cpu == "arm64") {
59  android_app_abi = "arm64-v8a"
60  android_abi_target = "aarch64-linux-android"
61  sanitizer_arch = "aarch64"
62} else if (current_cpu == "mips64el") {
63  android_app_abi = "mips64"
64
65  # Place holder for mips64 support, not tested.
66  android_abi_target = "mips64el-linux-android"
67} else if (current_cpu == "riscv64") {
68  android_app_abi = "riscv64"
69
70  # Place holder for riscv64 support, not tested.
71  android_abi_target = "riscv64-linux-android"
72  sanitizer_arch = "riscv64"
73} else {
74  assert(false, "Unknown Android ABI: " + current_cpu)
75}
76
77if (target_cpu == "arm64" || target_cpu == "x64" || target_cpu == "mips64el" ||
78    target_cpu == "riscv64") {
79  android_64bit_target_cpu = true
80} else if (target_cpu == "arm" || target_cpu == "x86" ||
81           target_cpu == "mipsel") {
82  android_64bit_target_cpu = false
83} else {
84  assert(false, "Unknown target CPU: $target_cpu")
85}
86
87android_64bit_current_cpu = current_cpu == "arm64" || target_cpu == "x64" ||
88                            target_cpu == "mips64el" || current_cpu == "riscv64"
89
90# Do not define android_secondary_abi_cpu or android_app_secondary_abi for
91# target_cpu's that are 32-bit-only or 64-bit-only, as they are not used. The
92# presence of this variable may be used in conjunction with android_64bit_target_cpu
93# to identify target_cpu's that are 32-bit-only or 64-bit-only.
94if (target_cpu == "arm64") {
95  android_secondary_abi_cpu = "arm"
96  android_app_secondary_abi = "armeabi-v7a"
97} else if (target_cpu == "x64") {
98  android_secondary_abi_cpu = "x86"
99  android_app_secondary_abi = "x86"
100} else if (target_cpu == "mips64el") {
101  android_secondary_abi_cpu = "mipsel"
102  android_app_secondary_abi = "mips"
103}
104
105if (defined(android_secondary_abi_cpu)) {
106  android_secondary_abi_toolchain =
107      "//build/toolchain/android:android_clang_${android_secondary_abi_cpu}"
108}
109