Enable ICF=safe for host binaries as well

We regressed binary size when we switch Darwin to use LLD, because
Darwin LD64 does ICF by default. Turn on ICF for host binaries to regain
the binary size savings (saves some space for Linux as well).

Test: presubmit
Bug: 236924555
Change-Id: I433062c3d263d69e431c1552faf1f18b13c5da42
This commit is contained in:
Yi Kong
2022-10-20 14:45:52 +09:00
parent 230c57af16
commit a9e1df1522

View File

@@ -150,6 +150,11 @@ var (
"-fdebug-info-for-profiling",
}
commonGlobalLldflags = []string{
"-fuse-ld=lld",
"-Wl,--icf=safe",
}
deviceGlobalCppflags = []string{
"-fvisibility-inlines-hidden",
}
@@ -167,13 +172,9 @@ var (
"-Wl,--exclude-libs,libgcc_stripped.a",
"-Wl,--exclude-libs,libunwind_llvm.a",
"-Wl,--exclude-libs,libunwind.a",
"-Wl,--icf=safe",
}
deviceGlobalLldflags = append(deviceGlobalLdflags,
[]string{
"-fuse-ld=lld",
}...)
deviceGlobalLldflags = append(deviceGlobalLdflags, commonGlobalLldflags...)
hostGlobalCflags = []string{}
@@ -181,7 +182,7 @@ var (
hostGlobalLdflags = []string{}
hostGlobalLldflags = []string{"-fuse-ld=lld"}
hostGlobalLldflags = commonGlobalLldflags
commonGlobalCppflags = []string{
"-Wsign-promo",