summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yu Liu <yudiliu@google.com> 2023-12-12 23:07:33 +0000
committer Yu Liu <yudiliu@google.com> 2023-12-12 23:07:33 +0000
commitaa89f2c61bd69afe8022a1ceab9f00fdcdb2c0a2 (patch)
tree70c5bbd55e6fbd5133e25d415e2516ef97a4f91a
parentc1fb159206d583cb82884a411fa20afa1b67c3bd (diff)
Only link the profile extras lib for device variant.
Bug: 297082598 Test: CI Change-Id: I455b39119c27b45b368a80cab2901d496a250b96
-rw-r--r--cc/coverage.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/cc/coverage.go b/cc/coverage.go
index cbd8a6f3e..64d179070 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -68,7 +68,7 @@ func getClangProfileLibraryName(ctx ModuleContextIntf) string {
}
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
- if cov.Properties.NeedCoverageVariant {
+ if cov.Properties.NeedCoverageVariant && ctx.Device() {
ctx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
}, CoverageDepTag, getGcovProfileLibraryName(ctx))
@@ -161,19 +161,22 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
if gcovCoverage {
flags.Local.LdFlags = append(flags.Local.LdFlags, "--coverage")
- coverage := ctx.GetDirectDepWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
-
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,getenv")
+ if ctx.Device() {
+ coverage := ctx.GetDirectDepWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag).(*Module)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,getenv")
+ }
} else if clangCoverage {
flags.Local.LdFlags = append(flags.Local.LdFlags, profileInstrFlag)
if EnableContinuousCoverage(ctx) {
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm=-runtime-counter-relocation")
}
- coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
- deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
+ if ctx.Device() {
+ coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
+ deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
+ }
}
}
@@ -181,7 +184,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
}
func (cov *coverage) begin(ctx BaseModuleContext) {
- if ctx.Host() {
+ if ctx.Host() && !ctx.Os().Linux() {
// TODO(dwillemsen): because of -nodefaultlibs, we must depend on libclang_rt.profile-*.a
// Just turn off for now.
} else {