Include libprofile-extras to all coverage variants
am: 65c95ff1fb
Change-Id: I74057c0921eaa76c8016d0bb8f81abaf0eb50ed8
This commit is contained in:
committed by
android-build-merger
commit
865ad54f90
@@ -417,6 +417,10 @@ func (binary *binaryDecorator) symlinkList() []string {
|
|||||||
return binary.symlinks
|
return binary.symlinks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (binary *binaryDecorator) nativeCoverage() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// /system/bin/linker -> /apex/com.android.runtime/bin/linker
|
// /system/bin/linker -> /apex/com.android.runtime/bin/linker
|
||||||
func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
|
func (binary *binaryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
|
||||||
dir := binary.baseInstaller.installDir(ctx)
|
dir := binary.baseInstaller.installDir(ctx)
|
||||||
|
11
cc/cc.go
11
cc/cc.go
@@ -267,6 +267,7 @@ type ModuleContextIntf interface {
|
|||||||
isStubs() bool
|
isStubs() bool
|
||||||
bootstrap() bool
|
bootstrap() bool
|
||||||
mustUseVendorVariant() bool
|
mustUseVendorVariant() bool
|
||||||
|
nativeCoverage() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ModuleContext interface {
|
type ModuleContext interface {
|
||||||
@@ -312,6 +313,8 @@ type linker interface {
|
|||||||
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
|
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
|
||||||
appendLdflags([]string)
|
appendLdflags([]string)
|
||||||
unstrippedOutputFilePath() android.Path
|
unstrippedOutputFilePath() android.Path
|
||||||
|
|
||||||
|
nativeCoverage() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type installer interface {
|
type installer interface {
|
||||||
@@ -604,6 +607,10 @@ func (c *Module) bootstrap() bool {
|
|||||||
return Bool(c.Properties.Bootstrap)
|
return Bool(c.Properties.Bootstrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Module) nativeCoverage() bool {
|
||||||
|
return c.linker != nil && c.linker.nativeCoverage()
|
||||||
|
}
|
||||||
|
|
||||||
func isBionic(name string) bool {
|
func isBionic(name string) bool {
|
||||||
switch name {
|
switch name {
|
||||||
case "libc", "libm", "libdl", "linker":
|
case "libc", "libm", "libdl", "linker":
|
||||||
@@ -794,6 +801,10 @@ func (ctx *moduleContextImpl) bootstrap() bool {
|
|||||||
return ctx.mod.bootstrap()
|
return ctx.mod.bootstrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *moduleContextImpl) nativeCoverage() bool {
|
||||||
|
return ctx.mod.nativeCoverage()
|
||||||
|
}
|
||||||
|
|
||||||
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
|
func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
hod: hod,
|
hod: hod,
|
||||||
|
@@ -42,6 +42,23 @@ func (cov *coverage) props() []interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cov *coverage) deps(ctx BaseModuleContext, deps Deps) Deps {
|
func (cov *coverage) deps(ctx BaseModuleContext, deps Deps) Deps {
|
||||||
|
if cov.Properties.NeedCoverageBuild {
|
||||||
|
// Link libprofile-extras/libprofile-extras_ndk when coverage
|
||||||
|
// variant is required. This is a no-op unless coverage is
|
||||||
|
// actually enabled during linking, when
|
||||||
|
// '-uinit_profile_extras' is added (in flags()) to force the
|
||||||
|
// setup code in libprofile-extras be linked into the
|
||||||
|
// binary/library.
|
||||||
|
//
|
||||||
|
// We cannot narrow it further to only the 'cov' variant since
|
||||||
|
// the mutator hasn't run (and we don't have the 'cov' variant
|
||||||
|
// yet).
|
||||||
|
if !ctx.useSdk() {
|
||||||
|
deps.LateStaticLibs = append(deps.LateStaticLibs, "libprofile-extras")
|
||||||
|
} else {
|
||||||
|
deps.LateStaticLibs = append(deps.LateStaticLibs, "libprofile-extras_ndk")
|
||||||
|
}
|
||||||
|
}
|
||||||
return deps
|
return deps
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +113,9 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
|
|
||||||
if cov.linkCoverage {
|
if cov.linkCoverage {
|
||||||
flags.LdFlags = append(flags.LdFlags, "--coverage")
|
flags.LdFlags = append(flags.LdFlags, "--coverage")
|
||||||
|
|
||||||
|
// Force linking of constructor/setup code in libprofile-extras
|
||||||
|
flags.LdFlags = append(flags.LdFlags, "-uinit_profile_extras")
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags
|
return flags
|
||||||
@@ -113,10 +133,8 @@ func (cov *coverage) begin(ctx BaseModuleContext) {
|
|||||||
if ctx.Host() {
|
if ctx.Host() {
|
||||||
// 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 if ctx.isStubs() {
|
} else if !ctx.nativeCoverage() {
|
||||||
// Do not enable coverage for platform stub libraries
|
// Native coverage is not supported for this module type.
|
||||||
} else if ctx.isNDKStubLibrary() {
|
|
||||||
// Do not enable coverage for NDK stub libraries
|
|
||||||
} else {
|
} else {
|
||||||
// Check if Native_coverage is set to false. This property defaults to true.
|
// Check if Native_coverage is set to false. This property defaults to true.
|
||||||
needCoverageVariant = BoolDefault(cov.Properties.Native_coverage, true)
|
needCoverageVariant = BoolDefault(cov.Properties.Native_coverage, true)
|
||||||
|
@@ -761,6 +761,13 @@ func (library *libraryDecorator) unstrippedOutputFilePath() android.Path {
|
|||||||
return library.unstrippedOutputFile
|
return library.unstrippedOutputFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *libraryDecorator) nativeCoverage() bool {
|
||||||
|
if library.header() || library.buildStubs() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path {
|
func getRefAbiDumpFile(ctx ModuleContext, vndkVersion, fileName string) android.Path {
|
||||||
isLlndk := inList(ctx.baseModuleName(), llndkLibraries) || inList(ctx.baseModuleName(), ndkMigratedLibs)
|
isLlndk := inList(ctx.baseModuleName(), llndkLibraries) || inList(ctx.baseModuleName(), ndkMigratedLibs)
|
||||||
|
|
||||||
|
@@ -161,6 +161,10 @@ func (stub *llndkStubDecorator) link(ctx ModuleContext, flags Flags, deps PathDe
|
|||||||
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (stub *llndkStubDecorator) nativeCoverage() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func NewLLndkStubLibrary() *Module {
|
func NewLLndkStubLibrary() *Module {
|
||||||
module, library := NewLibrary(android.DeviceSupported)
|
module, library := NewLibrary(android.DeviceSupported)
|
||||||
library.BuildOnlyShared()
|
library.BuildOnlyShared()
|
||||||
|
@@ -338,6 +338,10 @@ func (stub *stubDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps,
|
|||||||
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
return stub.libraryDecorator.link(ctx, flags, deps, objs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (stub *stubDecorator) nativeCoverage() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
|
func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
|
||||||
arch := ctx.Target().Arch.ArchType.Name
|
arch := ctx.Target().Arch.ArchType.Name
|
||||||
apiLevel := stub.properties.ApiLevel
|
apiLevel := stub.properties.ApiLevel
|
||||||
|
@@ -114,3 +114,7 @@ func (object *objectLinker) link(ctx ModuleContext,
|
|||||||
func (object *objectLinker) unstrippedOutputFilePath() android.Path {
|
func (object *objectLinker) unstrippedOutputFilePath() android.Path {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (object *objectLinker) nativeCoverage() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
@@ -108,6 +108,10 @@ func (p *prebuiltLibraryLinker) shared() bool {
|
|||||||
return p.libraryDecorator.shared()
|
return p.libraryDecorator.shared()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *prebuiltLibraryLinker) nativeCoverage() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func prebuiltSharedLibraryFactory() android.Module {
|
func prebuiltSharedLibraryFactory() android.Module {
|
||||||
module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
|
module, _ := NewPrebuiltSharedLibrary(android.HostAndDeviceSupported)
|
||||||
return module.Init()
|
return module.Init()
|
||||||
|
@@ -77,3 +77,7 @@ func (library *toolchainLibraryDecorator) link(ctx ModuleContext,
|
|||||||
|
|
||||||
return android.PathForSource(ctx, *library.Properties.Src)
|
return android.PathForSource(ctx, *library.Properties.Src)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (library *toolchainLibraryDecorator) nativeCoverage() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user