• 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  }
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
113declare_args() {
114  use_flto = false
115}
116
117# part of default_compiler_configs from build/config/BUILDCONFIG.gn
118musl_inherited_configs = [
119  "//build/config/compiler:afdo",
120  "//build/config/compiler:afdo_optimize_size",
121  "//build/config/compiler:compiler",
122  "//build/config/compiler:compiler_arm_fpu",
123  "//build/config/compiler:compiler_arm_thumb",
124  "//build/config/compiler:chromium_code",
125  "//build/config/compiler:default_include_dirs",
126  "//build/config/compiler:default_optimization",
127  "//build/config/compiler:default_stack_frames",
128  "//build/config/compiler:default_symbols",
129  "//build/config/compiler:export_dynamic",
130  "//build/config/compiler:no_exceptions",
131  "//build/config/compiler:no_rtti",
132  "//build/config/compiler:runtime_library",
133  "//build/config/compiler:thin_archive",
134  "//build/config/sanitizers:default_sanitizer_flags",
135]
136
137porting_deps = [
138  "//third_party/musl:create_alltypes_h",
139  "//third_party/musl:create_porting_src",
140  "//third_party/musl:create_syscall_h",
141  "//third_party/musl:create_version_h",
142]
143