Merge "Only link the profile extras lib for device variant." into main
This commit is contained in:
commit
b882375fe0
1 changed files with 12 additions and 9 deletions
|
@ -91,7 +91,7 @@ func getClangProfileLibraryName(ctx ModuleContextIntf) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
|
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
|
||||||
if cov.Properties.NeedCoverageVariant {
|
if cov.Properties.NeedCoverageVariant && ctx.Device() {
|
||||||
ctx.AddVariationDependencies([]blueprint.Variation{
|
ctx.AddVariationDependencies([]blueprint.Variation{
|
||||||
{Mutator: "link", Variation: "static"},
|
{Mutator: "link", Variation: "static"},
|
||||||
}, CoverageDepTag, getGcovProfileLibraryName(ctx))
|
}, CoverageDepTag, getGcovProfileLibraryName(ctx))
|
||||||
|
@ -184,19 +184,22 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
|
||||||
if gcovCoverage {
|
if gcovCoverage {
|
||||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "--coverage")
|
flags.Local.LdFlags = append(flags.Local.LdFlags, "--coverage")
|
||||||
|
|
||||||
coverage := ctx.GetDirectDepWithTag(getGcovProfileLibraryName(ctx), CoverageDepTag).(*Module)
|
if ctx.Device() {
|
||||||
deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
|
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")
|
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,getenv")
|
||||||
|
}
|
||||||
} else if clangCoverage {
|
} else if clangCoverage {
|
||||||
flags.Local.LdFlags = append(flags.Local.LdFlags, profileInstrFlag)
|
flags.Local.LdFlags = append(flags.Local.LdFlags, profileInstrFlag)
|
||||||
if EnableContinuousCoverage(ctx) {
|
if EnableContinuousCoverage(ctx) {
|
||||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm=-runtime-counter-relocation")
|
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm=-runtime-counter-relocation")
|
||||||
}
|
}
|
||||||
|
|
||||||
coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
|
if ctx.Device() {
|
||||||
deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
|
coverage := ctx.GetDirectDepWithTag(getClangProfileLibraryName(ctx), CoverageDepTag).(*Module)
|
||||||
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
|
deps.WholeStaticLibs = append(deps.WholeStaticLibs, coverage.OutputFile().Path())
|
||||||
|
flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,--wrap,open")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +207,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cov *coverage) begin(ctx BaseModuleContext) {
|
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
|
// TODO(dwillemsen): because of -nodefaultlibs, we must depend on libclang_rt.profile-*.a
|
||||||
// Just turn off for now.
|
// Just turn off for now.
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue