aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
index 98ed76fa10..79c24e6bef 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java
@@ -75,6 +75,7 @@ public final class LinkCommandLine extends CommandLine {
private final ImmutableSet<String> features;
private final ImmutableMap<Artifact, Artifact> linkstamps;
private final ImmutableList<String> linkstampCompileOptions;
+ @Nullable private final String fdoBuildStamp;
@Nullable private final PathFragment runtimeSolibDir;
private final boolean nativeDeps;
private final boolean useTestOnlyFlags;
@@ -84,6 +85,7 @@ public final class LinkCommandLine extends CommandLine {
@Nullable private final Artifact paramFile;
@Nullable private final Artifact interfaceSoBuilder;
+
/**
* A string constant for the c++ link action, used to access the feature
* configuration.
@@ -105,6 +107,7 @@ public final class LinkCommandLine extends CommandLine {
ImmutableSet<String> features,
ImmutableMap<Artifact, Artifact> linkstamps,
ImmutableList<String> linkstampCompileOptions,
+ @Nullable String fdoBuildStamp,
@Nullable PathFragment runtimeSolibDir,
boolean nativeDeps,
boolean useTestOnlyFlags,
@@ -161,6 +164,7 @@ public final class LinkCommandLine extends CommandLine {
this.features = Preconditions.checkNotNull(features);
this.linkstamps = Preconditions.checkNotNull(linkstamps);
this.linkstampCompileOptions = linkstampCompileOptions;
+ this.fdoBuildStamp = fdoBuildStamp;
this.runtimeSolibDir = runtimeSolibDir;
this.nativeDeps = nativeDeps;
this.useTestOnlyFlags = useTestOnlyFlags;
@@ -590,7 +594,6 @@ public final class LinkCommandLine extends CommandLine {
}
// Stamp FDO builds with FDO subtype string
- String fdoBuildStamp = CppHelper.getFdoBuildStamp(cppConfiguration);
if (fdoBuildStamp != null) {
optionList.add("-D" + CppConfiguration.FDO_STAMP_MACRO + "=\"" + fdoBuildStamp + "\"");
}
@@ -1052,8 +1055,7 @@ public final class LinkCommandLine extends CommandLine {
}
CcToolchainFeatures.Variables.Builder buildVariables =
new CcToolchainFeatures.Variables.Builder();
- CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
- cppConfiguration.getFdoSupport().getLinkOptions(featureConfiguration, buildVariables);
+ CppHelper.getFdoSupport(ruleContext).getLinkOptions(featureConfiguration, buildVariables);
variables = buildVariables.build();
}
return new LinkCommandLine(
@@ -1071,6 +1073,7 @@ public final class LinkCommandLine extends CommandLine {
features,
linkstamps,
actualLinkstampCompileOptions,
+ CppHelper.getFdoBuildStamp(ruleContext),
runtimeSolibDir,
nativeDeps,
useTestOnlyFlags,