Properly set PIC on CppCompileActions generated from a CppCompileActionTemplate.
Otherwise, this can lead to weird side-effects, e.g. no-PIC actions using PIC
C++ modules.
RELNOTES: None.
@@ -1463,6 +1463,9 @@ public final class CcCompilationHelper {
CppCompileActionBuilder builder,
Iterable<ArtifactCategory> outputCategories,
boolean usePic) {
+ if (usePic) {
+ builder = new CppCompileActionBuilder(builder).setPicMode(true);
+ }
SpecialArtifact sourceArtifact = (SpecialArtifact) source.getSource();
SpecialArtifact outputFiles =
CppHelper.getCompileOutputTreeArtifact(
