diff options
author | 2017-12-21 07:43:05 -0800 | |
---|---|---|
committer | 2017-12-21 07:45:01 -0800 | |
commit | 169329ba0bcf7f2baa654a3d262193500f9a76b2 (patch) | |
tree | 81c6e6f98f1fbab49f76414b07c3bf557d741147 /src/main/java/com/google | |
parent | 03ed827a80e3bc50f0e4f171e6728f5cc54fa099 (diff) |
Use more robust check for bitcode inputs to link
The current checks used in several places for whether an LTO indexing
step is needed only looked for direct LTO bitcode inputs. Instead we should
use the existing hasLtoBitcodeInputs() method to look both at the direct
inputs as well as inputs on all LibraryToLink. This was already used in
similar checking on the CppBinary. With this change, all places that
test for needing an LTO indexing step use the correct interface.
RELNOTES: None
PiperOrigin-RevId: 179812972
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java | 2 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java index 9949d7e0f2..df76aad01a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java @@ -503,7 +503,7 @@ public class CppLinkActionBuilder { * Returns true if there are any LTO bitcode inputs to this link, either directly transitively via * library inputs. */ - boolean hasLtoBitcodeInputs() { + public boolean hasLtoBitcodeInputs() { if (!ltoBitcodeFiles.isEmpty()) { return true; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java index 652f993625..55a8efe822 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java @@ -258,8 +258,7 @@ public abstract class NativeDepsHelper { .addLtoBitcodeFiles(ltoBitcodeFilesMap.build()) .addNonCodeInputs(nonCodeInputs); - if (!builder.getLtoBitcodeFiles().isEmpty() - && featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) { + if (builder.hasLtoBitcodeInputs() && featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) { builder.setLtoIndexing(true); builder.setUsePicForLtoBackendActions(CppHelper.usePic(ruleContext, toolchain, false)); CppLinkAction indexAction = builder.build(); |