Optimize binary size of syscall tables
The syscall tables were implemented as an array of const char*
strings. Each of them required a relocation entry of 8 bytes each,
wasting both binary size and dirty memory at load time.
This CL stores the syscall table as a single string (per table)
separating each syscall with a \0, and an array of offsets into that
string.
On the standalone arm64 release build this saves
File size:
-65KB (before:1,034,864 after:969,328)
ELF sections:
.rela.dyn before:0x022d58 after:0x016f38 = -48K
.rodata before:0x00e34f after:0x00f36f = +4KB
.data.rel.ro before:0x015bf8 after:0x011c98 = -16KB
Bug: 321830256
Change-Id: I555588166b93053322448b962d52e2f4fdbff219
diff --git a/Android.bp b/Android.bp
index 2f1dc27..1577cdc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -9918,6 +9918,14 @@
],
}
+// GN: //src/kernel_utils:unittests
+filegroup {
+ name: "perfetto_src_kernel_utils_unittests",
+ srcs: [
+ "src/kernel_utils/syscall_table_unittest.cc",
+ ],
+}
+
// GN: //src/perfetto_cmd:bugreport_path
filegroup {
name: "perfetto_src_perfetto_cmd_bugreport_path",
@@ -13494,6 +13502,7 @@
":perfetto_src_kallsyms_kallsyms",
":perfetto_src_kallsyms_unittests",
":perfetto_src_kernel_utils_syscall_table",
+ ":perfetto_src_kernel_utils_unittests",
":perfetto_src_perfetto_cmd_bugreport_path",
":perfetto_src_perfetto_cmd_pbtxt_to_pb",
":perfetto_src_perfetto_cmd_perfetto_cmd",