diff --git a/BUILD.gn b/BUILD.gn index eff000e8..05b5e3e9 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -34,6 +34,18 @@ config("iptables_config") { "-DNO_SHARED_LIBS=1", "-DALL_INCLUSIVE", "-DXTABLES_INTERNAL", + "-Oz", + "-fdata-sections", + "-ffunction-sections", + "-fvisibility=hidden", + ] + cflags_cc = [ + "-fvisibility=hidden", + "-fvisibility-inlines-hidden", + ] + ldflags = [ + "-Wl,--exclude-libs=ALL", + "-Wl,--gc-sections", ] } @@ -72,85 +84,13 @@ ohos_executable("iptables") { "//third_party/iptables/libxtables:libxtables", ] - symlink_target_name = [ "ip6tables" ] - part_name = "iptables" - subsystem_name = "thirdparty" -} - -ohos_executable("iptables-save") { - branch_protector_ret = "pac_ret" - sources = [ - "//third_party/iptables/iptables/ip6tables-standalone.c", - "//third_party/iptables/iptables/ip6tables.c", - "//third_party/iptables/iptables/iptables-restore.c", - "//third_party/iptables/iptables/iptables-save.c", - "//third_party/iptables/iptables/iptables-standalone.c", - "//third_party/iptables/iptables/iptables-xml.c", - "//third_party/iptables/iptables/iptables.c", - "//third_party/iptables/iptables/xshared.c", - "//third_party/iptables/iptables/xtables-legacy-multi.c", - ] - - include_dirs = [ - "//third_party/iptables", - "//third_party/iptables/extensions", - "//third_party/iptables/include", - "//third_party/iptables/iptables", - "//third_party/iptables/libiptc", - ] - configs = [ ":iptables_config" ] - - install_enable = true - - deps = [ - "//third_party/iptables/extensions:libext", - "//third_party/iptables/extensions:libext4", - "//third_party/iptables/extensions:libext6", - "//third_party/iptables/libiptc:libip4tc", - "//third_party/iptables/libiptc:libip6tc", - "//third_party/iptables/libxtables:libxtables", - ] - - symlink_target_name = [ "ip6tables-save" ] - part_name = "iptables" - subsystem_name = "thirdparty" -} - -ohos_executable("iptables-restore") { - branch_protector_ret = "pac_ret" - sources = [ - "//third_party/iptables/iptables/ip6tables-standalone.c", - "//third_party/iptables/iptables/ip6tables.c", - "//third_party/iptables/iptables/iptables-restore.c", - "//third_party/iptables/iptables/iptables-save.c", - "//third_party/iptables/iptables/iptables-standalone.c", - "//third_party/iptables/iptables/iptables-xml.c", - "//third_party/iptables/iptables/iptables.c", - "//third_party/iptables/iptables/xshared.c", - "//third_party/iptables/iptables/xtables-legacy-multi.c", - ] - - include_dirs = [ - "//third_party/iptables", - "//third_party/iptables/extensions", - "//third_party/iptables/include", - "//third_party/iptables/iptables", - "//third_party/iptables/libiptc", - ] - configs = [ ":iptables_config" ] - - install_enable = true - - deps = [ - "//third_party/iptables/extensions:libext", - "//third_party/iptables/extensions:libext4", - "//third_party/iptables/extensions:libext6", - "//third_party/iptables/libiptc:libip4tc", - "//third_party/iptables/libiptc:libip6tc", - "//third_party/iptables/libxtables:libxtables", - ] - - symlink_target_name = [ "ip6tables-restore" ] + symlink_target_name = [ + "ip6tables", + "ip6tables-restore", + "ip6tables-save", + "iptables-restore", + "iptables-save", + ] part_name = "iptables" subsystem_name = "thirdparty" } diff --git a/bundle.json b/bundle.json index 319ec283..469dfb7e 100644 --- a/bundle.json +++ b/bundle.json @@ -26,33 +26,13 @@ }, "build": { "sub_component": [ - "//third_party/iptables:iptables", - "//third_party/iptables:iptables-restore", - "//third_party/iptables:iptables-save" + "//third_party/iptables:iptables" ], "inner_kits": [ - { - "name": "//third_party/iptables:iptables", - "header": { - "header_files": [], - "header_base": "//third_party/iptables/include" - } - }, { - "name": "//third_party/iptables:iptables-restore", - "header": { - "header_files": [], - "header_base": "//third_party/iptables/include" - } - }, - { - "name": "//third_party/iptables:iptables-save", - "header": { - "header_files": [], - "header_base": "//third_party/iptables/include" - } + "name":"//third_party/iptables:iptables" } - ], + ], "test": [] } } diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index 9c5f1476..ca691750 100755 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -32,6 +32,9 @@ config("ext_config") { "-Wno-missing-field-initializers", "-Wno-pointer-bool-conversion", "-Wno-tautological-pointer-compare", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] } @@ -180,6 +183,9 @@ ohos_static_library("libext4") { "-Wno-missing-field-initializers", "-Wno-pointer-bool-conversion", "-Wno-tautological-pointer-compare", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] deps = [] part_name = "iptables" @@ -242,6 +248,9 @@ ohos_static_library("libext6") { "-Wno-missing-field-initializers", "-Wno-pointer-bool-conversion", "-Wno-tautological-pointer-compare", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] deps = [] part_name = "iptables" diff --git a/libiptc/BUILD.gn b/libiptc/BUILD.gn index ea05cb64..abb5dab5 100755 --- a/libiptc/BUILD.gn +++ b/libiptc/BUILD.gn @@ -36,6 +36,9 @@ ohos_static_library("libip4tc") { "-Wno-unused-parameter", "-Wno-pointer-sign", "-Wno-unused-function", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] deps = [] @@ -67,6 +70,9 @@ ohos_static_library("libip6tc") { "-Wno-unused-parameter", "-Wno-pointer-sign", "-Wno-unused-function", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] deps = [] diff --git a/libxtables/BUILD.gn b/libxtables/BUILD.gn index 7ca79da1..c194bb03 100755 --- a/libxtables/BUILD.gn +++ b/libxtables/BUILD.gn @@ -44,6 +44,9 @@ ohos_static_library("libxtables") { "-DXTABLES_INTERNAL", "-DXTABLES_LIBDIR=\"xtables_libdir_not_used\"", "-Wno-missing-field-initializers", + "-Oz", + "-fdata-sections", + "-ffunction-sections", ] deps = []