Fix: deps to sanitizer runtime libs are with correct 'image' variant
This change fixes a bug that sanitizer runtime libs for non-core variant
(e.g. recovery, vendor, etc.) are not installed. It happened because the
dependency to the sanitizer runtime lib was without 'image' variant,
which in most case caused only the core variant - which is the first in
the image variants - of the lib to be installed.
Fixing the issue by correctly selecting image variant depending on the
location of the lib having dependency to the runtime lib.
Bug: 123525879
Test: SANITIZE_TARGET=hwaddress m out/target/product/blueline/boot.img
Test: SANITIZE_TARGET=address m out/target/product/blueline/boot.img
libclang_rt.*.so is under
out/target/product/blueline/root/recovery/system/lib64
Change-Id: Iea7d718d4971e36521f0a3f712a454de944cd7ac
diff --git a/cc/cc.go b/cc/cc.go
index ded89d4..062e6d9 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1175,15 +1175,9 @@
depTag = headerExportDepTag
}
if buildStubs {
- imageVariation := "core"
- if c.useVndk() {
- imageVariation = "vendor"
- } else if c.inRecovery() {
- imageVariation = "recovery"
- }
actx.AddFarVariationDependencies([]blueprint.Variation{
{Mutator: "arch", Variation: ctx.Target().String()},
- {Mutator: "image", Variation: imageVariation},
+ {Mutator: "image", Variation: c.imageVariation()},
}, depTag, lib)
} else {
actx.AddVariationDependencies(nil, depTag, lib)
@@ -1845,6 +1839,16 @@
return false
}
+func (c *Module) imageVariation() string {
+ variation := "core"
+ if c.useVndk() {
+ variation = "vendor"
+ } else if c.inRecovery() {
+ variation = "recovery"
+ }
+ return variation
+}
+
//
// Defaults
//