未验证 提交 8d471392 编写于 作者: O openharmony_ci 提交者: Gitee

!481 标准系统适配march

Merge pull request !481 from xxlight/march1
...@@ -17,13 +17,8 @@ if (is_lite_system && current_os == "ohos") { ...@@ -17,13 +17,8 @@ if (is_lite_system && current_os == "ohos") {
} else { } else {
import("musl_template.gni") import("musl_template.gni")
musl_abi_target = "soft"
group("musl_all") { group("musl_all") {
deps = [ deps = [
":a7_hard_neon_libs",
":a7_soft_libs",
":a7_softfp_neon_libs",
":musl_headers", ":musl_headers",
":soft_libs", ":soft_libs",
] ]
...@@ -51,25 +46,12 @@ if (is_lite_system && current_os == "ohos") { ...@@ -51,25 +46,12 @@ if (is_lite_system && current_os == "ohos") {
group("musl_libs") { group("musl_libs") {
deps = [ deps = [
":${musl_abi_target}_libs",
":musl_headers", ":musl_headers",
":soft_libs",
] ]
} }
musl_libs("soft_libs") { musl_libs("soft_libs") {
target_abi = "soft"
}
musl_libs("a7_soft_libs") {
target_abi = "a7_soft"
}
musl_libs("a7_softfp_neon_libs") {
target_abi = "a7_softfp_neon-vfpv4"
}
musl_libs("a7_hard_neon_libs") {
target_abi = "a7_hard_neon-vfpv4"
} }
group("musl_headers") { group("musl_headers") {
......
...@@ -4,21 +4,10 @@ import("musl_src.gni") ...@@ -4,21 +4,10 @@ import("musl_src.gni")
template("musl_libs") { template("musl_libs") {
no_default_deps = true no_default_deps = true
forward_variables_from(invoker, [ "target_abi" ]) forward_variables_from(invoker, [ "*" ])
abi_prefix = target_abi
if (target_abi == "soft") {
_libs_path_prefix = "."
_libs_out_dir = "usr/lib/${musl_target_triple}"
} else {
_libs_path_prefix = "${target_abi}"
_libs_out_dir = "usr/lib/${musl_target_triple}/${target_abi}"
}
musl_subarch = "" _libs_path_prefix = "."
if (target_abi == "a7_hard_neon-vfpv4") { _libs_out_dir = "usr/lib/${musl_target_triple}"
musl_subarch = "hf"
}
dfx_deps = [ "//base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler:dfxsignalhandler" ] dfx_deps = [ "//base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler:dfxsignalhandler" ]
porting_deps = [ porting_deps = [
...@@ -30,47 +19,47 @@ template("musl_libs") { ...@@ -30,47 +19,47 @@ template("musl_libs") {
group(target_name) { group(target_name) {
deps = [ deps = [
":${abi_prefix}_create_linker", ":soft_create_linker",
":${abi_prefix}_libc_musl_shared", ":soft_libc_musl_shared",
":${abi_prefix}_libc_musl_static", ":soft_libc_musl_static",
":${abi_prefix}_musl_crt_libs", ":soft_musl_crt_libs",
] ]
} }
group("${abi_prefix}_shared_libs") { group("soft_shared_libs") {
deps = [ deps = [
":${abi_prefix}_libc_musl_shared",
":${abi_prefix}_libcrypt",
":${abi_prefix}_libdl",
":${abi_prefix}_libm",
":${abi_prefix}_libpthread",
":${abi_prefix}_libresolv",
":${abi_prefix}_librt",
":${abi_prefix}_libutil",
":${abi_prefix}_libxnet",
":${abi_prefix}_musl_crt_libs",
":musl_headers", ":musl_headers",
":soft_libc_musl_shared",
":soft_libcrypt",
":soft_libdl",
":soft_libm",
":soft_libpthread",
":soft_libresolv",
":soft_librt",
":soft_libutil",
":soft_libxnet",
":soft_musl_crt_libs",
] ]
} }
group("${abi_prefix}_static_libs") { group("soft_static_libs") {
deps = [ deps = [
":${abi_prefix}_libc_musl_static",
":${abi_prefix}_libcrypt",
":${abi_prefix}_libdl",
":${abi_prefix}_libm",
":${abi_prefix}_libpthread",
":${abi_prefix}_libresolv",
":${abi_prefix}_librt",
":${abi_prefix}_libutil",
":${abi_prefix}_libxnet",
":${abi_prefix}_musl_crt_libs",
":musl_headers", ":musl_headers",
":soft_libc_musl_static",
":soft_libcrypt",
":soft_libdl",
":soft_libm",
":soft_libpthread",
":soft_libresolv",
":soft_librt",
":soft_libutil",
":soft_libxnet",
":soft_musl_crt_libs",
] ]
} }
group("${abi_prefix}_musl_crt_libs") { group("soft_musl_crt_libs") {
deps = [ ":${abi_prefix}_musl_crt_install_action" ] deps = [ ":soft_musl_crt_install_action" ]
} }
# part of default_compiler_configs from build/config/BUILDCONFIG.gn # part of default_compiler_configs from build/config/BUILDCONFIG.gn
...@@ -93,33 +82,8 @@ template("musl_libs") { ...@@ -93,33 +82,8 @@ template("musl_libs") {
"//build/config/sanitizers:default_sanitizer_flags", "//build/config/sanitizers:default_sanitizer_flags",
] ]
config("${abi_prefix}_musl_abi_config") { config("soft_musl_config") {
if (musl_arch == "arm") { configs = [ "//build/config/compiler:compiler_cpu_abi" ]
if (target_abi == "soft") {
cflags = [ "-mfloat-abi=soft" ]
} else if (target_abi == "a7_soft") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=soft",
]
} else if (target_abi == "a7_softfp_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=softfp",
"-mfpu=neon-vfpv4",
]
} else if (target_abi == "a7_hard_neon-vfpv4") {
cflags = [
"-mcpu=cortex-a7",
"-mfloat-abi=hard",
"-mfpu=neon-vfpv4",
]
}
}
}
config("${abi_prefix}_musl_config") {
configs = [ ":${abi_prefix}_musl_abi_config" ]
include_dirs = [ include_dirs = [
"${target_out_dir}/${musl_ported_dir}/arch/${musl_arch}", "${target_out_dir}/${musl_ported_dir}/arch/${musl_arch}",
...@@ -138,10 +102,8 @@ template("musl_libs") { ...@@ -138,10 +102,8 @@ template("musl_libs") {
] ]
if (musl_arch == "arm") { if (musl_arch == "arm") {
cflags_basic += [ "-march=armv7-a" ]
cflags_basic += [ "-mtp=cp15" ] cflags_basic += [ "-mtp=cp15" ]
} else if (musl_arch == "aarch64") { } else if (musl_arch == "aarch64") {
cflags_basic += [ "-march=armv8" ]
} }
cflags_auto = [ cflags_auto = [
...@@ -179,10 +141,7 @@ template("musl_libs") { ...@@ -179,10 +141,7 @@ template("musl_libs") {
cflags = cflags_all cflags = cflags_all
defines = [] defines = [ "BROKEN_VFP_ASM" ]
if ("${target_abi}" != "a7_hard_neon-vfpv4") {
defines += [ "BROKEN_VFP_ASM" ]
}
if (is_standard_system) { if (is_standard_system) {
defines += [ defines += [
"OHOS_DNS_PROXY_BY_NETSYS=1", "OHOS_DNS_PROXY_BY_NETSYS=1",
...@@ -212,7 +171,7 @@ template("musl_libs") { ...@@ -212,7 +171,7 @@ template("musl_libs") {
asmflags = cflags asmflags = cflags
} }
config("${abi_prefix}_hook") { config("soft_hook") {
defines = [] defines = []
configs = [] configs = []
...@@ -245,7 +204,7 @@ template("musl_libs") { ...@@ -245,7 +204,7 @@ template("musl_libs") {
} }
} }
source_set("${abi_prefix}_musl_crt") { source_set("soft_musl_crt") {
sources = [ sources = [
"${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/crti.s", "${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/crti.s",
"${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/crtn.s", "${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/crtn.s",
...@@ -257,7 +216,7 @@ template("musl_libs") { ...@@ -257,7 +216,7 @@ template("musl_libs") {
defines = [ "CRT" ] defines = [ "CRT" ]
configs -= musl_inherited_configs configs -= musl_inherited_configs
configs += [ ":${abi_prefix}_musl_config" ] configs += [ ":soft_musl_config" ]
cflags = [ cflags = [
"-fPIC", "-fPIC",
"-fno-stack-protector", "-fno-stack-protector",
...@@ -268,7 +227,7 @@ template("musl_libs") { ...@@ -268,7 +227,7 @@ template("musl_libs") {
asmflags = cflags asmflags = cflags
} }
source_set("${abi_prefix}_musl_src") { source_set("soft_musl_src") {
sources_orig = [] sources_orig = []
sources = [] sources = []
set_sources_assignment_filter([]) set_sources_assignment_filter([])
...@@ -305,9 +264,6 @@ template("musl_libs") { ...@@ -305,9 +264,6 @@ template("musl_libs") {
} }
defines = [] defines = []
if ("${target_abi}" == "a7_hard_neon-vfpv4") {
defines += [ "__ARM_PCS_VFP" ]
}
if (musl_secure_level > 0) { if (musl_secure_level > 0) {
defines += [ "MALLOC_FREELIST_HARDENED" ] defines += [ "MALLOC_FREELIST_HARDENED" ]
} }
...@@ -390,7 +346,7 @@ template("musl_libs") { ...@@ -390,7 +346,7 @@ template("musl_libs") {
] ]
configs -= musl_inherited_configs configs -= musl_inherited_configs
configs += [ ":${abi_prefix}_musl_config" ] configs += [ ":soft_musl_config" ]
if (!defined(defines)) { if (!defined(defines)) {
defines = [] defines = []
...@@ -409,7 +365,7 @@ template("musl_libs") { ...@@ -409,7 +365,7 @@ template("musl_libs") {
deps = porting_deps deps = porting_deps
} }
source_set("${abi_prefix}_musl_src_nossp") { source_set("soft_musl_src_nossp") {
sources = [] sources = []
sources_orig = [ sources_orig = [
"src/string/mempcpy.c", "src/string/mempcpy.c",
...@@ -432,7 +388,7 @@ template("musl_libs") { ...@@ -432,7 +388,7 @@ template("musl_libs") {
} }
configs -= musl_inherited_configs configs -= musl_inherited_configs
configs += [ ":${abi_prefix}_musl_config" ] configs += [ ":soft_musl_config" ]
cflags = [ cflags = [
"-O3", "-O3",
"-fPIC", "-fPIC",
...@@ -442,7 +398,7 @@ template("musl_libs") { ...@@ -442,7 +398,7 @@ template("musl_libs") {
deps = porting_deps deps = porting_deps
} }
source_set("${abi_prefix}_musl_ldso") { source_set("soft_musl_ldso") {
sources = [] sources = []
sources_orig = musl_src_ldso sources_orig = musl_src_ldso
...@@ -451,7 +407,7 @@ template("musl_libs") { ...@@ -451,7 +407,7 @@ template("musl_libs") {
} }
configs -= musl_inherited_configs configs -= musl_inherited_configs
configs += [ ":${abi_prefix}_musl_config" ] configs += [ ":soft_musl_config" ]
cflags = [ cflags = [
"-fPIC", "-fPIC",
"-fno-stack-protector", "-fno-stack-protector",
...@@ -476,7 +432,7 @@ template("musl_libs") { ...@@ -476,7 +432,7 @@ template("musl_libs") {
} }
} }
source_set("${abi_prefix}_musl_hook") { source_set("soft_musl_hook") {
sources = [ sources = [
"./porting/linux/user/src/hook/malloc_common.c", "./porting/linux/user/src/hook/malloc_common.c",
"./porting/linux/user/src/hook/memory_tag.c", "./porting/linux/user/src/hook/memory_tag.c",
...@@ -503,11 +459,11 @@ template("musl_libs") { ...@@ -503,11 +459,11 @@ template("musl_libs") {
configs += [ configs += [
"//build/config/compiler:compiler", "//build/config/compiler:compiler",
":${abi_prefix}_hook", ":soft_hook",
] ]
} }
static_library("${abi_prefix}_libc_musl_static") { static_library("soft_libc_musl_static") {
output_name = "libc" output_name = "libc"
complete_static_lib = true complete_static_lib = true
...@@ -515,9 +471,9 @@ template("musl_libs") { ...@@ -515,9 +471,9 @@ template("musl_libs") {
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
deps = [ deps = [
":${abi_prefix}_musl_hook", ":soft_musl_hook",
":${abi_prefix}_musl_src", ":soft_musl_src",
":${abi_prefix}_musl_src_nossp", ":soft_musl_src_nossp",
] ]
deps += dfx_deps deps += dfx_deps
if (is_standard_system) { if (is_standard_system) {
...@@ -525,63 +481,63 @@ template("musl_libs") { ...@@ -525,63 +481,63 @@ template("musl_libs") {
} }
} }
static_library("${abi_prefix}_libm") { static_library("soft_libm") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libm" output_name = "libm"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_librt") { static_library("soft_librt") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "librt" output_name = "librt"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libpthread") { static_library("soft_libpthread") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libpthread" output_name = "libpthread"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libcrypt") { static_library("soft_libcrypt") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libcrypt" output_name = "libcrypt"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libutil") { static_library("soft_libutil") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libutil" output_name = "libutil"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libresolv") { static_library("soft_libresolv") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libresolv" output_name = "libresolv"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libxnet") { static_library("soft_libxnet") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libxnet" output_name = "libxnet"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
static_library("${abi_prefix}_libdl") { static_library("soft_libdl") {
complete_static_lib = true complete_static_lib = true
configs -= musl_inherited_configs configs -= musl_inherited_configs
output_name = "libdl" output_name = "libdl"
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
} }
shared_library("${abi_prefix}_libc_musl_shared") { shared_library("soft_libc_musl_shared") {
output_dir = "${target_out_dir}/${_libs_out_dir}" output_dir = "${target_out_dir}/${_libs_out_dir}"
output_name = "libc" output_name = "libc"
output_extension = "so" output_extension = "so"
...@@ -604,16 +560,16 @@ template("musl_libs") { ...@@ -604,16 +560,16 @@ template("musl_libs") {
configs -= musl_inherited_configs configs -= musl_inherited_configs
configs -= [ "//build/config:default_libs" ] configs -= [ "//build/config:default_libs" ]
configs += [ ":${abi_prefix}_musl_config" ] configs += [ ":soft_musl_config" ]
deps = [ deps = [
":${abi_prefix}_libdl", ":soft_libdl",
":${abi_prefix}_libpthread", ":soft_libpthread",
":${abi_prefix}_musl_crt_install_action", ":soft_musl_crt_install_action",
":${abi_prefix}_musl_hook", ":soft_musl_hook",
":${abi_prefix}_musl_ldso", ":soft_musl_ldso",
":${abi_prefix}_musl_src", ":soft_musl_src",
":${abi_prefix}_musl_src_nossp", ":soft_musl_src_nossp",
] ]
deps += dfx_deps deps += dfx_deps
if (is_standard_system) { if (is_standard_system) {
...@@ -621,15 +577,15 @@ template("musl_libs") { ...@@ -621,15 +577,15 @@ template("musl_libs") {
} }
} }
action_foreach("${abi_prefix}_musl_crt_install_action") { action_foreach("soft_musl_crt_install_action") {
redir = "${root_out_dir}/obj" redir = "${root_out_dir}/obj"
script = "${target_out_dir}/${musl_ported_dir}/scripts/install.py" script = "${target_out_dir}/${musl_ported_dir}/scripts/install.py"
sources = [ sources = [
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/${abi_prefix}_musl_crt/Scrt1.o", "${redir}/${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/soft_musl_crt/crti.o",
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/${abi_prefix}_musl_crt/crt1.o", "${redir}/${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/soft_musl_crt/crtn.o",
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/${abi_prefix}_musl_crt/rcrt1.o", "${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/Scrt1.o",
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/${abi_prefix}_musl_crt/crti.o", "${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/crt1.o",
"${redir}/${target_out_dir}/${musl_ported_dir}/crt/${musl_arch}/${abi_prefix}_musl_crt/crtn.o", "${redir}/${target_out_dir}/${musl_ported_dir}/crt/soft_musl_crt/rcrt1.o",
] ]
outputs = [ "${root_build_dir}/obj/third_party/musl/${_libs_out_dir}/{{source_file_part}}" ] outputs = [ "${root_build_dir}/obj/third_party/musl/${_libs_out_dir}/{{source_file_part}}" ]
args = [ args = [
...@@ -637,13 +593,13 @@ template("musl_libs") { ...@@ -637,13 +593,13 @@ template("musl_libs") {
"{{source}}", "{{source}}",
] ]
args += [ "--output" ] + rebase_path(outputs, root_build_dir) args += [ "--output" ] + rebase_path(outputs, root_build_dir)
deps = [ ":${abi_prefix}_musl_crt" ] deps = [ ":soft_musl_crt" ]
} }
copy("${abi_prefix}_create_linker") { copy("soft_create_linker") {
deps = [ ":${abi_prefix}_libc_musl_shared" ] deps = [ ":soft_libc_musl_shared" ]
# _libc_shared_outputs = get_target_outputs(":${abi_prefix}_libc_musl_shared") # _libc_shared_outputs = get_target_outputs(":soft_libc_musl_shared")
_libc_shared_so = "${target_out_dir}/${_libs_out_dir}/libc.so" _libc_shared_so = "${target_out_dir}/${_libs_out_dir}/libc.so"
sources = [ _libc_shared_so ] sources = [ _libc_shared_so ]
if (is_asan) { if (is_asan) {
...@@ -651,7 +607,7 @@ template("musl_libs") { ...@@ -651,7 +607,7 @@ template("musl_libs") {
} else { } else {
asan = "" asan = ""
} }
_muls_linker_so = "${root_out_dir}/common/common/libc/${_libs_path_prefix}/ld-musl-${musl_arch}${musl_subarch}${asan}.so.1" _muls_linker_so = "${root_out_dir}/common/common/libc/${_libs_path_prefix}/ld-musl-${musl_arch}${asan}.so.1"
outputs = [ _muls_linker_so ] outputs = [ _muls_linker_so ]
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册