diff options
author | 2016-05-17 15:31:54 +0000 | |
---|---|---|
committer | 2016-05-17 16:19:21 +0000 | |
commit | 5ec6a258d41ef7c2174eb0e0c83ed0fbb7376286 (patch) | |
tree | 31b0530d38da279cec9c6f8fadfefa24d4ecc307 /src/main/java/com/google/devtools/build/lib | |
parent | 3b0a52de342894160f16ec95e147f1ada1bfb172 (diff) |
Rollback of commit 45d48bf1fe7503acbbb0c095822b7f8f558881e8.
*** Reason for rollback ***
Breaks //[]/go:all .
*** Original change description ***
Turn the addition of -fPIC to the command line of PIC actions into a feature.
--
MOS_MIGRATED_REVID=122526799
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
5 files changed, 5 insertions, 33 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java index e77bef91b4..06f2ef176f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java @@ -86,8 +86,7 @@ public final class CcCommon { CppRuleClasses.MODULE_MAPS, CppRuleClasses.MODULE_MAP_HOME_CWD, CppRuleClasses.HEADER_MODULE_INCLUDES_DEPENDENCIES, - CppRuleClasses.INCLUDE_PATHS, - CppRuleClasses.PIC); + CppRuleClasses.INCLUDE_PATHS); /** C++ configuration */ private final CppConfiguration cppConfiguration; diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java index f3f024d5e3..721ad0f889 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java @@ -1415,6 +1415,10 @@ public class CppCompileAction extends AbstractAction options.add("-E"); } + if (usePic) { + options.add("-fPIC"); + } + return options; } 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 7015d10774..f0d4906637 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 @@ -692,22 +692,6 @@ public class CppConfiguration extends BuildConfiguration.Fragment { return toolchain; } try { - if (!features.contains("pic")) { - TextFormat.merge("" - + "feature {" - + " name: 'pic'" - + " flag_set {" - + " action: 'c-compile'" - + " action: 'c++-compile'" - + " action: 'c++-module-compile'" - + " expand_if_all_available: 'pic'" - + " flag_group {" - + " flag: '-fPIC'" - + " }" - + " }" - + "}", - toolchainBuilder); - } if (!features.contains("include_paths")) { TextFormat.merge("" + "feature {" 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 07497df4ee..65c158dce7 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 @@ -388,13 +388,6 @@ public final class CppModel { getSafePathStrings(context.getSystemIncludeDirs())); } - if (usePic) { - if (!featureConfiguration.isEnabled(CppRuleClasses.PIC)) { - ruleContext.ruleError("PIC compilation is requested but the toolchain does not support it"); - } - buildVariables.addVariable("pic", ""); - } - if (ccRelativeName != null) { CppHelper.getFdoSupport(ruleContext).configureCompilation(builder, buildVariables, ruleContext, ccRelativeName, autoFdoImportPath, usePic, featureConfiguration); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java index 074900356c..77a9719923 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java @@ -165,14 +165,6 @@ public class CppRuleClasses { public static final String NO_LEGACY_FEATURES = "no_legacy_features"; /** - * A string constant for the PIC feature. - * - * If this feature is active (currently it cannot be switched off) and PIC compilation is - * requested, the "pic" build variable will be defined with an empty string as its value. - */ - public static final String PIC = "pic"; - - /** * A string constant for the include_paths feature. */ public static final String INCLUDE_PATHS = "include_paths"; |