aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/nativedeps
diff options
context:
space:
mode:
authorGravatar plf <plf@google.com>2018-03-27 08:02:39 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-27 08:04:11 -0700
commiteed7c75c5baa0e83e5915feade3ba4268b42c0f7 (patch)
treebd5f4d2488acad1cb0d7463b36ec9b68d70fff29 /src/main/java/com/google/devtools/build/lib/rules/nativedeps
parentf5c8c0bb0f53cd7289d65672955b37ffcff7d6c4 (diff)
C++: Fixes Blaze crashing on CLIF in toolchains that don't need PIC
For CLIF it doesn't matter whether we use PIC or no-PIC, the important thing is we get an output protobuf. Before https://github.com/bazelbuild/bazel/commit/35773928532c132e3229b490ad98f4ebfd3e5770, using no-PIC was hardcoded. In this CL it was decided to generate PIC instead because the toolchains used by CLIF targets appeared to all have needsPic. In b/73955395 it has been shown not to be the case. In this CL I'm changing the logic again to use no-PIC for CLIF and to circumvent the logic that checks what the configuration and the toolchain say. At the same time, SWIG also used the method setGenerateNoPic() after the variable onlySingleOutput was removed in https://github.com/bazelbuild/bazel/commit/4e9c9f93b15dd2594097644c6b9ca5a579c712fb. In this CL I use the enum to apply PIC and no-PIC in the same cases as before for SWIG. This CL also refactors the methods and boolean variables used to determine whether to use PIC or not, hopefully making it clearer. RELNOTES:none PiperOrigin-RevId: 190615548
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/nativedeps')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/nativedeps/NativeDepsHelper.java3
1 files changed, 2 insertions, 1 deletions
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 729ac2b75d..d8ddf994d9 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
@@ -267,7 +267,8 @@ public abstract class NativeDepsHelper {
if (builder.hasLtoBitcodeInputs() && featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO)) {
builder.setLtoIndexing(true);
- builder.setUsePicForLtoBackendActions(CppHelper.usePic(ruleContext, toolchain, false));
+ builder.setUsePicForLtoBackendActions(
+ CppHelper.usePicForDynamicLibraries(ruleContext, toolchain));
CppLinkAction indexAction = builder.build();
if (indexAction != null) {
ruleContext.registerAction(indexAction);