Fix error in dynamic_deps of cc_[binary|test]
It was incorrectly giving an error when the same shared library was linked more
than once.
Test which will be written in Starlark has to go in a follow up CL (unknown commit). This is all behind an experimental.
RELNOTES:none
@@ -1321,7 +1321,8 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory {
Map<String, CcLinkingContext.LinkerInput> exportsMap = new HashMap<>();
for (CcSharedLibraryInfo entry : mergedCcSharedLibraryInfos) {
for (String export : entry.getExports()) {
- if (exportsMap.containsKey(export)) {
+ if (exportsMap.containsKey(export)
+ && !entry.getLinkerInput().getOwner().equals(exportsMap.get(export).getOwner())) {
ruleContext.ruleError(
"Two shared libraries in dependencies export the same symbols. Both "
+ exportsMap
