aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp
diff options
context:
space:
mode:
authorGravatar hlopko <hlopko@google.com>2018-07-17 09:37:23 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-17 09:39:02 -0700
commiteb4c54015ccdd4acb323e3ff722b01f20a5336c6 (patch)
tree5f03db22fb5f7bb2fc70da9cdf2ae273f9864f2c /src/main/java/com/google/devtools/build/lib/rules/cpp
parent7c8607eb87a85700016e4ba0f1c2fb6070b83e4d (diff)
Add flags for disabling legacy crosstool fields
This cl adds following flags: * --experimental_disable_legacy_cc_compilation_api * --experimental_disable_legacy_cc_linking_api * --experimental_disable_linking_mode_flags * --experimental_disable_compilation_mode_flags * --experimental_disable_legacy_crosstool_fields RELNOTES: None PiperOrigin-RevId: 204924599
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java33
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java44
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java46
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java112
5 files changed, 177 insertions, 63 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
index 8aea1525a2..28ab7dedc7 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchain.java
@@ -665,7 +665,10 @@ public class CcToolchain implements RuleConfiguredTargetFactory {
return CppToolchainInfo.create(
cppConfiguration.getCrosstoolTopPathFragment(),
cppConfiguration.getCcToolchainRuleLabel(),
- crosstoolInfo);
+ crosstoolInfo,
+ cppConfiguration.disableLegacyCrosstoolFields(),
+ cppConfiguration.disableCompilationModeFlags(),
+ cppConfiguration.disableLinkingModeFlags());
} catch (InvalidConfigurationException e) {
throw ruleContext.throwWithRuleError(e.getMessage());
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
index b20c61a632..c702eae16b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java
@@ -704,7 +704,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
@Override
// TODO(b/24373706): Remove this method once new C++ toolchain API is available
public ImmutableList<String> getUnfilteredCompilerOptionsWithSysroot(
- Iterable<String> featuresNotUsedAnymore) {
+ Iterable<String> featuresNotUsedAnymore) throws EvalException {
+ cppConfiguration.checkForLegacyCompilationApiAvailability();
return toolchainInfo.getUnfilteredCompilerOptions(sysroot);
}
@@ -723,10 +724,12 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
}
@Override
- public ImmutableList<String> getLinkOptionsWithSysroot() {
- return cppConfiguration == null
- ? ImmutableList.of()
- : cppConfiguration.getLinkOptionsDoNotUse(sysroot);
+ public ImmutableList<String> getLinkOptionsWithSysroot() throws EvalException {
+ if (cppConfiguration == null) {
+ return ImmutableList.of();
+ }
+ cppConfiguration.checkForLegacyLinkingApiAvailability();
+ return cppConfiguration.getLinkOptionsDoNotUse(sysroot);
}
public ImmutableList<String> getLinkOptions() {
@@ -883,7 +886,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
* not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain.
*/
@Override
- public ImmutableList<String> getCompilerOptions() {
+ public ImmutableList<String> getCompilerOptions() throws EvalException {
+ cppConfiguration.checkForLegacyCompilationApiAvailability();
return getLegacyCompileOptionsWithCopts();
}
@@ -896,7 +900,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
* CcToolchainProvider#getLegacyCompileOptionsWithCopts()}.
*/
@Override
- public ImmutableList<String> getCOptions() {
+ public ImmutableList<String> getCOptions() throws EvalException {
+ cppConfiguration.checkForLegacyCompilationApiAvailability();
return cppConfiguration.getCOptions();
}
@@ -909,7 +914,8 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
*/
@Override
@Deprecated
- public ImmutableList<String> getCxxOptionsWithCopts() {
+ public ImmutableList<String> getCxxOptionsWithCopts() throws EvalException {
+ cppConfiguration.checkForLegacyCompilationApiAvailability();
return ImmutableList.<String>builder()
.addAll(getLegacyCxxOptions())
.addAll(cppConfiguration.getCxxopts())
@@ -935,6 +941,7 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
@Override
@Deprecated
public ImmutableList<String> getFullyStaticLinkOptions(Boolean sharedLib) throws EvalException {
+ cppConfiguration.checkForLegacyLinkingApiAvailability();
if (!sharedLib) {
throw new EvalException(
Location.BUILTIN, "fully_static_link_options is deprecated, new uses are not allowed.");
@@ -946,14 +953,15 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
* WARNING: This method is only added to allow incremental migration of existing users. Please do
* not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain.
*
- * Returns the immutable list of linker options for mostly statically linked outputs. Does not
+ * <p>Returns the immutable list of linker options for mostly statically linked outputs. Does not
* include command-line options passed via --linkopt or --linkopts.
*
* @param sharedLib true if the output is a shared lib, false if it's an executable
*/
@Override
@Deprecated
- public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib) {
+ public ImmutableList<String> getMostlyStaticLinkOptions(Boolean sharedLib) throws EvalException {
+ cppConfiguration.checkForLegacyLinkingApiAvailability();
return CppHelper.getMostlyStaticLinkOptions(
cppConfiguration, this, sharedLib, /* shouldStaticallyLinkCppRuntimes= */ true);
}
@@ -962,14 +970,15 @@ public final class CcToolchainProvider extends ToolchainInfo implements CcToolch
* WARNING: This method is only added to allow incremental migration of existing users. Please do
* not use in new code. Will be removed soon as part of the new Skylark API to the C++ toolchain.
*
- * Returns the immutable list of linker options for artifacts that are not fully or mostly
+ * <p>Returns the immutable list of linker options for artifacts that are not fully or mostly
* statically linked. Does not include command-line options passed via --linkopt or --linkopts.
*
* @param sharedLib true if the output is a shared lib, false if it's an executable
*/
@Override
@Deprecated
- public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib) {
+ public ImmutableList<String> getDynamicLinkOptions(Boolean sharedLib) throws EvalException {
+ cppConfiguration.checkForLegacyLinkingApiAvailability();
return CppHelper.getDynamicLinkOptions(cppConfiguration, this, sharedLib);
}
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 375f735c72..4bbfeafc16 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
@@ -92,6 +92,18 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
/** String constant for CC_FLAGS make variable name */
public static final String CC_FLAGS_MAKE_VARIABLE_NAME = "CC_FLAGS";
+ public boolean disableLegacyCrosstoolFields() {
+ return cppOptions.disableLegacyCrosstoolFields;
+ }
+
+ public boolean disableCompilationModeFlags() {
+ return cppOptions.disableCompilationModeFlags;
+ }
+
+ public boolean disableLinkingModeFlags() {
+ return cppOptions.disableLinkingModeFlags;
+ }
+
/**
* An enumeration of all the tools that comprise a toolchain.
*/
@@ -223,7 +235,12 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
params.crosstoolTop.getPackageIdentifier().getPathUnderExecRoot();
CppToolchainInfo cppToolchainInfo =
CppToolchainInfo.create(
- crosstoolTopPathFragment, params.ccToolchainLabel, params.crosstoolInfo);
+ crosstoolTopPathFragment,
+ params.ccToolchainLabel,
+ params.crosstoolInfo,
+ cppOptions.disableLegacyCrosstoolFields,
+ cppOptions.disableCompilationModeFlags,
+ cppOptions.disableLinkingModeFlags);
CompilationMode compilationMode = params.commonOptions.compilationMode;
@@ -555,6 +572,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getCompilerOptions(Iterable<String> featuresNotUsedAnymore)
throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyCompilationApiAvailability();
return compilerFlags;
}
@@ -567,6 +585,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
@Deprecated
public ImmutableList<String> getCOptionsForSkylark() throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyCompilationApiAvailability();
return getCOptions();
}
@@ -586,6 +605,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getCxxOptions(Iterable<String> featuresNotUsedAnymore)
throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyCompilationApiAvailability();
return cxxFlags;
}
@@ -603,6 +623,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getUnfilteredCompilerOptionsWithLegacySysroot(
Iterable<String> featuresNotUsedAnymore) throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyCompilationApiAvailability();
return getUnfilteredCompilerOptionsDoNotUse(nonConfiguredSysroot);
}
@@ -637,6 +658,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
@Override
public ImmutableList<String> getLinkOptionsWithLegacySysroot() throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyLinkingApiAvailability();
return getLinkOptionsDoNotUse(nonConfiguredSysroot);
}
@@ -694,6 +716,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getFullyStaticLinkOptions(
Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyLinkingApiAvailability();
if (!sharedLib) {
throw new EvalException(
Location.BUILTIN, "fully_static_link_options is deprecated, new uses are not allowed.");
@@ -716,6 +739,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getMostlyStaticLinkOptions(
Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyLinkingApiAvailability();
if (sharedLib) {
return getSharedLibraryLinkOptions(
cppToolchainInfo.supportsEmbeddedRuntimes()
@@ -741,6 +765,7 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
public ImmutableList<String> getDynamicLinkOptions(
Iterable<String> featuresNotUsedAnymore, Boolean sharedLib) throws EvalException {
checkForToolchainSkylarkApiAvailability();
+ checkForLegacyLinkingApiAvailability();
if (sharedLib) {
return getSharedLibraryLinkOptions(dynamicLinkFlags);
} else {
@@ -1173,6 +1198,23 @@ public final class CppConfiguration extends BuildConfiguration.Fragment
}
}
+ public void checkForLegacyCompilationApiAvailability() throws EvalException {
+ if (cppOptions.disableLegacyCompilationApi) {
+ throw new EvalException(
+ null,
+ "Skylark APIs accessing compilation flags has been removed. "
+ + "Use the new API on cc_common.");
+ }
+ }
+
+ public void checkForLegacyLinkingApiAvailability() throws EvalException {
+ if (cppOptions.disableLegacyLinkingApi) {
+ throw new EvalException(
+ null,
+ "Skylark APIs accessing linking flags has been removed. Use the new API on cc_common.");
+ }
+ }
+
public static PathFragment computeDefaultSysroot(String builtInSysroot) {
if (builtInSysroot.isEmpty()) {
return null;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 2ecb33e6d6..bcb5a7d81f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -804,6 +804,52 @@ public class CppOptions extends FragmentOptions {
public boolean enableCcSkylarkApi;
@Option(
+ name = "experimental_disable_legacy_cc_linking_api",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ help = "If true, C++ Skylark API exposing linking flags will be disabled.")
+ public boolean disableLegacyLinkingApi;
+
+ @Option(
+ name = "experimental_disable_legacy_cc_compilation_api",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ help = "If true, C++ Skylark API exposing compilation flags will be disabled.")
+ public boolean disableLegacyCompilationApi;
+
+ @Option(
+ name = "experimental_disable_linking_mode_flags",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ help = "If true, Bazel will not read crosstool flags from linking_mode_flags field.")
+ public boolean disableLinkingModeFlags;
+
+ @Option(
+ name = "experimental_disable_compilation_mode_flags",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ help = "If true, Bazel will not read crosstool flags from compilation_mode_flags field.")
+ public boolean disableCompilationModeFlags;
+
+ @Option(
+ name = "experimental_disable_legacy_crosstool_fields",
+ defaultValue = "false",
+ documentationCategory = OptionDocumentationCategory.TOOLCHAIN,
+ effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
+ metadataTags = {OptionMetadataTag.EXPERIMENTAL},
+ help =
+ "If true, Bazel will not read crosstool flags from legacy crosstool fields (see #5187.")
+ public boolean disableLegacyCrosstoolFields;
+
+ @Option(
name = "experimental_enable_cc_dynlibs_for_runtime",
defaultValue = "true",
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java
index 1396779f83..de7514e72b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java
@@ -111,7 +111,12 @@ public final class CppToolchainInfo {
/** Creates a CppToolchainInfo from CROSSTOOL info encapsulated in {@link CrosstoolInfo}. */
public static CppToolchainInfo create(
- PathFragment crosstoolTopPathFragment, Label toolchainLabel, CrosstoolInfo crosstoolInfo)
+ PathFragment crosstoolTopPathFragment,
+ Label toolchainLabel,
+ CrosstoolInfo crosstoolInfo,
+ boolean disableLegacyCrosstoolFields,
+ boolean disableCompilationModeFlags,
+ boolean disableLinkingModeFlags)
throws InvalidConfigurationException {
ImmutableMap<String, PathFragment> toolPaths =
computeToolPaths(crosstoolInfo, crosstoolTopPathFragment);
@@ -121,21 +126,24 @@ public final class CppToolchainInfo {
ImmutableListMultimap.Builder<LinkingMode, String> linkOptionsFromLinkingModeBuilder =
ImmutableListMultimap.builder();
- // If a toolchain supports dynamic libraries at all, there must be at least one
- // of the following:
- // - a "DYNAMIC" section in linking_mode_flags (even if no flags are needed)
- // - a non-empty list in one of the dynamicLibraryLinkerFlag fields
- // If none of the above contain data, then the toolchain can't do dynamic linking.
- boolean haveDynamicMode = crosstoolInfo.hasDynamicLinkingModeFlags();
- linkOptionsFromLinkingModeBuilder.putAll(
- LinkingMode.DYNAMIC, crosstoolInfo.getDynamicLinkingModeFlags());
- linkOptionsFromLinkingModeBuilder.putAll(
- LinkingMode.LEGACY_FULLY_STATIC, crosstoolInfo.getFullyStaticLinkingModeFlags());
- linkOptionsFromLinkingModeBuilder.putAll(
- LinkingMode.STATIC, crosstoolInfo.getMostlyStaticLinkingModeFlags());
- linkOptionsFromLinkingModeBuilder.putAll(
- LinkingMode.LEGACY_MOSTLY_STATIC_LIBRARIES,
- crosstoolInfo.getMostlyStaticLibrariesLinkingModeFlags());
+ boolean haveDynamicMode = false;
+ if (!disableLinkingModeFlags) {
+ // If a toolchain supports dynamic libraries at all, there must be at least one
+ // of the following:
+ // - a "DYNAMIC" section in linking_mode_flags (even if no flags are needed)
+ // - a non-empty list in one of the dynamicLibraryLinkerFlag fields
+ // If none of the above contain data, then the toolchain can't do dynamic linking.
+ haveDynamicMode = crosstoolInfo.hasDynamicLinkingModeFlags();
+ linkOptionsFromLinkingModeBuilder.putAll(
+ LinkingMode.DYNAMIC, crosstoolInfo.getDynamicLinkingModeFlags());
+ linkOptionsFromLinkingModeBuilder.putAll(
+ LinkingMode.LEGACY_FULLY_STATIC, crosstoolInfo.getFullyStaticLinkingModeFlags());
+ linkOptionsFromLinkingModeBuilder.putAll(
+ LinkingMode.STATIC, crosstoolInfo.getMostlyStaticLinkingModeFlags());
+ linkOptionsFromLinkingModeBuilder.putAll(
+ LinkingMode.LEGACY_MOSTLY_STATIC_LIBRARIES,
+ crosstoolInfo.getMostlyStaticLibrariesLinkingModeFlags());
+ }
ImmutableListMultimap.Builder<CompilationMode, String> cFlagsBuilder =
ImmutableListMultimap.builder();
@@ -144,33 +152,35 @@ public final class CppToolchainInfo {
ImmutableListMultimap.Builder<CompilationMode, String> linkOptionsFromCompilationModeBuilder =
ImmutableListMultimap.builder();
- cFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
- crosstoolInfo.getOptCompilationModeCompilerFlags());
- cxxFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
- crosstoolInfo.getOptCompilationModeCxxFlags());
- linkOptionsFromCompilationModeBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
- crosstoolInfo.getOptCompilationModeLinkerFlags());
- cFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
- crosstoolInfo.getDbgCompilationModeCompilerFlags());
- cxxFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
- crosstoolInfo.getDbgCompilationModeCxxFlags());
- linkOptionsFromCompilationModeBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
- crosstoolInfo.getDbgCompilationModeLinkerFlags());
- cFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
- crosstoolInfo.getFastbuildCompilationModeCompilerFlags());
- cxxFlagsBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
- crosstoolInfo.getFastbuildCompilationModeCxxFlags());
- linkOptionsFromCompilationModeBuilder.putAll(
- importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
- crosstoolInfo.getFastbuildCompilationModeLinkerFlags());
+ if (!disableCompilationModeFlags) {
+ cFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
+ crosstoolInfo.getOptCompilationModeCompilerFlags());
+ cxxFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
+ crosstoolInfo.getOptCompilationModeCxxFlags());
+ linkOptionsFromCompilationModeBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.OPT),
+ crosstoolInfo.getOptCompilationModeLinkerFlags());
+ cFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
+ crosstoolInfo.getDbgCompilationModeCompilerFlags());
+ cxxFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
+ crosstoolInfo.getDbgCompilationModeCxxFlags());
+ linkOptionsFromCompilationModeBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.DBG),
+ crosstoolInfo.getDbgCompilationModeLinkerFlags());
+ cFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
+ crosstoolInfo.getFastbuildCompilationModeCompilerFlags());
+ cxxFlagsBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
+ crosstoolInfo.getFastbuildCompilationModeCxxFlags());
+ linkOptionsFromCompilationModeBuilder.putAll(
+ importCompilationMode(CrosstoolConfig.CompilationMode.FASTBUILD),
+ crosstoolInfo.getFastbuildCompilationModeLinkerFlags());
+ }
try {
return new CppToolchainInfo(
@@ -191,11 +201,15 @@ public final class CppToolchainInfo {
defaultSysroot,
crosstoolInfo.getTargetLibc(),
crosstoolInfo.getHostSystemName(),
- crosstoolInfo.getDynamicLibraryLinkerFlags(),
- crosstoolInfo.getLinkerFlags(),
+ disableLegacyCrosstoolFields
+ ? ImmutableList.of()
+ : crosstoolInfo.getDynamicLibraryLinkerFlags(),
+ disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getLinkerFlags(),
linkOptionsFromLinkingModeBuilder.build(),
linkOptionsFromCompilationModeBuilder.build(),
- crosstoolInfo.getTestOnlyLinkerFlags(),
+ disableLegacyCrosstoolFields
+ ? ImmutableList.of()
+ : crosstoolInfo.getTestOnlyLinkerFlags(),
crosstoolInfo.getLdEmbedFlags(),
crosstoolInfo.getObjcopyEmbedFlags(),
toolchainLabel,
@@ -213,11 +227,11 @@ public final class CppToolchainInfo {
crosstoolInfo.getAbiVersion(),
crosstoolInfo.getTargetSystemName(),
computeAdditionalMakeVariables(crosstoolInfo),
- crosstoolInfo.getCompilerFlags(),
- crosstoolInfo.getCxxFlags(),
+ disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getCompilerFlags(),
+ disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getCxxFlags(),
cFlagsBuilder.build(),
cxxFlagsBuilder.build(),
- crosstoolInfo.getUnfilteredCxxFlags(),
+ disableLegacyCrosstoolFields ? ImmutableList.of() : crosstoolInfo.getUnfilteredCxxFlags(),
crosstoolInfo.supportsFission(),
crosstoolInfo.supportsStartEndLib(),
crosstoolInfo.supportsEmbeddedRuntimes(),