@@ -590,15 +590,20 @@ private Iterable<PathFragment> getImports(PathFragment objDirectory, PathFragmen
590
590
}
591
591
592
592
/**
593
- * Configures a compile action builder by setting up command line options and
594
- * auxiliary inputs according to the FDO configuration. This method does
595
- * nothing If FDO is disabled.
593
+ * Configures a compile action builder by setting up command line options and auxiliary inputs
594
+ * according to the FDO configuration. This method does nothing If FDO is disabled.
596
595
*/
597
596
@ ThreadSafe
598
- public void configureCompilation (CppCompileActionBuilder builder ,
599
- CcToolchainFeatures .Variables .Builder buildVariables , RuleContext ruleContext ,
600
- PathFragment sourceName , PathFragment sourceExecPath , boolean usePic ,
601
- FeatureConfiguration featureConfiguration , FdoSupportProvider fdoSupportProvider ) {
597
+ public void configureCompilation (
598
+ CppCompileActionBuilder builder ,
599
+ CcToolchainFeatures .Variables .Builder buildVariables ,
600
+ RuleContext ruleContext ,
601
+ PathFragment sourceName ,
602
+ PathFragment sourceExecPath ,
603
+ PathFragment outputName ,
604
+ boolean usePic ,
605
+ FeatureConfiguration featureConfiguration ,
606
+ FdoSupportProvider fdoSupportProvider ) {
602
607
603
608
// FDO is disabled -> do nothing.
604
609
if ((fdoInstrument == null ) && (fdoRoot == null )) {
@@ -616,8 +621,9 @@ public void configureCompilation(CppCompileActionBuilder builder,
616
621
if (env .getSkyframeEnv ().valuesMissing ()) {
617
622
return ;
618
623
}
619
- Iterable <Artifact > auxiliaryInputs = getAuxiliaryInputs (
620
- ruleContext , sourceName , sourceExecPath , usePic , fdoSupportProvider );
624
+ Iterable <Artifact > auxiliaryInputs =
625
+ getAuxiliaryInputs (
626
+ ruleContext , sourceName , sourceExecPath , outputName , usePic , fdoSupportProvider );
621
627
builder .addMandatoryInputs (auxiliaryInputs );
622
628
if (!Iterables .isEmpty (auxiliaryInputs )) {
623
629
if (featureConfiguration .isEnabled (CppRuleClasses .AUTOFDO )) {
@@ -636,11 +642,13 @@ public void configureCompilation(CppCompileActionBuilder builder,
636
642
}
637
643
}
638
644
639
- /**
640
- * Returns the auxiliary files that need to be added to the {@link CppCompileAction}.
641
- */
645
+ /** Returns the auxiliary files that need to be added to the {@link CppCompileAction}. */
642
646
private Iterable <Artifact > getAuxiliaryInputs (
643
- RuleContext ruleContext , PathFragment sourceName , PathFragment sourceExecPath , boolean usePic ,
647
+ RuleContext ruleContext ,
648
+ PathFragment sourceName ,
649
+ PathFragment sourceExecPath ,
650
+ PathFragment outputName ,
651
+ boolean usePic ,
644
652
FdoSupportProvider fdoSupportProvider ) {
645
653
CcToolchainProvider toolchain =
646
654
CppHelper .getToolchainUsingDefaultCcToolchainAttribute (ruleContext );
@@ -661,7 +669,7 @@ private Iterable<Artifact> getAuxiliaryInputs(
661
669
ImmutableSet .Builder <Artifact > auxiliaryInputs = ImmutableSet .builder ();
662
670
663
671
PathFragment objectName =
664
- FileSystemUtils .replaceExtension ( sourceName , usePic ? ".pic.o" : ".o" );
672
+ FileSystemUtils .appendExtension ( outputName , usePic ? ".pic.o" : ".o" );
665
673
666
674
Label lipoLabel = ruleContext .getLabel ();
667
675
auxiliaryInputs .addAll (
0 commit comments