diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java | 64 |
1 files changed, 64 insertions, 0 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 398c276838..af342ea241 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 @@ -680,6 +680,8 @@ public class CppConfiguration extends BuildConfiguration.Fragment { return result; } + // TODO(bazel-team): Remove this once bazel supports all crosstool flags through + // feature configuration, and all crosstools have been converted. private CToolchain addLegacyFeatures(CToolchain toolchain) { CToolchain.Builder toolchainBuilder = CToolchain.newBuilder(); ImmutableSet.Builder<String> featuresBuilder = ImmutableSet.builder(); @@ -833,6 +835,68 @@ public class CppConfiguration extends BuildConfiguration.Fragment { + "}", toolchainBuilder); } + if (!features.contains("fdo_instrument")) { + TextFormat.merge("" + + "feature {" + + " name: 'fdo_instrument'" + + " flag_set {" + + " action: 'c-compile'" + + " action: 'c++-compile'" + + " action: 'c++-link'" + + " flag_group {" + + " flag: '-fprofile-generate=%{fdo_instrument_path}'" + + " }" + + " flag_group {" + + " flag: '-fno-data-sections'" + + " }" + + " }" + + "}", + toolchainBuilder); + } + if (!features.contains("fdo_optimize")) { + TextFormat.merge("" + + "feature {" + + " name: 'fdo_optimize'" + + " flag_set {" + + " action: 'c-compile'" + + " action: 'c++-compile'" + + " flag_group {" + + " flag: '-fprofile-use=%{fdo_profile_path}'" + + " flag: '-fprofile-correction'" + + " }" + + " }" + + "}", + toolchainBuilder); + } + if (!features.contains("autofdo")) { + TextFormat.merge("" + + "feature {" + + " name: 'autofdo'" + + " flag_set {" + + " action: 'c-compile'" + + " action: 'c++-compile'" + + " flag_group {" + + " flag: '-fauto-profile=%{fdo_profile_path}'" + + " flag: '-fprofile-correction'" + + " }" + + " }" + + "}", + toolchainBuilder); + } + if (!features.contains("lipo")) { + TextFormat.merge("" + + "feature {" + + " name: 'lipo'" + + " flag_set {" + + " action: 'c-compile'" + + " action: 'c++-compile'" + + " flag_group {" + + " flag: '-fripa'" + + " }" + + " }" + + "}", + toolchainBuilder); + } } catch (ParseException e) { // Can only happen if we change the proto definition without changing our configuration above. throw new RuntimeException(e); |