• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4import("//build/config/sanitizers/sanitizers.gni")
5
6declare_args() {
7  if (current_cpu == "arm") {
8    musl_arch = "arm"
9  } else if (current_cpu == "arm64") {
10    musl_arch = "aarch64"
11  } else if (current_cpu == "x86_64" || current_cpu == "x64") {
12    musl_arch = "x86_64"
13  } else if (current_cpu == "mipsel") {
14    musl_arch = "mips"
15  } else if (current_cpu == "riscv64") {
16    musl_arch = "riscv64"
17  }
18  # musl_root = "$root_out_dir/obj/third_party/musl"
19  # musl_sub_arch = ""
20  # musl_syslib_dir = "/system/bin"
21  # musl_linker_extension = "so.1"
22}
23
24declare_args() {
25  if ((defined(target_os) && target_os == "ohos") ||
26      (defined(ohos_kernel_type) && ohos_kernel_type == "linux")) {
27    musl_target_os = "linux"
28    if (musl_arch == "mips") {
29      musl_target_triple = "mipsel-linux-ohos"
30    } else {
31      musl_target_triple = "${musl_arch}-linux-ohos"
32    }
33  } else if (defined(ohos_kernel_type) && ohos_kernel_type == "liteos_a") {
34    musl_target_os = "liteos_a"
35    musl_target_triple = "arm-liteos-ohos"
36  }
37}
38
39declare_args() {
40  if (is_llvm_build) {
41    runtime_lib_path = "//out/llvm-install/lib/clang/15.0.4/lib"
42  } else {
43    runtime_lib_path =
44        "//prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/15.0.4/lib"
45  }
46  if (!is_llvm_build) {
47    use_gwp_asan = true
48  } else {
49    use_gwp_asan = false
50  }
51  user_custom_libc = true
52  use_jemalloc = false
53  musl_malloc_plugin = ""
54  use_jemalloc_dfx_intf = false
55  use_jemalloc_recycle_func = false
56  use_pthread_cancel = false
57  musl_ported_dir = "intermidiates/${musl_target_os}/musl_src_ported"
58  musl_inc_out_dir = "usr/include/${musl_target_triple}"
59  uapi_dir = "//kernel/linux/patches/linux-5.10/prebuilts/usr/include"
60  linux_kernel_dir = "//kernel/linux/linux-5.10"
61  musl_dir = "//third_party/musl"
62  musl_porting_dir = "//third_party/musl/porting/linux/user"
63
64  # if (is_asan) {
65  #   musl_linker_asan_name =
66  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan"
67  #   musl_ldso_path =
68  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan." +
69  #       musl_linker_extension
70  # } else {
71  #   musl_ldso_path =
72  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}." +
73  #       musl_linker_extension
74  # }
75}
76
77declare_args() {
78  if (!is_standard_system) {
79    enable_musl_log = false
80  }
81  musl_iterate_and_stats_api = false
82  musl_secure_level = 1
83}
84
85declare_args() {
86  if (!defined(product_path)) {
87    product_path = ""
88  }
89}
90
91declare_args() {
92  # for unit test
93  musl_unit_test_flag = false
94}
95
96declare_args() {
97  musl_ld128_flag = false
98  if (musl_arch == "x86_64") {
99    musl_ld128_flag = true
100  }
101}
102
103declare_args() {
104  # for multi lib
105  musl_target_multilib = ""
106}
107
108declare_args() {
109  # whether clang select the legacy encoding
110  is_legacy = false
111}
112