diff options
author | Jiyong Park <jiyong@google.com> | 2019-02-01 00:31:10 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-02-08 00:47:46 +0900 |
commit | e4bb986106c39f279a2f30e442e984c7f577018b (patch) | |
tree | bd60ad01c8f45b9c3eeb85dc8387493dde068193 /cc/cc.go | |
parent | 4c3a4aded31285fc2828a951377aaf7b05868dc9 (diff) | |
download | build_soong-e4bb986106c39f279a2f30e442e984c7f577018b.tar.gz build_soong-e4bb986106c39f279a2f30e442e984c7f577018b.tar.bz2 build_soong-e4bb986106c39f279a2f30e442e984c7f577018b.zip |
Static variant of a stubs lib is correctly tracked
cc.Module.staticVariant is used to track the corresponding static
variant of a shared variant. This change fixes a problem that the
staticVariant field is not correctly set when the lib is with stubs:
{...}. This was happening because the staticVariant was set by adding
dependency from shared variant to static variant to reuse object files.
However, for a lib with stubs, the dependency was not created because it
does not make sense to share object files for stubs lib where source
code is auto-generated.
Fixing the issue by adding dependency to the static variant with a
different dependency tag whose only purpose is to set staticVariant
field.
Bug: 122885634
Test: m (cc_test amended)
Change-Id: I7f97cbb4c4a28bf9a93839d3b91ee140835aa6af
Diffstat (limited to 'cc/cc.go')
-rw-r--r-- | cc/cc.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -348,6 +348,7 @@ var ( linkerFlagsDepTag = dependencyTag{name: "linker flags file"} dynamicLinkerDepTag = dependencyTag{name: "dynamic linker"} reuseObjTag = dependencyTag{name: "reuse objects"} + staticVariantTag = dependencyTag{name: "static variant"} ndkStubDepTag = dependencyTag{name: "ndk stub", library: true} ndkLateStubDepTag = dependencyTag{name: "ndk late stub", library: true} vndkExtDepTag = dependencyTag{name: "vndk extends", library: true} @@ -1536,6 +1537,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { } } + if depTag == staticVariantTag { + if _, ok := ccDep.compiler.(libraryInterface); ok { + c.staticVariant = ccDep + return + } + } + // Extract explicitlyVersioned field from the depTag and reset it inside the struct. // Otherwise, sharedDepTag and lateSharedDepTag with explicitlyVersioned set to true // won't be matched to sharedDepTag and lateSharedDepTag. |