From fb7c3738c43b070611e8250e4ffbbd5c53f0fb7f Mon Sep 17 00:00:00 2001 From: hlopko Date: Tue, 12 Feb 2019 05:33:46 -0800 Subject: [PATCH] Flip --incompatible_dont_emit_static_libgcc flag Closes #6825. Closes #6185. This is a rollforward of https://github.com/bazelbuild/bazel/commit/5d77edf4ff86e72d5e359f3bd52006d80e388c03 after Bazel with the flag was cut. RELNOTES: Incompatible flag `--incompatible_dont_emit_static_libgcc` has been flipped (https://github.com/bazelbuild/bazel/issues/6825) PiperOrigin-RevId: 233589665 --- .../build/lib/bazel/rules/BazelRulesModule.java | 14 ++++++++++++++ .../devtools/build/lib/rules/cpp/CcBinary.java | 10 ---------- .../build/lib/rules/cpp/CppConfiguration.java | 4 ---- .../devtools/build/lib/rules/cpp/CppOptions.java | 16 ---------------- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java index 8209ab9d6403c7..08f82386646ee0 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRulesModule.java @@ -40,6 +40,20 @@ public class BazelRulesModule extends BlazeModule { /** This is where deprecated options go to die. */ public static class GraveyardOptions extends OptionsBase { + @Option( + name = "incompatible_dont_emit_static_libgcc", + oldName = "experimental_dont_emit_static_libgcc", + defaultValue = "true", + documentationCategory = OptionDocumentationCategory.TOOLCHAIN, + effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.LOADING_AND_ANALYSIS}, + metadataTags = { + OptionMetadataTag.DEPRECATED, + OptionMetadataTag.INCOMPATIBLE_CHANGE, + OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES + }, + help = "Deprecated no-op.") + public boolean disableEmittingStaticLibgcc; + @Option( name = "incompatible_linkopts_in_user_link_flags", defaultValue = "true", diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java index 40a3500f466303..355c6a68c19c87 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java @@ -726,16 +726,6 @@ public static Pair createTransitiveLinkingActi NestedSetBuilder.wrap(Order.LINK_ORDER, precompiledLibraries.build())); ImmutableList.Builder userLinkflags = ImmutableList.builder(); - if (linkingMode != Link.LinkingMode.DYNAMIC - && !cppConfiguration.disableEmittingStaticLibgcc()) { - // Only force a static link of libgcc if static runtime linking is enabled (which - // can't be true if runtimeInputs is empty). - // TODO(bazel-team): Move this to CcToolchain. - if (!ccToolchain.getStaticRuntimeLinkInputs(ruleContext, featureConfiguration).isEmpty()) { - userLinkflags.add("-static-libgcc"); - } - } - userLinkflags.addAll(common.getLinkopts()); currentCcLinkingContextBuilder .addNonCodeInputs( 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 97de9205e57334..87f5cfb4860b0d 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 @@ -556,10 +556,6 @@ public static String getLegacyCrosstoolFieldErrorMessage(String field) { + "migration instructions)."; } - public boolean disableEmittingStaticLibgcc() { - return cppOptions.disableEmittingStaticLibgcc; - } - public boolean disableDepsetInUserFlags() { return cppOptions.disableDepsetInUserFlags; } 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 a721c2994552af..769c250039fa6d 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 @@ -727,21 +727,6 @@ public Label getFdoPrefetchHintsLabel() { + "(see https://github.com/bazelbuild/bazel/issues/7008 for migration instructions).") public boolean disableExpandIfAllAvailableInFlagSet; - @Option( - name = "incompatible_dont_emit_static_libgcc", - oldName = "experimental_dont_emit_static_libgcc", - defaultValue = "true", - documentationCategory = OptionDocumentationCategory.TOOLCHAIN, - effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.LOADING_AND_ANALYSIS}, - metadataTags = { - OptionMetadataTag.INCOMPATIBLE_CHANGE, - OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES - }, - help = - "If true, bazel will not add --static-libgcc to the linking command line, it will be " - + "the responsibility of the C++ toolchain to append this flag.") - public boolean disableEmittingStaticLibgcc; - @Option( name = "incompatible_disable_crosstool_file", defaultValue = "false", @@ -877,7 +862,6 @@ public FragmentOptions getHost() { host.doNotUseCpuTransformer = doNotUseCpuTransformer; host.disableGenruleCcToolchainDependency = disableGenruleCcToolchainDependency; - host.disableEmittingStaticLibgcc = disableEmittingStaticLibgcc; host.disableDepsetInUserFlags = disableDepsetInUserFlags; host.disableExpandIfAllAvailableInFlagSet = disableExpandIfAllAvailableInFlagSet; host.disableLegacyCcProvider = disableLegacyCcProvider;