aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar jmmv <jmmv@google.com>2018-02-05 07:55:56 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-05 07:57:46 -0800
commit03ad9155f765fcdc0ccf4aae30a4def9914ea0b4 (patch)
treea0b6c389b07a62ea9b522f56b41606a9a979da15 /src/main
parentbb2f14a273161e5fae366c7f7f2ba4b403bf1426 (diff)
Automated rollback of commit 17830c25a816d67ba79e783acaa6a085b516bd43.
*** Reason for rollback *** Causes Blaze to crash when building Exoblaze as shown in b/72936965. Confirmed as root cause by rolling back this CL, building a Blaze from HEAD, and successfully using it to build Exoblaze. *** Original change description *** C++: Remove last instatiation of CppModel outside CcLibraryHelper. RELNOTES:none PiperOrigin-RevId: 184528551
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
index 71d13162a8..7691c2e770 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
@@ -185,6 +185,7 @@ public final class CppModel {
private final Predicate<String> coptsFilter;
private boolean fake;
private boolean maySaveTemps;
+ private boolean onlySingleOutput;
private CcCompilationOutputs compilationOutputs;
// link model
@@ -275,6 +276,17 @@ public final class CppModel {
}
/**
+ * If set, the CppModel only creates a single .o output that can be linked into a dynamic library,
+ * i.e., it never generates both PIC and non-PIC outputs. Otherwise it creates outputs that can be
+ * linked into both static binaries and dynamic libraries (if both require PIC or both require
+ * non-PIC, then it still only creates a single output). Defaults to false.
+ */
+ public CppModel setOnlySingleOutput(boolean onlySingleOutput) {
+ this.onlySingleOutput = onlySingleOutput;
+ return this;
+ }
+
+ /**
* Whether to create actions for temps. This defaults to false.
*/
public CppModel setSaveTemps(boolean maySaveTemps) {
@@ -466,7 +478,7 @@ public final class CppModel {
// Either you're only making a dynamic library (onlySingleOutput) or pic should be used
// in all cases.
- if (usePicForBinaries) {
+ if (onlySingleOutput || usePicForBinaries) {
if (picFeatureEnabled) {
return false;
}