Enforce dependencies have right architecture
ctx.AddDependency will succeed if the named dependency only has a
single variant, even if that variant is the wrong architecture.
Use ctx.AddVariationDependency(nil, ...) instead, which requires
that all variations of the calling module match the dependency.
Bug: 112707915
Test: no change to out/soong/build.ninja
Test: using a device dependency in a host java module is an error
Change-Id: I70b661a57d4412eb63b8c9841febfb756e9e025d
diff --git a/cc/cc.go b/cc/cc.go
index 07dd23c..befd683 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1043,13 +1043,13 @@
actx.AddDependency(c, depTag, gen)
}
- actx.AddDependency(c, objDepTag, deps.ObjFiles...)
+ actx.AddVariationDependencies(nil, objDepTag, deps.ObjFiles...)
if deps.CrtBegin != "" {
- actx.AddDependency(c, crtBeginDepTag, deps.CrtBegin)
+ actx.AddVariationDependencies(nil, crtBeginDepTag, deps.CrtBegin)
}
if deps.CrtEnd != "" {
- actx.AddDependency(c, crtEndDepTag, deps.CrtEnd)
+ actx.AddVariationDependencies(nil, crtEndDepTag, deps.CrtEnd)
}
if deps.LinkerScript != "" {
actx.AddDependency(c, linkerScriptDepTag, deps.LinkerScript)