diff options
author | 2022-01-20 22:55:00 +0800 | |
---|---|---|
committer | 2022-01-21 18:13:18 +0800 | |
commit | 46c6e594159904beb55c2bd99293cf65635c9d15 (patch) | |
tree | 01db2d5f1650d65b147cc66b489e01d79584c257 /rust/rust.go | |
parent | 341f73550d698d32328c06f223c0d2a51dd53d8c (diff) |
AFDO for Rust
Bug: 195134194
Bug: 165018530
Test: build
Change-Id: I30932a22dc0b22716cdc925a3fcc5f9a169fcec4
Diffstat (limited to 'rust/rust.go')
-rw-r--r-- | rust/rust.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/rust/rust.go b/rust/rust.go index cba92c33f..0f7b76823 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -148,6 +148,7 @@ type Module struct { makeLinkType string + afdo *afdo compiler compiler coverage *coverage clippy *clippy @@ -403,6 +404,7 @@ type PathDeps struct { SharedLibDeps android.Paths StaticLibs android.Paths ProcMacros RustLibraries + AfdoProfiles android.Paths // depFlags and depLinkFlags are rustc and linker (clang) flags. depFlags []string @@ -551,6 +553,7 @@ func DefaultsFactory(props ...interface{}) android.Module { module.AddProperties(props...) module.AddProperties( &BaseProperties{}, + &cc.AfdoProperties{}, &cc.VendorProperties{}, &BenchmarkProperties{}, &BindgenProperties{}, @@ -688,6 +691,9 @@ func (mod *Module) Init() android.Module { mod.AddProperties(&mod.Properties) mod.AddProperties(&mod.VendorProperties) + if mod.afdo != nil { + mod.AddProperties(mod.afdo.props()...) + } if mod.compiler != nil { mod.AddProperties(mod.compiler.compilerProps()...) } @@ -719,6 +725,7 @@ func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) } func newModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { module := newBaseModule(hod, multilib) + module.afdo = &afdo{} module.coverage = &coverage{} module.clippy = &clippy{} module.sanitize = &sanitize{} @@ -856,6 +863,9 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { } // Calculate rustc flags + if mod.afdo != nil { + flags, deps = mod.afdo.flags(ctx, flags, deps) + } if mod.compiler != nil { flags = mod.compiler.compilerFlags(ctx, flags) flags = mod.compiler.cfgFlags(ctx, flags) |