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
This commit is contained in:
Eric Rahm
2023-10-17 19:40:53 +00:00
parent fa0dff576b
commit f52906f194
5 changed files with 28 additions and 5 deletions

View File

@@ -53,6 +53,10 @@ var (
"--gcc-toolchain=${LinuxBionicGccRoot}",
}
linuxBionicLldflags = append(linuxBionicLdflags,
"-Wl,--compress-debug-sections=zstd",
)
// Embed the linker into host bionic binaries. This is needed to support host bionic,
// as the linux kernel requires that the ELF interpreter referenced by PT_INTERP be
// either an absolute path, or relative from CWD. To work around this, we extract
@@ -71,7 +75,7 @@ const (
func init() {
exportedVars.ExportStringListStaticVariable("LinuxBionicCflags", linuxBionicCflags)
exportedVars.ExportStringListStaticVariable("LinuxBionicLdflags", linuxBionicLdflags)
exportedVars.ExportStringListStaticVariable("LinuxBionicLldflags", linuxBionicLdflags)
exportedVars.ExportStringListStaticVariable("LinuxBionicLldflags", linuxBionicLldflags)
// Use the device gcc toolchain for now
exportedVars.ExportStringStaticVariable("LinuxBionicGccVersion", x86_64GccVersion)