aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-03-15 16:37:21 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-03-16 08:35:14 +0000
commite4d2b1d5bd6a1ec0ccc060d1355fe1196a7d389c (patch)
treeafb788077c25990016c0010b01bbfdce63a47022 /src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
parent1fc4dff2f00c0593413235c46acbc2f0ddbef3f4 (diff)
Add ThinLTO support for py_binary targets.
Builds of py_binary targets were failing with --features=thin_lto during the link because the C++ source files were compiled into bitcode, but the link (which is set up by GooglePythonSemantics.java) did not have support for ThinLTO actions and attempted to do a native link of the bitcode objects. -- PiperOrigin-RevId: 150201765 MOS_MIGRATED_REVID=150201765
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
index 26011cbcf5..6a389250a1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkAction.java
@@ -571,6 +571,7 @@ public final class CppLinkAction extends AbstractAction
final ImmutableSet<Artifact> nonCodeInputs;
final NestedSet<LibraryToLink> libraries;
final NestedSet<Artifact> crosstoolInputs;
+ final ImmutableList<Artifact> ltoBitcodeFiles;
final Artifact runtimeMiddleman;
final NestedSet<Artifact> runtimeInputs;
final ArtifactCategory runtimeType;
@@ -596,6 +597,7 @@ public final class CppLinkAction extends AbstractAction
.addTransitive(builder.getLibraries().build()).build();
this.crosstoolInputs =
NestedSetBuilder.<Artifact>stableOrder().addTransitive(builder.getCrosstoolInputs()).build();
+ this.ltoBitcodeFiles = ImmutableList.copyOf(builder.getLtoBitcodeFiles());
this.runtimeMiddleman = builder.getRuntimeMiddleman();
this.runtimeInputs =
NestedSetBuilder.<Artifact>stableOrder().addTransitive(builder.getRuntimeInputs()).build();
@@ -632,6 +634,11 @@ public final class CppLinkAction extends AbstractAction
return this.crosstoolInputs;
}
+ /** Returns linker inputs that are lto bitcode files. */
+ public ImmutableList<Artifact> getLtoBitcodeFiles() {
+ return this.ltoBitcodeFiles;
+ }
+
/**
* Returns the runtime middleman artifact.
*/