Use zstd to compress debug info in cc libraries
We can save a significant amount of disk space by compressing
debug info in `lld` cc builds. This change configures a build
flag to instruct lld to compress debug info when building cc
libraries. Rather than adding a global config we add this to
each target individually to avoid linker failures on windows
cross build targets.
Test: m
Bug: 305277519
Change-Id: I4ab3d47fb0de7e31a39fb671cccde1acee3a2018
diff --git a/cc/config/arm_linux_host.go b/cc/config/arm_linux_host.go
index 525fb5d..e21c60d 100644
--- a/cc/config/arm_linux_host.go
+++ b/cc/config/arm_linux_host.go
@@ -27,16 +27,24 @@
"-march=armv7a",
}
+ linuxArmLldflags = append(linuxArmLdflags,
+ "-Wl,--compress-debug-sections=zstd",
+ )
+
linuxArm64Ldflags = []string{}
+
+ linuxArm64Lldflags = append(linuxArm64Ldflags,
+ "-Wl,--compress-debug-sections=zstd",
+ )
)
func init() {
exportedVars.ExportStringListStaticVariable("LinuxArmCflags", linuxArmCflags)
exportedVars.ExportStringListStaticVariable("LinuxArm64Cflags", linuxArm64Cflags)
exportedVars.ExportStringListStaticVariable("LinuxArmLdflags", linuxArmLdflags)
- exportedVars.ExportStringListStaticVariable("LinuxArmLldflags", linuxArmLdflags)
+ exportedVars.ExportStringListStaticVariable("LinuxArmLldflags", linuxArmLldflags)
exportedVars.ExportStringListStaticVariable("LinuxArm64Ldflags", linuxArm64Ldflags)
- exportedVars.ExportStringListStaticVariable("LinuxArm64Lldflags", linuxArm64Ldflags)
+ exportedVars.ExportStringListStaticVariable("LinuxArm64Lldflags", linuxArm64Lldflags)
exportedVars.ExportStringListStaticVariable("LinuxArmYasmFlags", []string{"-f elf32 -m arm"})
exportedVars.ExportStringListStaticVariable("LinuxArm64YasmFlags", []string{"-f elf64 -m aarch64"})