Use a version script for libaconfig_storage_read_api_cc
Restrict the set of exported symbols to those in the aconfig_storage
namespace by way of a version script. This shrinks the shared lib size
by ~75%, from ~800KB to <200KB.
Bug: 336657207
Test: m
Change-Id: I56044fe667a713cf1d94f96c992f379a5725850f
diff --git a/tools/aconfig/aconfig_storage_read_api/Android.bp b/tools/aconfig/aconfig_storage_read_api/Android.bp
index 946c00b..880d8cc 100644
--- a/tools/aconfig/aconfig_storage_read_api/Android.bp
+++ b/tools/aconfig/aconfig_storage_read_api/Android.bp
@@ -102,8 +102,6 @@
"//apex_available:anyapex",
],
min_sdk_version: "29",
+ version_script: "libaconfig_storage_read_api_cc.map",
double_loadable: true,
- cflags: [
- "-fvisibility=hidden",
- ],
}
diff --git a/tools/aconfig/aconfig_storage_read_api/libaconfig_storage_read_api_cc.map b/tools/aconfig/aconfig_storage_read_api/libaconfig_storage_read_api_cc.map
new file mode 100644
index 0000000..7d47e0b
--- /dev/null
+++ b/tools/aconfig/aconfig_storage_read_api/libaconfig_storage_read_api_cc.map
@@ -0,0 +1,11 @@
+LIBACONFIG_STORAGE_READ_API_CC {
+ # Export everything in the aconfig_storage namespace. This includes both the
+ # public API and library internals.
+ global:
+ extern "C++" {
+ aconfig_storage::*;
+ };
+ # Hide everything else.
+ local:
+ *;
+};