Skip to content

Commit 0edd72c

Browse files
mai93copybara-github
authored andcommitted
Remove target libcTop label from CppOptions
the value of the flag seems to be no longer used PiperOrigin-RevId: 792662960 Change-Id: I1057b4fb5e837a74c051967740b3eb3d5b0ff6fd
1 parent 0d9e2b3 commit 0edd72c

File tree

4 files changed

+1
-88
lines changed

4 files changed

+1
-88
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -790,29 +790,6 @@ public boolean shareNativeDepsStarlark(StarlarkThread thread) throws EvalExcepti
790790
return shareNativeDeps();
791791
}
792792

793-
/**
794-
* Returns the value of the libc top-level directory (--grte_top) as specified on the command line
795-
*/
796-
@Nullable
797-
@StarlarkConfigurationField(
798-
name = "target_libc_top_DO_NOT_USE_ONLY_FOR_CC_TOOLCHAIN",
799-
doc = "DO NOT USE")
800-
public Label getTargetLibcTopLabel() {
801-
if (!isToolConfigurationDoNotUseWillBeRemovedFor129045294) {
802-
// This isn't for a platform-enabled C++ toolchain (legacy C++ toolchains evaluate in the
803-
// target configuration while platform-enabled toolchains evaluate in the exec configuration).
804-
// targetLibcTopLabel is only intended for platform-enabled toolchains and can cause errors
805-
// otherwise.
806-
//
807-
// For example: if a legacy-configured toolchain inherits a --grte_top pointing to an Android
808-
// runtime alias that select()s on a target Android CPU and an iOS dep changes the CPU to an
809-
// iOS CPU, the alias resolution fails. Legacy toolchains should read --grte_top through
810-
// libcTopLabel (which changes along with the iOS CPU change), not this.
811-
return null;
812-
}
813-
return cppOptions.targetLibcTopLabel;
814-
}
815-
816793
public boolean dontEnableHostNonhost() {
817794
return cppOptions.dontEnableHostNonhost;
818795
}

src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515

1616
import com.google.common.base.Splitter;
1717
import com.google.common.collect.ImmutableSet;
18-
import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
1918
import com.google.devtools.build.lib.analysis.config.CompilationMode;
2019
import com.google.devtools.build.lib.analysis.config.CoreOptionConverters.EmptyToNullLabelConverter;
2120
import com.google.devtools.build.lib.analysis.config.CoreOptionConverters.LabelConverter;
2221
import com.google.devtools.build.lib.analysis.config.FragmentOptions;
2322
import com.google.devtools.build.lib.analysis.config.PerLabelOptions;
2423
import com.google.devtools.build.lib.cmdline.Label;
25-
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
2624
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.DynamicMode;
2725
import com.google.devtools.build.lib.rules.cpp.CppConfiguration.StripMode;
2826
import com.google.devtools.common.options.Converter;
@@ -82,10 +80,7 @@ public static class LibcTopLabelConverter implements Converter<Label> {
8280
@Nullable
8381
@Override
8482
public Label convert(String input, Object conversionContext) throws OptionsParsingException {
85-
if (input.equals(TARGET_LIBC_TOP_NOT_YET_SET)) {
86-
return Label.createUnvalidated(
87-
PackageIdentifier.EMPTY_PACKAGE_ID, TARGET_LIBC_TOP_NOT_YET_SET);
88-
} else if (input.equals("default")) {
83+
if (input.equals("default")) {
8984
// This is needed for defining config_setting() values, the syntactic form
9085
// of which must be a String, to match absence of a --grte_top option.
9186
// "--grte_top=default" works on the command-line too,
@@ -693,42 +688,6 @@ public Label getMemProfProfileLabel() {
693688
+ "for the exec configuration.")
694689
public Label hostLibcTopLabel;
695690

696-
/** See {@link #targetLibcTopLabel} documentation. * */
697-
private static final String TARGET_LIBC_TOP_NOT_YET_SET = "TARGET LIBC TOP NOT YET SET";
698-
699-
/**
700-
* This is a fake option used to pass data from target configuration to the exec configuration.
701-
* It's a horrible hack that will be removed once toolchain-transitions are implemented.
702-
*
703-
* <p>We want to make sure this stays bound to the top-level configuration (as opposed to a
704-
* configuration that comes out of a transition). Otherwise we risk multiple exec configurations
705-
* writing to the same path and creating C++ action conflicts (C++ actions can not be shared
706-
* across configurations: see {@link ActionAnalysisMetadata#isShareable}).
707-
*
708-
* <p>To accomplish this, we initialize this to a special value that means "I haven't been set
709-
* yet" and use {@link #getNormalized} to rewrite it to {@link #libcTopLabel} <b>only</b> from
710-
* that default. Blaze always evaluates top-level configurations first, so they'll trigger this.
711-
* But no followup transitions can.
712-
*
713-
* <p>It's not sufficient to use null for the default. That wouldn't handle the case of the
714-
* top-level {@link #libcTopLabel} being null and {@link
715-
* com.google.devtools.build.lib.rules.android.AndroidConfiguration.Options#androidLibcTopLabel}
716-
* being non-null.
717-
*/
718-
// TODO(b/129045294): Remove once toolchain-transitions are implemented.
719-
@Option(
720-
name = "target libcTop label",
721-
defaultValue = TARGET_LIBC_TOP_NOT_YET_SET,
722-
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
723-
converter = LibcTopLabelConverter.class,
724-
effectTags = {
725-
OptionEffectTag.LOSES_INCREMENTAL_STATE,
726-
OptionEffectTag.AFFECTS_OUTPUTS,
727-
OptionEffectTag.LOADING_AND_ANALYSIS
728-
},
729-
metadataTags = {OptionMetadataTag.INTERNAL})
730-
public Label targetLibcTopLabel;
731-
732691
@Option(
733692
name = "experimental_inmemory_dotd_files",
734693
defaultValue = "true",
@@ -1041,20 +1000,4 @@ public Label getMemProfProfileLabel() {
10411000
metadataTags = {OptionMetadataTag.EXPERIMENTAL},
10421001
help = "If enabled, a Starlark version of compiling is used.")
10431002
public boolean experimentalStarlarkCompiling;
1044-
1045-
/** See {@link #targetLibcTopLabel} documentation. * */
1046-
@Override
1047-
public FragmentOptions getNormalized() {
1048-
CppOptions newOptions = (CppOptions) this.clone();
1049-
boolean changed = false;
1050-
if (targetLibcTopLabel != null
1051-
&& targetLibcTopLabel.getName().equals(TARGET_LIBC_TOP_NOT_YET_SET)) {
1052-
newOptions.targetLibcTopLabel = libcTopLabel;
1053-
changed = true;
1054-
}
1055-
if (changed) {
1056-
return newOptions;
1057-
}
1058-
return this;
1059-
}
10601003
}

src/main/starlark/builtins_bzl/common/builtin_exec_platforms.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ bazel_fragments["CppOptions"] = fragment(
293293
"//command_line_option:host_per_file_copt",
294294
"//command_line_option:host_grte_top",
295295
"//command_line_option:host_linkopt",
296-
"//command_line_option:target libcTop label",
297296
"//command_line_option:experimental_link_static_libraries_once",
298297
"//command_line_option:experimental_cc_implementation_deps",
299298
"//command_line_option:experimental_cpp_modules",

src/main/starlark/builtins_bzl/common/cc/cc_toolchain.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def _attributes(ctx):
8181
grep_includes = _single_file(ctx, "_grep_includes")
8282

8383
latebound_libc = _latebound_libc(ctx, "libc_top", "_libc_top")
84-
latebound_target_libc = _latebound_libc(ctx, "libc_top", "_target_libc_top")
8584

8685
all_files = _files(ctx, "all_files")
8786
return struct(
@@ -115,9 +114,7 @@ def _attributes(ctx):
115114
coverage_files = _files(ctx, "coverage_files") or all_files,
116115
compiler_files_without_includes = _files(ctx, "compiler_files_without_includes"),
117116
libc = _files(ctx, latebound_libc),
118-
target_libc = _files(ctx, latebound_target_libc),
119117
libc_top_label = _label(ctx, latebound_libc),
120-
target_libc_top_label = _label(ctx, latebound_target_libc),
121118
if_so_builder = ctx.file._interface_library_builder,
122119
allowlist_for_layering_check = _package_specification_provider(ctx, "disabling_parse_headers_and_layering_check_allowed"),
123120
build_info_files = _provider(ctx.attr._build_info_translator, OutputGroupInfo),
@@ -335,9 +332,6 @@ The label of the rule providing <code>cc_toolchain_config_info</code>.""",
335332
allow_single_file = True,
336333
cfg = "exec",
337334
),
338-
"_target_libc_top": attr.label(
339-
default = configuration_field(fragment = "cpp", name = "target_libc_top_DO_NOT_USE_ONLY_FOR_CC_TOOLCHAIN"),
340-
),
341335
"_whitelist_disabling_parse_headers_and_layering_check_allowed": attr.label(
342336
default = "@" + semantics.get_repo() + "//tools/build_defs/cc/whitelists/parse_headers_and_layering_check:disabling_parse_headers_and_layering_check_allowed",
343337
providers = [PackageSpecificationInfo],

0 commit comments

Comments
 (0)