• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2014 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  } else if (current_cpu == "loongarch64") {
18    musl_arch = "loongarch64"
19  }
20  # musl_root = "$root_out_dir/obj/third_party/musl"
21  # musl_sub_arch = ""
22  # musl_syslib_dir = "/system/bin"
23  # musl_linker_extension = "so.1"
24}
25
26declare_args() {
27  if ((defined(target_os) && target_os == "ohos") ||
28      (defined(ohos_kernel_type) && ohos_kernel_type == "linux")) {
29    musl_target_os = "linux"
30    if (musl_arch == "mips") {
31      musl_target_triple = "mipsel-linux-ohos"
32    } else {
33      musl_target_triple = "${musl_arch}-linux-ohos"
34    }
35  } else if (defined(ohos_kernel_type) && ohos_kernel_type == "liteos_a") {
36    musl_target_os = "liteos_a"
37    musl_target_triple = "arm-liteos-ohos"
38  }
39}
40
41declare_args() {
42  musl_use_gwp_asan = false
43  if (!is_llvm_build && current_cpu == "arm64") {
44    musl_use_gwp_asan = true
45  }
46
47  if (is_llvm_build) {
48    runtime_lib_path = "//out/llvm-install/lib/clang/15.0.4/lib"
49  } else {
50    if (host_cpu == "arm64") {
51      runtime_lib_path =
52          "//prebuilts/clang/ohos/linux-aarch64/llvm/lib/clang/15.0.4/lib"
53    } else {
54      runtime_lib_path =
55          "//prebuilts/clang/ohos/linux-x86_64/llvm/lib/clang/15.0.4/lib"
56    }
57  }
58  musl_user_custom_libc = true
59  musl_use_jemalloc = false
60  musl_use_encaps = false
61  musl_malloc_plugin = ""
62  musl_use_jemalloc_dfx_intf = false
63  musl_use_jemalloc_recycle_func = false
64  musl_guard_jemalloc_tsd = false
65  musl_use_pthread_cancel = false
66  musl_ported_dir = "intermidiates/${musl_target_os}/musl_src_ported"
67  musl_inc_out_dir = "usr/include/${musl_target_triple}"
68  musl_uapi_dir = "//kernel/linux/patches/linux-5.10/prebuilts/usr/include"
69  musl_linux_kernel_dir = "//kernel/linux/linux-5.10"
70  musl_dir = "//third_party/musl"
71  musl_porting_dir = "//third_party/musl/porting/linux/user"
72
73  # if (is_asan) {
74  #   musl_linker_asan_name =
75  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan"
76  #   musl_ldso_path =
77  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan." +
78  #       musl_linker_extension
79  # } else {
80  #   musl_ldso_path =
81  #       musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}." +
82  #       musl_linker_extension
83  # }
84}
85
86declare_args() {
87  musl_enable_musl_log = true
88  if (!is_standard_system) {
89    musl_enable_musl_log = false
90  }
91  musl_iterate_and_stats_api = false
92  musl_secure_level = 1
93}
94
95declare_args() {
96  if (!defined(product_path)) {
97    product_path = ""
98  }
99}
100
101declare_args() {
102  # for unit test
103  musl_unit_test_flag = false
104}
105
106declare_args() {
107  musl_ld128_flag = false
108}
109
110declare_args() {
111  # for multi lib
112  musl_target_multilib = ""
113}
114
115declare_args() {
116  # whether clang select the legacy encoding
117  musl_is_legacy = false
118}
119
120declare_args() {
121  musl_use_flto = false
122}
123
124declare_args() {
125  musl_use_icu_locale = false
126}
127
128# part of default_compiler_configs from build/config/BUILDCONFIG.gn
129musl_inherited_configs = [
130  "//build/config/compiler:afdo",
131  "//build/config/compiler:afdo_optimize_size",
132  "//build/config/compiler:compiler",
133  "//build/config/compiler:compiler_arm_fpu",
134  "//build/config/compiler:compiler_arm_thumb",
135  "//build/config/compiler:chromium_code",
136  "//build/config/compiler:default_include_dirs",
137  "//build/config/compiler:default_optimization",
138  "//build/config/compiler:default_stack_frames",
139  "//build/config/compiler:default_symbols",
140  "//build/config/compiler:export_dynamic",
141  "//build/config/compiler:no_exceptions",
142  "//build/config/compiler:no_rtti",
143  "//build/config/compiler:runtime_library",
144  "//build/config/compiler:thin_archive",
145  "//build/config/sanitizers:default_sanitizer_flags",
146]
147
148porting_deps = [
149  "//third_party/musl:create_alltypes_h",
150  "//third_party/musl:create_porting_src",
151  "//third_party/musl:create_syscall_h",
152  "//third_party/musl:create_version_h",
153]
154