Revert "Support coverage instrumentation for Linux host"

This reverts commit 358056c058.

Reason for revert: Breaks build_test target in some branches.

Change-Id: I604561033038d4ff15b74caf7b81ff5c8dd9632f
This commit is contained in:
Pirama Arumuga Nainar 2018-04-23 22:44:39 +00:00
parent 358056c058
commit 0b882f0394
5 changed files with 10 additions and 38 deletions

View File

@ -40,7 +40,6 @@ func init() {
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel() ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel() ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel()
ctx.BottomUp("begin", beginMutator).Parallel() ctx.BottomUp("begin", beginMutator).Parallel()
ctx.BottomUp("coverage", coverageLinkingMutator).Parallel()
}) })
android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) { android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
@ -55,6 +54,7 @@ func init() {
ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator()) ctx.TopDown("sanitize_runtime_deps", sanitizerRuntimeDepsMutator())
ctx.BottomUp("coverage", coverageLinkingMutator).Parallel()
ctx.TopDown("vndk_deps", sabiDepsMutator) ctx.TopDown("vndk_deps", sabiDepsMutator)
ctx.TopDown("lto_deps", ltoDepsMutator) ctx.TopDown("lto_deps", ltoDepsMutator)
@ -809,15 +809,12 @@ func (c *Module) deps(ctx DepsContext) Deps {
if c.compiler != nil { if c.compiler != nil {
deps = c.compiler.compilerDeps(ctx, deps) deps = c.compiler.compilerDeps(ctx, deps)
} }
// clang_rt.profile runtime libraries necessary for PGO and coverage // Add the PGO dependency (the clang_rt.profile runtime library), which
// depend on symbols from libgcc. Add the runtime library dependency // sometimes depends on symbols from libgcc, before libgcc gets added
// before libgcc gets added in linkerDeps(). // in linkerDeps().
if c.pgo != nil { if c.pgo != nil {
deps = c.pgo.deps(ctx, deps) deps = c.pgo.deps(ctx, deps)
} }
if c.coverage != nil {
deps = c.coverage.deps(ctx, deps)
}
if c.linker != nil { if c.linker != nil {
deps = c.linker.linkerDeps(ctx, deps) deps = c.linker.linkerDeps(ctx, deps)
} }
@ -827,6 +824,9 @@ func (c *Module) deps(ctx DepsContext) Deps {
if c.sanitize != nil { if c.sanitize != nil {
deps = c.sanitize.deps(ctx, deps) deps = c.sanitize.deps(ctx, deps)
} }
if c.coverage != nil {
deps = c.coverage.deps(ctx, deps)
}
if c.sabi != nil { if c.sabi != nil {
deps = c.sabi.deps(ctx, deps) deps = c.sabi.deps(ctx, deps)
} }

View File

@ -85,8 +85,6 @@ type Toolchain interface {
AvailableLibraries() []string AvailableLibraries() []string
Bionic() bool Bionic() bool
profileRuntimeLibrary() string
} }
type toolchainBase struct { type toolchainBase struct {
@ -171,10 +169,6 @@ func (toolchainBase) Bionic() bool {
return true return true
} }
func (t toolchainBase) profileRuntimeLibrary() string {
return ""
}
func (t toolchainBase) ToolPath() string { func (t toolchainBase) ToolPath() string {
return "" return ""
} }
@ -246,12 +240,6 @@ func ThreadSanitizerRuntimeLibrary(t Toolchain) string {
} }
func ProfileRuntimeLibrary(t Toolchain) string { func ProfileRuntimeLibrary(t Toolchain) string {
lib := t.profileRuntimeLibrary()
if lib != "" {
// Return the directly exported profile library
return lib
}
// Return the Android-specific library
return SanitizerRuntimeLibrary(t, "profile") return SanitizerRuntimeLibrary(t, "profile")
} }

View File

@ -151,10 +151,6 @@ func (t *toolchainLinuxBionic) Bionic() bool {
return true return true
} }
func (t *toolchainLinuxBionic) profileRuntimeLibrary() string {
return "libclang_rt.profile-x86_64"
}
var toolchainLinuxBionicSingleton Toolchain = &toolchainLinuxBionic{} var toolchainLinuxBionicSingleton Toolchain = &toolchainLinuxBionic{}
func linuxBionicToolchainFactory(arch android.Arch) Toolchain { func linuxBionicToolchainFactory(arch android.Arch) Toolchain {

View File

@ -270,14 +270,6 @@ func (t *toolchainLinuxX8664) YasmFlags() string {
return "${config.LinuxX8664YasmFlags}" return "${config.LinuxX8664YasmFlags}"
} }
func (t *toolchainLinuxX86) profileRuntimeLibrary() string {
return "libclang_rt.profile-i386"
}
func (t *toolchainLinuxX8664) profileRuntimeLibrary() string {
return "libclang_rt.profile-x86_64"
}
func (t *toolchainLinux) AvailableLibraries() []string { func (t *toolchainLinux) AvailableLibraries() []string {
return linuxAvailableLibraries return linuxAvailableLibraries
} }

View File

@ -16,7 +16,6 @@ package cc
import ( import (
"android/soong/android" "android/soong/android"
"android/soong/cc/config"
) )
type CoverageProperties struct { type CoverageProperties struct {
@ -39,10 +38,6 @@ func (cov *coverage) props() []interface{} {
func (cov *coverage) begin(ctx BaseModuleContext) {} func (cov *coverage) begin(ctx BaseModuleContext) {}
func (cov *coverage) deps(ctx BaseModuleContext, deps Deps) Deps { func (cov *coverage) deps(ctx BaseModuleContext, deps Deps) Deps {
if cov.Properties.CoverageEnabled {
runtimeLibrary := config.ProfileRuntimeLibrary(ctx.toolchain())
deps.LateStaticLibs = append(deps.LateStaticLibs, runtimeLibrary)
}
return deps return deps
} }
@ -104,8 +99,9 @@ func coverageLinkingMutator(mctx android.BottomUpMutatorContext) {
if !mctx.DeviceConfig().NativeCoverageEnabled() { if !mctx.DeviceConfig().NativeCoverageEnabled() {
// Coverage is disabled globally // Coverage is disabled globally
} else if mctx.Darwin() || mctx.Windows() { } else if mctx.Host() {
// Coverage not supported for Darwin and Windows // TODO(dwillemsen): because of -nodefaultlibs, we must depend on libclang_rt.profile-*.a
// Just turn off for now.
} else if c.coverage.Properties.Native_coverage != nil { } else if c.coverage.Properties.Native_coverage != nil {
enabled = *c.coverage.Properties.Native_coverage enabled = *c.coverage.Properties.Native_coverage
} else { } else {