C++: Make objects not be passed to LibraryToLink if not creating archive
With this CL when creating a LibraryToLink object for the output of the link
action builder, if we are not creating an archive, then we don't pass the
object files since they are not necessary.
RELNOTES:none
@@ -700,8 +700,12 @@ public class CppLinkActionBuilder {
output,
linkType.getLinkerOutput(),
libraryIdentifier,
- combinedObjectArtifacts,
- ltoBitcodeFiles,
+ linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER
+ ? combinedObjectArtifacts
+ : ImmutableSet.of(),
+ linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER
+ ? ltoBitcodeFiles
+ : ImmutableMap.of(),
createSharedNonLtoArtifacts(isLtoIndexing));
final LibraryToLink interfaceOutputLibrary =
(interfaceOutput == null)
