Turn on Unique Internal Names for AFDO
AutoFDO uses a function’s symbol name to look up profile data but
functions with internal linkages do not have globally unique
identifiers. This can lead to name conflicts leading to missing profiles
and performance. We are enabling compiler option
-funique-internal-linkage-names for AFDO builds that will uniquefy
internal linkage symbols making this problem go away.
This CL might regress the performance due to mismatched profiles. It
will recover once we update the profiles.
Test: presubmit
Bug: 218448389
Change-Id: I92a2b6f72b52faab79aec9148f1962111bad7232
diff --git a/cc/afdo.go b/cc/afdo.go
index d7cce77..c888213 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -32,7 +32,7 @@
var afdoProfileProjectsConfigKey = android.NewOnceKey("AfdoProfileProjects")
-const afdoCFlagsFormat = "-fprofile-sample-accurate -fprofile-sample-use=%s"
+const afdoCFlagsFormat = "-funique-internal-linkage-names -fprofile-sample-accurate -fprofile-sample-use=%s"
func getAfdoProfileProjects(config android.DeviceConfig) []string {
return config.OnceStringSlice(afdoProfileProjectsConfigKey, func() []string {