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