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_use_pthread_cancel = false 65 musl_ported_dir = "intermidiates/${musl_target_os}/musl_src_ported" 66 musl_inc_out_dir = "usr/include/${musl_target_triple}" 67 musl_uapi_dir = "//kernel/linux/patches/linux-5.10/prebuilts/usr/include" 68 musl_linux_kernel_dir = "//kernel/linux/linux-5.10" 69 musl_dir = "//third_party/musl" 70 musl_porting_dir = "//third_party/musl/porting/linux/user" 71 72 # if (is_asan) { 73 # musl_linker_asan_name = 74 # musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan" 75 # musl_ldso_path = 76 # musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}-asan." + 77 # musl_linker_extension 78 # } else { 79 # musl_ldso_path = 80 # musl_syslib_dir + "/ld-musl-${musl_arch}${musl_sub_arch}." + 81 # musl_linker_extension 82 # } 83} 84 85declare_args() { 86 musl_enable_musl_log = true 87 if (!is_standard_system) { 88 musl_enable_musl_log = false 89 } 90 musl_iterate_and_stats_api = false 91 musl_secure_level = 1 92} 93 94declare_args() { 95 if (!defined(product_path)) { 96 product_path = "" 97 } 98} 99 100declare_args() { 101 # for unit test 102 musl_unit_test_flag = false 103} 104 105declare_args() { 106 musl_ld128_flag = false 107} 108 109declare_args() { 110 # for multi lib 111 musl_target_multilib = "" 112} 113 114declare_args() { 115 # whether clang select the legacy encoding 116 musl_is_legacy = false 117} 118 119declare_args() { 120 musl_use_flto = false 121} 122 123declare_args() { 124 musl_use_icu_locale = false 125} 126 127# part of default_compiler_configs from build/config/BUILDCONFIG.gn 128musl_inherited_configs = [ 129 "//build/config/compiler:afdo", 130 "//build/config/compiler:afdo_optimize_size", 131 "//build/config/compiler:compiler", 132 "//build/config/compiler:compiler_arm_fpu", 133 "//build/config/compiler:compiler_arm_thumb", 134 "//build/config/compiler:chromium_code", 135 "//build/config/compiler:default_include_dirs", 136 "//build/config/compiler:default_optimization", 137 "//build/config/compiler:default_stack_frames", 138 "//build/config/compiler:default_symbols", 139 "//build/config/compiler:export_dynamic", 140 "//build/config/compiler:no_exceptions", 141 "//build/config/compiler:no_rtti", 142 "//build/config/compiler:runtime_library", 143 "//build/config/compiler:thin_archive", 144 "//build/config/sanitizers:default_sanitizer_flags", 145] 146 147porting_deps = [ 148 "//third_party/musl:create_alltypes_h", 149 "//third_party/musl:create_porting_src", 150 "//third_party/musl:create_syscall_h", 151 "//third_party/musl:create_version_h", 152] 153