openharmony libc.s remove lto

https://gitee.com/open_harmony/dashboard?issue_id=I98MT5
Signed-off-by: xwx1135370 <xuyao44@huawei.com>
This commit is contained in:
xwx1135370 2024-10-18 09:05:17 +08:00
parent d825ffb556
commit c786749018
2 changed files with 142 additions and 101 deletions

View File

@ -187,6 +187,14 @@
"name": "//base/startup/init/services/param/base:parameterbase", "name": "//base/startup/init/services/param/base:parameterbase",
"visibility": [ "musl" ] "visibility": [ "musl" ]
}, },
{
"header": {
"header_base": "//base/startup/init/services/param/base",
"header_files": []
},
"name": "//base/startup/init/services/param/base:parameterbase_noflto",
"visibility": [ "musl" ]
},
{ {
"name": "//base/startup/init/interfaces/kits/syscap_ts:syscap_ts" "name": "//base/startup/init/interfaces/kits/syscap_ts:syscap_ts"
} }

View File

@ -45,115 +45,148 @@ base_include_dirs = [
"//base/startup/init/services/loopevent/include", "//base/startup/init/services/loopevent/include",
] ]
if (defined(ohos_lite)) { declare_args() {
static_library("parameterbase") { parameterbase_use_flto = false
cflags = [ "-fPIC" ] }
if (ohos_kernel_type == "liteos_m") {
sources = []
not_needed([ "comm_sources" ])
} else {
sources = comm_sources
sources += [
"//base/startup/init/services/log/init_commlog.c",
"//base/startup/init/services/param/base/param_base.c",
]
}
include_dirs = base_include_dirs
external_deps = [ "bounds_checking_function:libsec_static" ]
defines = [ "_GNU_SOURCE" ]
public_configs = [ ":exported_header_files" ]
public_configs += [ ":exported_header_files_for_lite" ]
if (ohos_kernel_type == "linux") { template("lib_parameterbase_template") {
sources += [ __use_flto = invoker.parameterbase_use_flto
"//base/startup/init/services/param/adapter/param_dac.c", if (defined(ohos_lite)) {
"//base/startup/init/services/param/linux/param_osadp.c", static_library(target_name) {
] cflags = [ "-fPIC" ]
defines += [ "__LINUX__" ] if (!__use_flto) {
} else if (ohos_kernel_type == "liteos_a") { cflags_c = [ "-fno-lto" ]
sources += [ }
"//base/startup/init/services/param/liteos/param_litedac.c", if (ohos_kernel_type == "liteos_m") {
"//base/startup/init/services/param/liteos/param_osadp.c", sources = []
] not_needed([ "comm_sources" ])
defines += [ } else {
"__LITEOS_A__", sources = comm_sources
"WORKSPACE_AREA_NEED_MUTEX", sources += [
"PARAM_PERSIST_SAVE_MUTEX", "//base/startup/init/services/log/init_commlog.c",
"PARAMWORKSPACE_NEED_MUTEX", "//base/startup/init/services/param/base/param_base.c",
] ]
} }
if (defined(init_lite_memory_size)) { include_dirs = base_include_dirs
defines += [ "PARAM_WORKSPACE_MAX=${init_lite_memory_size}" ] external_deps = [ "bounds_checking_function:libsec_static" ]
} defines = [ "_GNU_SOURCE" ]
} public_configs = [ ":exported_header_files" ]
} else { public_configs += [ ":exported_header_files_for_lite" ]
if (!startup_init_with_param_base) {
inherited_configs = [
"//build/config/compiler:afdo",
"//build/config/compiler:afdo_optimize_size",
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:compiler_arm_thumb",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
"//build/config/compiler:default_optimization",
"//build/config/compiler:default_stack_frames",
"//build/config/compiler:default_symbols",
"//build/config/compiler:export_dynamic",
"//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
"//build/config/sanitizers:default_sanitizer_flags",
]
}
ohos_static_library("parameterbase") { if (ohos_kernel_type == "linux") {
sources = comm_sources sources += [
sources += [ "//base/startup/init/services/param/adapter/param_dac.c",
"//base/startup/init/services/param/adapter/param_dac.c", "//base/startup/init/services/param/linux/param_osadp.c",
"//base/startup/init/services/param/base/param_base.c", ]
"//base/startup/init/services/param/linux/param_osadp.c", defines += [ "__LINUX__" ]
] } else if (ohos_kernel_type == "liteos_a") {
cflags = [ "-fPIC" ] sources += [
include_dirs = base_include_dirs "//base/startup/init/services/param/liteos/param_litedac.c",
public_configs = [ ":exported_header_files" ] "//base/startup/init/services/param/liteos/param_osadp.c",
defines = [ "_GNU_SOURCE" ] ]
deps = [] defines += [
external_deps = [] "__LITEOS_A__",
"WORKSPACE_AREA_NEED_MUTEX",
if (startup_init_feature_decode_group_file) { "PARAM_PERSIST_SAVE_MUTEX",
defines += [ "PARAM_DECODE_GROUPID_FROM_FILE" ] "PARAMWORKSPACE_NEED_MUTEX",
} ]
if (use_musl) { }
defines += [ "__MUSL__" ] if (defined(init_lite_memory_size)) {
} defines += [ "PARAM_WORKSPACE_MAX=${init_lite_memory_size}" ]
}
if (startup_init_test_performance) {
defines += [ "PARAM_TEST_PERFORMANCE" ]
} }
} else {
if (!startup_init_with_param_base) { if (!startup_init_with_param_base) {
ldflags = [ "-nostdlib" ] inherited_configs = [
remove_configs = inherited_configs "//build/config/compiler:afdo",
defines += [ "PARAM_BASE" ] "//build/config/compiler:afdo_optimize_size",
} else { "//build/config/compiler:compiler_arm_fpu",
sources += [ "//base/startup/init/services/log/init_commlog.c" ] "//build/config/compiler:compiler_arm_thumb",
external_deps += [ "bounds_checking_function:libsec_shared" ] "//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
"//build/config/compiler:default_optimization",
"//build/config/compiler:default_stack_frames",
"//build/config/compiler:default_symbols",
"//build/config/compiler:export_dynamic",
"//build/config/compiler:no_exceptions",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
"//build/config/sanitizers:default_sanitizer_flags",
]
} }
if (build_selinux) { if (build_selinux) {
sources += if (target_name == "") {
[ "//base/startup/init/services/param/adapter/param_selinux.c" ] selinux_parameter_external_deps =
defines += [ [ "selinux_adapter:libselinux_parameter_static" ]
"PARAM_SUPPORT_SELINUX", } else {
"PARAMWORKSPACE_NEED_MUTEX", selinux_parameter_external_deps =
] [ "selinux_adapter:libselinux_parameter_static_noflto" ]
external_deps += [ "selinux_adapter:libselinux_parameter_static" ] }
} }
if (param_base_log) {
defines += [ "PARAM_BASE_LOG" ]
}
part_name = "init"
subsystem_name = "startup"
}
ohos_static_library(target_name) {
sources = comm_sources
sources += [
"//base/startup/init/services/param/adapter/param_dac.c",
"//base/startup/init/services/param/base/param_base.c",
"//base/startup/init/services/param/linux/param_osadp.c",
]
cflags = [ "-fPIC" ]
if (!__use_flto) {
cflags_c = [ "-fno-lto" ]
}
include_dirs = base_include_dirs
public_configs = [ ":exported_header_files" ]
defines = [ "_GNU_SOURCE" ]
deps = []
external_deps = []
if (startup_init_feature_decode_group_file) {
defines += [ "PARAM_DECODE_GROUPID_FROM_FILE" ]
}
if (use_musl) {
defines += [ "__MUSL__" ]
}
if (startup_init_test_performance) {
defines += [ "PARAM_TEST_PERFORMANCE" ]
}
if (!startup_init_with_param_base) {
ldflags = [ "-nostdlib" ]
remove_configs = inherited_configs
defines += [ "PARAM_BASE" ]
} else {
sources += [ "//base/startup/init/services/log/init_commlog.c" ]
external_deps += [ "bounds_checking_function:libsec_shared" ]
}
if (build_selinux) {
sources +=
[ "//base/startup/init/services/param/adapter/param_selinux.c" ]
defines += [
"PARAM_SUPPORT_SELINUX",
"PARAMWORKSPACE_NEED_MUTEX",
]
external_deps += selinux_parameter_external_deps
}
if (param_base_log) {
defines += [ "PARAM_BASE_LOG" ]
}
part_name = "init"
subsystem_name = "startup"
}
}
}
lib_parameterbase_template("parameterbase") {
parameterbase_use_flto = true
}
lib_parameterbase_template("parameterbase_noflto") {
parameterbase_use_flto = false
}
if (!defined(ohos_lite)) {
# extend for base # extend for base
ohos_static_library("parameterbase_ext") { ohos_static_library("parameterbase_ext") {
sources = comm_sources sources = comm_sources