Merge "Dedupe all deps of cc_libraries" into main
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 601c0c5..0157632 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1032,6 +1032,13 @@
 
 	addMuslSystemDynamicDeps(ctx, linkerAttrs)
 
+	// Dedupe all deps.
+	(&linkerAttrs).deps.Value = bazel.FirstUniqueBazelLabelList((&linkerAttrs).deps.Value)
+	(&linkerAttrs).implementationDeps.Value = bazel.FirstUniqueBazelLabelList((&linkerAttrs).implementationDeps.Value)
+	(&linkerAttrs).implementationDynamicDeps.Value = bazel.FirstUniqueBazelLabelList((&linkerAttrs).implementationDynamicDeps.Value)
+	(&linkerAttrs).wholeArchiveDeps.Value = bazel.FirstUniqueBazelLabelList((&linkerAttrs).wholeArchiveDeps.Value)
+	(&linkerAttrs).implementationWholeArchiveDeps.Value = bazel.FirstUniqueBazelLabelList((&linkerAttrs).implementationWholeArchiveDeps.Value)
+
 	return baseAttributes{
 		compilerAttrs,
 		linkerAttrs,