summaryrefslogtreecommitdiff
path: root/rust/coverage.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2025-02-06 09:58:22 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-02-06 09:58:22 -0800
commitd0944b409ce38585e09e1dfc8f671e8c41ca6d05 (patch)
treec5237c105b8e96152a5cab1eec31bd9a1c18b5d7 /rust/coverage.go
parent917b0ec873a3bd50808378fe0c41ec9c20efa3b0 (diff)
parentcf7c1322a38653e68b69a25309fe445b88c13b42 (diff)
Merge changes I902cfb76,I46800788 into main
* changes: rust: Use libprofile-clang-extras_ndk for SDK cov rust: Define UseSdk for Rust modules
Diffstat (limited to 'rust/coverage.go')
-rw-r--r--rust/coverage.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/rust/coverage.go b/rust/coverage.go
index ae95e46b1..798b21d78 100644
--- a/rust/coverage.go
+++ b/rust/coverage.go
@@ -16,12 +16,12 @@ package rust
import (
"android/soong/android"
+
"github.com/google/blueprint"
"android/soong/cc"
)
-var CovLibraryName = "libprofile-clang-extras"
var ProfilerBuiltins = "libprofiler_builtins.rust_sysroot"
// Add '%c' to default specifier after we resolve http://b/210012154
@@ -38,12 +38,20 @@ func (cov *coverage) props() []interface{} {
return []interface{}{&cov.Properties}
}
+func getClangProfileLibraryName(ctx ModuleContextIntf) string {
+ if ctx.RustModule().UseSdk() {
+ return "libprofile-clang-extras_ndk"
+ } else {
+ return "libprofile-clang-extras"
+ }
+}
+
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
if cov.Properties.NeedCoverageVariant {
if ctx.Device() {
ctx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
- }, cc.CoverageDepTag, CovLibraryName)
+ }, cc.CoverageDepTag, getClangProfileLibraryName(ctx))
}
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
@@ -66,7 +74,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags
flags.RustFlags = append(flags.RustFlags,
"-C instrument-coverage", "-g")
if ctx.Device() {
- m := ctx.GetDirectDepProxyWithTag(CovLibraryName, cc.CoverageDepTag)
+ m := ctx.GetDirectDepProxyWithTag(getClangProfileLibraryName(ctx), cc.CoverageDepTag)
coverage := android.OtherModuleProviderOrDefault(ctx, m, cc.LinkableInfoProvider)
flags.LinkFlags = append(flags.LinkFlags,
profileInstrFlag, "-g", coverage.OutputFile.Path().String(), "-Wl,--wrap,open")