From 1566984f2e96255104b5d5271123112af6b5f49c Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 11:32:33 +0800 Subject: [PATCH 1/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 20 +++++++++++++++----- frameworks/native/BUILD.gn | 17 ++++++++++++----- services/BUILD.gn | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index 296049b..f7cd6db 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -33,15 +33,25 @@ config("client_public_config") { ohos_shared_library("concurrent_task_client") { branch_protector_ret = "pac_ret" - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } + configs = [ ":client_private_config" ] public_configs = [ ":client_public_config" ] + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] + + ldflags = ["-Wl,--exclude-libs=ALL"] + sources = [ "src/concurrent_task_client.cpp", "src/concurrent_task_service_proxy.cpp", diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index 77ad594..3a1a0d7 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -16,11 +16,18 @@ import("//build/ohos/ndk/ndk.gni") ohos_shared_library("qos_ndk") { branch_protector_ret = "pac_ret" - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } + + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] include_dirs = [ "../../interfaces/", diff --git a/services/BUILD.gn b/services/BUILD.gn index a1c0564..b2c26e7 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -35,8 +35,25 @@ ohos_shared_library("concurrentsvc") { sanitize = { cfi = true cfi_cross_dso = true + cfi_no_nvcall = true + cfi_vcall_ical_only = true debug = false } + + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] + + ldflags = ["-Wl,--exclude-libs=ALL"] + sources = [ "../common/src/config_reader.cpp", "src/concurrent_task_controller.cpp", -- Gitee From 7ca515ceb6fc7f99b8ea15c3aa06949bd1e0ab6b Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 11:32:33 +0800 Subject: [PATCH 2/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 20 +++++++++++++++----- frameworks/native/BUILD.gn | 17 ++++++++++++----- qos/BUILD.gn | 16 +++++++++++----- services/BUILD.gn | 17 +++++++++++++++++ 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index 296049b..f7cd6db 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -33,15 +33,25 @@ config("client_public_config") { ohos_shared_library("concurrent_task_client") { branch_protector_ret = "pac_ret" - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } + configs = [ ":client_private_config" ] public_configs = [ ":client_public_config" ] + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] + + ldflags = ["-Wl,--exclude-libs=ALL"] + sources = [ "src/concurrent_task_client.cpp", "src/concurrent_task_service_proxy.cpp", diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index 77ad594..a2c70e5 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -16,11 +16,18 @@ import("//build/ohos/ndk/ndk.gni") ohos_shared_library("qos_ndk") { branch_protector_ret = "pac_ret" - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } + + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] include_dirs = [ "../../interfaces/", diff --git a/qos/BUILD.gn b/qos/BUILD.gn index b6ee066..06f2dd2 100644 --- a/qos/BUILD.gn +++ b/qos/BUILD.gn @@ -24,12 +24,18 @@ config("qos_config") { ohos_shared_library("qos") { branch_protector_ret = "pac_ret" - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] public_configs = [ ":qos_config" ] sources = [ "../services/src/qos_interface.cpp", diff --git a/services/BUILD.gn b/services/BUILD.gn index a1c0564..b2c26e7 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -35,8 +35,25 @@ ohos_shared_library("concurrentsvc") { sanitize = { cfi = true cfi_cross_dso = true + cfi_no_nvcall = true + cfi_vcall_ical_only = true debug = false } + + cflags_cc = [ + "-fomit-frame-pointer", + "-fdata-sections", + "-ffunction-sections", + "fno-unroll-loops", + "-fno-exceptions", + "-fno-unwind-tables", + "-fno-asynchronous-unwind-tables", + "-g0", + "-Os" + ] + + ldflags = ["-Wl,--exclude-libs=ALL"] + sources = [ "../common/src/config_reader.cpp", "src/concurrent_task_controller.cpp", -- Gitee From 4f73a7933d996b87eb2b4554705508f6af027d68 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 12:04:36 +0800 Subject: [PATCH 3/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 1 - frameworks/native/BUILD.gn | 1 - services/BUILD.gn | 1 - 3 files changed, 3 deletions(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index f7cd6db..9e24672 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -51,7 +51,6 @@ ohos_shared_library("concurrent_task_client") { ] ldflags = ["-Wl,--exclude-libs=ALL"] - sources = [ "src/concurrent_task_client.cpp", "src/concurrent_task_service_proxy.cpp", diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index a2c70e5..5a3e692 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -28,7 +28,6 @@ ohos_shared_library("qos_ndk") { "-g0", "-Os" ] - include_dirs = [ "../../interfaces/", "../../interfaces/kits/c/", diff --git a/services/BUILD.gn b/services/BUILD.gn index b2c26e7..9ae5cea 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -53,7 +53,6 @@ ohos_shared_library("concurrentsvc") { ] ldflags = ["-Wl,--exclude-libs=ALL"] - sources = [ "../common/src/config_reader.cpp", "src/concurrent_task_controller.cpp", -- Gitee From 17f06180c5dc341e1328a9a0f4252f1b9ed3d8cc Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 13:42:28 +0800 Subject: [PATCH 4/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 2 +- frameworks/native/BUILD.gn | 2 +- qos/BUILD.gn | 2 +- services/BUILD.gn | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index 9e24672..e0e99c3 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -42,7 +42,7 @@ ohos_shared_library("concurrent_task_client") { "-fomit-frame-pointer", "-fdata-sections", "-ffunction-sections", - "fno-unroll-loops", + "-fno-unroll-loops", "-fno-exceptions", "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index 5a3e692..4a492fc 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -21,7 +21,7 @@ ohos_shared_library("qos_ndk") { "-fomit-frame-pointer", "-fdata-sections", "-ffunction-sections", - "fno-unroll-loops", + "-fno-unroll-loops", "-fno-exceptions", "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", diff --git a/qos/BUILD.gn b/qos/BUILD.gn index 06f2dd2..0a2cc86 100644 --- a/qos/BUILD.gn +++ b/qos/BUILD.gn @@ -29,7 +29,7 @@ ohos_shared_library("qos") { "-fomit-frame-pointer", "-fdata-sections", "-ffunction-sections", - "fno-unroll-loops", + "-fno-unroll-loops", "-fno-exceptions", "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", diff --git a/services/BUILD.gn b/services/BUILD.gn index 9ae5cea..9b1c7e5 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -44,7 +44,7 @@ ohos_shared_library("concurrentsvc") { "-fomit-frame-pointer", "-fdata-sections", "-ffunction-sections", - "fno-unroll-loops", + "-fno-unroll-loops", "-fno-exceptions", "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", -- Gitee From bd0596fd77cc992de864bd841916d9c6b56104cf Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 13:43:54 +0800 Subject: [PATCH 5/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index e0e99c3..42733cd 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -33,7 +33,6 @@ config("client_public_config") { ohos_shared_library("concurrent_task_client") { branch_protector_ret = "pac_ret" - configs = [ ":client_private_config" ] public_configs = [ ":client_public_config" ] -- Gitee From 178ece95c671c100071b0af5c3b89fb0ab709812 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Thu, 4 Jul 2024 15:47:03 +0800 Subject: [PATCH 6/6] opt rom size Signed-off-by: liuyuxiu --- frameworks/concurrent_task_client/BUILD.gn | 4 ++-- frameworks/native/BUILD.gn | 2 +- qos/BUILD.gn | 2 +- services/BUILD.gn | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/concurrent_task_client/BUILD.gn b/frameworks/concurrent_task_client/BUILD.gn index 42733cd..25358c3 100644 --- a/frameworks/concurrent_task_client/BUILD.gn +++ b/frameworks/concurrent_task_client/BUILD.gn @@ -46,10 +46,10 @@ ohos_shared_library("concurrent_task_client") { "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", "-g0", - "-Os" + "-Os", ] - ldflags = ["-Wl,--exclude-libs=ALL"] + ldflags = [ "-Wl,--exclude-libs=ALL" ] sources = [ "src/concurrent_task_client.cpp", "src/concurrent_task_service_proxy.cpp", diff --git a/frameworks/native/BUILD.gn b/frameworks/native/BUILD.gn index 4a492fc..2c62418 100644 --- a/frameworks/native/BUILD.gn +++ b/frameworks/native/BUILD.gn @@ -26,7 +26,7 @@ ohos_shared_library("qos_ndk") { "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", "-g0", - "-Os" + "-Os", ] include_dirs = [ "../../interfaces/", diff --git a/qos/BUILD.gn b/qos/BUILD.gn index 0a2cc86..8372df9 100644 --- a/qos/BUILD.gn +++ b/qos/BUILD.gn @@ -34,7 +34,7 @@ ohos_shared_library("qos") { "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", "-g0", - "-Os" + "-Os", ] public_configs = [ ":qos_config" ] sources = [ diff --git a/services/BUILD.gn b/services/BUILD.gn index 9b1c7e5..21036d9 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -49,10 +49,10 @@ ohos_shared_library("concurrentsvc") { "-fno-unwind-tables", "-fno-asynchronous-unwind-tables", "-g0", - "-Os" + "-Os", ] - ldflags = ["-Wl,--exclude-libs=ALL"] + ldflags = [ "-Wl,--exclude-libs=ALL" ] sources = [ "../common/src/config_reader.cpp", "src/concurrent_task_controller.cpp", -- Gitee