Remove system shared libs from non-bionic dep list
bionic system shared libraries only build for bionic platforms, so it is
safe to remove them from other platforms, preventing issues where
duplicate libraries are incorrectly identified in Bazel.
Test: go test soong tests
Change-Id: Idac27c49a464831f8aca02d561f41f98fc763337
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 8fb86f8..c1a3bef 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1084,9 +1084,12 @@
func (la *linkerAttributes) finalize(ctx android.BazelConversionPathContext) {
// if system dynamic deps have the default value, any use of a system dynamic library used will
// result in duplicate library errors for bionic OSes. Here, we explicitly exclude those libraries
- // from bionic OSes.
+ // from bionic OSes and the no config case as these libraries only build for bionic OSes.
if la.systemDynamicDeps.IsNil() && len(la.usedSystemDynamicDepAsDynamicDep) > 0 {
toRemove := bazelLabelForSharedDeps(ctx, android.SortedStringKeys(la.usedSystemDynamicDepAsDynamicDep))
+ la.dynamicDeps.Exclude(bazel.NoConfigAxis, "", toRemove)
+ la.implementationDynamicDeps.Exclude(bazel.NoConfigAxis, "", toRemove)
+ la.implementationDynamicDeps.Exclude(bazel.NoConfigAxis, "", toRemove)
la.dynamicDeps.Exclude(bazel.OsConfigurationAxis, "android", toRemove)
la.dynamicDeps.Exclude(bazel.OsConfigurationAxis, "linux_bionic", toRemove)
la.implementationDynamicDeps.Exclude(bazel.OsConfigurationAxis, "android", toRemove)