summaryrefslogtreecommitdiff
path: root/cc/afdo.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2024-02-07 15:09:08 -0800
committer Colin Cross <ccross@android.com> 2024-02-07 15:49:47 -0800
commit15fa8145609d358e27f4bcfefffb64eb33c06f00 (patch)
tree0eb82a670aa0595752648263780ee0a8f640216b /cc/afdo.go
parentda4c89f750be870d6b1e507afb31a5bf9265e9cd (diff)
Disable more of AFDO for host modules
afdo.addDep would never add a depencency on a profile for a host module, but afdoDepsMutator would still propagate AfdoRDeps to dependencies, afdoMutator would still create afdo variants, and afdo.flags would still add the -funique-internal-linkage-names flag. Exit early from all of these functions, since the afdo variations will never be useful. Test: afdo_test.go Change-Id: I255fcbb86c99871916e571fbc74075d918b24745
Diffstat (limited to 'cc/afdo.go')
-rw-r--r--cc/afdo.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/cc/afdo.go b/cc/afdo.go
index 79fbae157..6cc17467d 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -68,6 +68,10 @@ func (afdo *afdo) afdoEnabled() bool {
}
func (afdo *afdo) flags(ctx ModuleContext, flags Flags) Flags {
+ if ctx.Host() {
+ return flags
+ }
+
if afdo.Properties.Afdo {
// We use `-funique-internal-linkage-names` to associate profiles to the right internal
// functions. This option should be used before generating a profile. Because a profile
@@ -147,6 +151,10 @@ var _ FdoProfileMutatorInterface = (*Module)(nil)
// Propagate afdo requirements down from binaries and shared libraries
func afdoDepsMutator(mctx android.TopDownMutatorContext) {
+ if mctx.Host() {
+ return
+ }
+
if m, ok := mctx.Module().(*Module); ok && m.afdo.afdoEnabled() {
path := m.afdo.Properties.FdoProfilePath
mctx.WalkDeps(func(dep android.Module, parent android.Module) bool {
@@ -181,6 +189,10 @@ func afdoDepsMutator(mctx android.TopDownMutatorContext) {
// Create afdo variants for modules that need them
func afdoMutator(mctx android.BottomUpMutatorContext) {
+ if mctx.Host() {
+ return
+ }
+
if m, ok := mctx.Module().(*Module); ok && m.afdo != nil {
if !m.static() && m.afdo.Properties.Afdo {
mctx.SetDependencyVariation(encodeTarget(m.Name()))