aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-07-24 13:14:13 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-07-24 13:19:01 +0200
commit624ecabfdce32349ca446dee657403b9939ff2bf (patch)
tree027630b9278d89ff8b3fc253623c7d5fc67c1b96 /src/main/java/com
parentf9625f0bafb2f84524d152753b6e10c460abc82a (diff)
Do not disable dynamic_mode for ThinLTO when invoked via LIPO options.
When using LLVM LIPO is automatically mapped to ThinLTO. While for LIPO, fully dynamic linking needs to be off for correctness issues, there is no such restriction for ThinLTO. RELNOTES[NEW]: Do not disable fully dynamic linking with ThinLTO when invoked via LIPO options. PiperOrigin-RevId: 162918429
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
index 784ab88a7b..13612763ce 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java
@@ -359,7 +359,12 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
throw new AssertionError(e);
}
- if (cppOptions.getLipoMode() == LipoMode.BINARY) {
+ // Needs to be set before the first call to isLLVMCompiler().
+ this.toolchainIdentifier = toolchain.getToolchainIdentifier();
+
+ // With LLVM, ThinLTO is automatically used in place of LIPO. ThinLTO works fine with dynamic
+ // linking (and in fact creates a lot more work when dynamic linking is off).
+ if (cppOptions.getLipoMode() == LipoMode.BINARY && !isLLVMCompiler()) {
// TODO(bazel-team): implement dynamic linking with LIPO
this.dynamicMode = DynamicMode.OFF;
} else {
@@ -380,8 +385,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
this.solibDirectory = "_solib_" + targetCpu;
- this.toolchainIdentifier = toolchain.getToolchainIdentifier();
-
this.supportsEmbeddedRuntimes = toolchain.getSupportsEmbeddedRuntimes();
toolchain = addLegacyFeatures(toolchain);
this.toolchainFeatures = new CcToolchainFeatures(toolchain);
@@ -1325,7 +1328,7 @@ public class CppConfiguration extends BuildConfiguration.Fragment {
return cppOptions.isFdo();
}
- public boolean isLLVMCompiler() {
+ public final boolean isLLVMCompiler() {
// TODO(tmsriram): Checking for "llvm" does not handle all the cases. This
// is temporary until the crosstool configuration is modified to add fields that
// indicate which flavor of fdo is being used.