diff options
12 files changed, 450 insertions, 165 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 21ccb4a116..d5f1fba1f8 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 @@ -116,9 +116,9 @@ public final class CcCommon { public static final ImmutableSet<String> ALL_LINK_ACTIONS = ImmutableSet.of( + LinkTargetType.EXECUTABLE.getActionName(), Link.LinkTargetType.DYNAMIC_LIBRARY.getActionName(), - Link.LinkTargetType.NODEPS_DYNAMIC_LIBRARY.getActionName(), - LinkTargetType.EXECUTABLE.getActionName()); + Link.LinkTargetType.NODEPS_DYNAMIC_LIBRARY.getActionName()); public static final ImmutableSet<String> ALL_ARCHIVE_ACTIONS = ImmutableSet.of(Link.LinkTargetType.STATIC_LIBRARY.getActionName()); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java index efd741a6c3..36d754e61e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppActionConfigs.java @@ -462,6 +462,7 @@ public class CppActionConfigs { " implies: 'library_search_directories'", " implies: 'libraries_to_link'", " implies: 'force_pic_flags'", + " implies: 'user_link_flags'", " implies: 'legacy_link_flags'", " implies: 'linker_param_file'", " implies: 'fission_support'", @@ -485,6 +486,7 @@ public class CppActionConfigs { " implies: 'runtime_library_search_directories'", " implies: 'library_search_directories'", " implies: 'libraries_to_link'", + " implies: 'user_link_flags'", " implies: 'legacy_link_flags'", " implies: 'linker_param_file'", " implies: 'fission_support'", @@ -508,6 +510,7 @@ public class CppActionConfigs { " implies: 'runtime_library_search_directories'", " implies: 'library_search_directories'", " implies: 'libraries_to_link'", + " implies: 'user_link_flags'", " implies: 'legacy_link_flags'", " implies: 'linker_param_file'", " implies: 'fission_support'", @@ -854,6 +857,21 @@ public class CppActionConfigs { " }", "}"), ifTrue( + !existingFeatureNames.contains("user_link_flags"), + "feature {", + " name: 'user_link_flags'", + " flag_set {", + " expand_if_all_available: 'user_link_flags'", + " action: 'c++-link-executable'", + " action: 'c++-link-dynamic-library'", + " action: 'c++-link-nodeps-dynamic-library'", + " flag_group {", + " iterate_over: 'user_link_flags'", + " flag: '%{user_link_flags}'", + " }", + " }", + "}"), + ifTrue( !existingFeatureNames.contains("legacy_link_flags"), "feature {", " name: 'legacy_link_flags'", 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 d5e692f75f..b338d5b173 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 @@ -86,6 +86,7 @@ import javax.annotation.Nullable; @ThreadCompatible public class CppCompileAction extends AbstractAction implements IncludeScannable, ExecutionInfoSpecifier, CommandAction { + private static final PathFragment BUILD_PATH_FRAGMENT = PathFragment.create("BUILD"); private static final int VALIDATION_DEBUG = 0; // 0==none, 1==warns/errors, 2==all diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java index 9ec07a3177..69294f04ef 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java @@ -686,19 +686,6 @@ public class CppLinkActionBuilder { List<String> result = new ArrayList<>(); - /* - * For backwards compatibility, linkopts come _after_ inputFiles. - * This is needed to allow linkopts to contain libraries and - * positional library-related options such as - * -Wl,--begin-group -lfoo -lbar -Wl,--end-group - * or - * -Wl,--as-needed -lfoo -Wl,--no-as-needed - * - * As for the relative order of the three different flavours of linkopts - * (global defaults, per-target linkopts, and command-line linkopts), - * we have no idea what the right order should be, or if anyone cares. - */ - result.addAll(linkopts); // Extra toolchain link options based on the output's link staticness. if (fullyStatic) { result.addAll( @@ -734,11 +721,15 @@ public class CppLinkActionBuilder { // distinguish between shared libraries and executables, we could add additional // command line / CROSSTOOL flags that distinguish them. But as long as this is // the only relevant use case we're just special-casing it here. + return ImmutableList.copyOf(removePieIfCreatingSharedLibrary(result)); + } + + private Iterable<String> removePieIfCreatingSharedLibrary(List<String> flags) { if (linkType == LinkTargetType.DYNAMIC_LIBRARY) { - Iterables.removeIf(result, Predicates.equalTo("-pie")); + return Iterables.filter(flags, Predicates.not(Predicates.equalTo("-pie"))); + } else { + return flags; } - - return ImmutableList.copyOf(result); } /** Builds the Action as configured and returns it. */ @@ -1084,11 +1075,13 @@ public class CppLinkActionBuilder { linkType.linkerOrArchiver() == LinkerOrArchiver.ARCHIVER ? ImmutableList.of() : linkoptsForVariables; - linkCommandLineBuilder.setLinkopts(linkoptsForVariables); CcToolchainVariables patchedVariables = new CcToolchainVariables.Builder(buildVariables) .addStringSequenceVariable( + LinkBuildVariables.USER_LINK_FLAGS.getVariableName(), + removePieIfCreatingSharedLibrary(linkoptsForVariables)) + .addStringSequenceVariable( LinkBuildVariables.LEGACY_LINK_FLAGS.getVariableName(), getToolchainFlags(linkoptsForVariables)) .build(); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java index 76018356ea..ffbfd76b8d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/Link.java @@ -28,6 +28,24 @@ import com.google.devtools.build.lib.util.FileTypeSet; */ public abstract class Link { + /** Name of the action producing static library. */ + public static final String CPP_LINK_STATIC_LIBRARY_ACTION_NAME = "c++-link-static-library"; + /** Name of the action producing dynamic library from cc_library. */ + public static final String CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME = + "c++-link-nodeps-dynamic-library"; + /** Name of the action producing dynamic library from cc_binary. */ + public static final String CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME = "c++-link-dynamic-library"; + /** Name of the action producing executable binary. */ + public static final String CPP_LINK_EXECUTABLE_ACTION_NAME = "c++-link-executable"; + /** Name of the objc action producing static library */ + public static final String OBJC_ARCHIVE_ACTION_NAME = "objc-archive"; + /** Name of the objc action producing dynamic library */ + public static final String OBJC_FULLY_LINK_ACTION_NAME = "objc-fully-link"; + /** Name of the objc action producing objc executable binary */ + public static final String OBJC_EXECUTABLE_ACTION_NAME = "objc-executable"; + /** Name of the objc action producing objc++ executable binary */ + public static final String OBJCPP_EXECUTABLE_ACTION_NAME = "objc++-executable"; + private Link() {} // uninstantiable /** @@ -98,7 +116,7 @@ public abstract class Link { STATIC_LIBRARY( ".a", LinkerOrArchiver.ARCHIVER, - "c++-link-static-library", + CPP_LINK_STATIC_LIBRARY_ACTION_NAME, Picness.NOPIC, ArtifactCategory.STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -107,7 +125,7 @@ public abstract class Link { OBJC_ARCHIVE( ".a", LinkerOrArchiver.ARCHIVER, - "objc-archive", + OBJC_ARCHIVE_ACTION_NAME, Picness.NOPIC, ArtifactCategory.STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -116,7 +134,7 @@ public abstract class Link { OBJC_FULLY_LINKED_ARCHIVE( ".a", LinkerOrArchiver.ARCHIVER, - "objc-fully-link", + OBJC_FULLY_LINK_ACTION_NAME, Picness.NOPIC, ArtifactCategory.STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -125,7 +143,7 @@ public abstract class Link { OBJC_EXECUTABLE( "", LinkerOrArchiver.LINKER, - "objc-executable", + OBJC_EXECUTABLE_ACTION_NAME, Picness.NOPIC, ArtifactCategory.EXECUTABLE, Executable.EXECUTABLE), @@ -134,7 +152,7 @@ public abstract class Link { OBJCPP_EXECUTABLE( "", LinkerOrArchiver.LINKER, - "objc++-executable", + OBJCPP_EXECUTABLE_ACTION_NAME, Picness.NOPIC, ArtifactCategory.EXECUTABLE, Executable.EXECUTABLE), @@ -143,7 +161,7 @@ public abstract class Link { PIC_STATIC_LIBRARY( ".pic.a", LinkerOrArchiver.ARCHIVER, - "c++-link-static-library", + CPP_LINK_STATIC_LIBRARY_ACTION_NAME, Picness.PIC, ArtifactCategory.STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -152,7 +170,7 @@ public abstract class Link { INTERFACE_DYNAMIC_LIBRARY( ".ifso", LinkerOrArchiver.LINKER, - "c++-link-dynamic-library", + CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME, Picness.NOPIC, // Actually PIC but it's not indicated in the file name ArtifactCategory.INTERFACE_LIBRARY, Executable.NOT_EXECUTABLE), @@ -161,7 +179,7 @@ public abstract class Link { NODEPS_DYNAMIC_LIBRARY( ".so", LinkerOrArchiver.LINKER, - "c++-link-nodeps-dynamic-library", + CPP_LINK_NODEPS_DYNAMIC_LIBRARY_ACTION_NAME, Picness.NOPIC, // Actually PIC but it's not indicated in the file name ArtifactCategory.DYNAMIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -169,7 +187,7 @@ public abstract class Link { DYNAMIC_LIBRARY( ".so", LinkerOrArchiver.LINKER, - "c++-link-dynamic-library", + CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME, Picness.NOPIC, // Actually PIC but it's not indicated in the file name ArtifactCategory.DYNAMIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -178,7 +196,7 @@ public abstract class Link { ALWAYS_LINK_STATIC_LIBRARY( ".lo", LinkerOrArchiver.ARCHIVER, - "c++-link-static-library", + CPP_LINK_STATIC_LIBRARY_ACTION_NAME, Picness.NOPIC, ArtifactCategory.ALWAYSLINK_STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -187,7 +205,7 @@ public abstract class Link { ALWAYS_LINK_PIC_STATIC_LIBRARY( ".pic.lo", LinkerOrArchiver.ARCHIVER, - "c++-link-static-library", + CPP_LINK_STATIC_LIBRARY_ACTION_NAME, Picness.PIC, ArtifactCategory.ALWAYSLINK_STATIC_LIBRARY, Executable.NOT_EXECUTABLE), @@ -196,7 +214,7 @@ public abstract class Link { EXECUTABLE( "", LinkerOrArchiver.LINKER, - "c++-link-executable", + CPP_LINK_EXECUTABLE_ACTION_NAME, Picness.NOPIC, // Picness is not indicate in the file name ArtifactCategory.EXECUTABLE, Executable.EXECUTABLE); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java index 34d39c3690..248c1b4a7c 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariables.java @@ -61,6 +61,8 @@ public enum LinkBuildVariables { INTERFACE_LIBRARY_OUTPUT("interface_library_output_path"), /** Linker flags coming from the legacy crosstool fields. */ LEGACY_LINK_FLAGS("legacy_link_flags"), + /** Linker flags coming from the --linkopt or linkopts attribute. */ + USER_LINK_FLAGS("user_link_flags"), /** Path to which to write symbol counts. */ SYMBOL_COUNTS_OUTPUT("symbol_counts_output"), /** A build variable giving linkstamp paths. */ diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java index a1c037f96e..19a646506d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java @@ -50,7 +50,6 @@ public final class LinkCommandLine extends CommandLine { private final Iterable<Artifact> linkerInputArtifacts; private final LinkTargetType linkTargetType; private final Link.LinkingMode linkingMode; - private final ImmutableList<String> linkopts; @Nullable private final PathFragment toolchainLibrariesSolibDir; private final boolean nativeDeps; private final boolean useTestOnlyFlags; @@ -65,7 +64,6 @@ public final class LinkCommandLine extends CommandLine { Iterable<Artifact> linkerInputArtifacts, LinkTargetType linkTargetType, Link.LinkingMode linkingMode, - ImmutableList<String> linkopts, @Nullable PathFragment toolchainLibrariesSolibDir, boolean nativeDeps, boolean useTestOnlyFlags, @@ -81,7 +79,6 @@ public final class LinkCommandLine extends CommandLine { this.linkerInputArtifacts = Preconditions.checkNotNull(linkerInputArtifacts); this.linkTargetType = Preconditions.checkNotNull(linkTargetType); this.linkingMode = Preconditions.checkNotNull(linkingMode); - this.linkopts = linkopts; this.toolchainLibrariesSolibDir = toolchainLibrariesSolibDir; this.nativeDeps = nativeDeps; this.useTestOnlyFlags = useTestOnlyFlags; @@ -119,7 +116,12 @@ public final class LinkCommandLine extends CommandLine { * Returns the additional linker options for this link. */ public ImmutableList<String> getLinkopts() { - return linkopts; + if (variables.isAvailable(LinkBuildVariables.USER_LINK_FLAGS.getVariableName())) { + return CcToolchainVariables.toStringList( + variables, LinkBuildVariables.USER_LINK_FLAGS.getVariableName()); + } else { + return ImmutableList.of(); + } } /** Returns the path to the linker. */ @@ -413,7 +415,6 @@ public final class LinkCommandLine extends CommandLine { private Iterable<Artifact> linkerInputArtifacts = ImmutableList.of(); @Nullable private LinkTargetType linkTargetType; private Link.LinkingMode linkingMode = Link.LinkingMode.LEGACY_FULLY_STATIC; - private ImmutableList<String> linkopts = ImmutableList.of(); @Nullable private PathFragment toolchainLibrariesSolibDir; private boolean nativeDeps; private boolean useTestOnlyFlags; @@ -437,10 +438,10 @@ public final class LinkCommandLine extends CommandLine { if (ruleContext != null) { Preconditions.checkNotNull(featureConfiguration); } - + if (variables == null) { variables = CcToolchainVariables.EMPTY; - } + } String actionName = linkTargetType.getActionName(); @@ -451,7 +452,6 @@ public final class LinkCommandLine extends CommandLine { linkerInputArtifacts, linkTargetType, linkingMode, - linkopts, toolchainLibrariesSolibDir, nativeDeps, useTestOnlyFlags, @@ -495,17 +495,6 @@ public final class LinkCommandLine extends CommandLine { } /** - * Sets the linker options. These are passed to the linker in addition to the other linker - * options like linker inputs, symbol count options, etc. The {@link #build} method throws an - * exception if the linker options are non-empty for a static link (see {@link - * LinkTargetType#linkerOrArchiver()}). - */ - public Builder setLinkopts(ImmutableList<String> linkopts) { - this.linkopts = linkopts; - return this; - } - - /** * Sets how static the link is supposed to be. For static target types (see {@link * LinkTargetType#linkerOrArchiver()}}), the {@link #build} method throws an exception if this * is not {@link Link.LinkingMode#LEGACY_FULLY_STATIC}. The default setting is {@link diff --git a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL index f283dce3fe..abedb0cb24 100644 --- a/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL +++ b/src/test/java/com/google/devtools/build/lib/packages/util/MOCK_OSX_CROSSTOOL @@ -216,7 +216,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -749,6 +748,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -866,7 +881,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -1131,7 +1145,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -1156,7 +1169,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -1175,7 +1187,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -1954,7 +1965,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -2487,6 +2497,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -2604,7 +2630,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -2869,7 +2894,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -2894,7 +2918,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -2913,7 +2936,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -3687,7 +3709,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -4220,6 +4241,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -4337,7 +4374,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -4602,7 +4638,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -4627,7 +4662,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -4646,7 +4680,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -5420,7 +5453,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -5953,6 +5985,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -6070,7 +6118,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -6335,7 +6382,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -6360,7 +6406,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -6379,7 +6424,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -7157,7 +7201,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -7690,6 +7733,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -7807,7 +7866,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -8076,7 +8134,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -8101,7 +8158,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -8120,7 +8176,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -8900,7 +8955,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -9435,6 +9489,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -9552,7 +9622,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -9821,7 +9890,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -9846,7 +9914,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -9865,7 +9932,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -10646,7 +10712,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -11179,6 +11244,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -11296,7 +11377,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -11589,7 +11669,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -11614,7 +11693,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -11633,7 +11711,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -12420,7 +12497,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -12953,6 +13029,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -13070,7 +13162,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -13339,7 +13430,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -13364,7 +13454,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -13383,7 +13472,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -14163,7 +14251,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -14696,6 +14783,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -14813,7 +14916,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -15104,7 +15206,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -15129,7 +15230,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -15148,7 +15248,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -15926,7 +16025,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -16461,6 +16559,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -16578,7 +16692,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -16869,7 +16982,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -16894,7 +17006,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -16913,7 +17024,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -17692,7 +17802,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -18225,6 +18334,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -18342,7 +18467,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -18657,7 +18781,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -18682,7 +18805,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -18701,7 +18823,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -19486,7 +19607,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -20019,6 +20139,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -20136,7 +20272,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -20427,7 +20562,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -20452,7 +20586,6 @@ toolchain { action: "c++-link-executable" action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -20471,7 +20604,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl index b4d9edd713..38df97f323 100644 --- a/tools/cpp/CROSSTOOL.tpl +++ b/tools/cpp/CROSSTOOL.tpl @@ -378,6 +378,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -397,6 +398,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -418,6 +420,7 @@ toolchain { implies: 'linkstamps' implies: 'output_execpath_flags' implies: 'input_param_flags' + implies: 'user_link_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' implies: 'linker_param_file' @@ -738,8 +741,8 @@ toolchain { } # Since this feature is declared earlier in the CROSSTOOL than - # "legacy_link_flags", this feature will be applied prior to it anwyhere they - # are both implied. And since "legacy_link_flags" contains the linkopts from + # "user_link_flags", this feature will be applied prior to it anwyhere they + # are both implied. And since "user_link_flags" contains the linkopts from # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD # file. feature { @@ -754,11 +757,24 @@ toolchain { } } - # The "legacy_link_flags" may contain user-defined linkopts (from build rules) + # The "user_link_flags" contains user-defined linkopts (from build rules) # so it should be defined after features that declare user-overridable flags. # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag # but we want to let the user override it, therefore "link_flag_subsystem" is - # defined earlier in the CROSSTOOL file than "legacy_link_flags". + # defined earlier in the CROSSTOOL file than "user_link_flags". + feature { + name: 'user_link_flags' + flag_set { + expand_if_all_available: 'user_link_flags' + action: 'c++-link-executable' + action: 'c++-link-dynamic-library' + action: "c++-link-nodeps-dynamic-library" + flag_group { + iterate_over: 'user_link_flags' + flag: '%{user_link_flags}' + } + } + } feature { name: 'legacy_link_flags' flag_set { diff --git a/tools/cpp/crosstool_lib.bzl b/tools/cpp/crosstool_lib.bzl index 1ddd838d0a..a6c4916947 100644 --- a/tools/cpp/crosstool_lib.bzl +++ b/tools/cpp/crosstool_lib.bzl @@ -158,6 +158,12 @@ def get_features_to_appear_first(platform): ["-pie"], expand_if_all_available=["force_pic"]), simple_feature( + "user_link_flags", + LINK_ACTIONS, + ["%{user_link_flags}"], + iterate_over="user_link_flags", + expand_if_all_available=["user_link_flags"]), + simple_feature( "legacy_link_flags", LINK_ACTIONS, ["%{legacy_link_flags}"], diff --git a/tools/cpp/crosstool_utils.bzl b/tools/cpp/crosstool_utils.bzl index 06bfc63202..238d0cff6d 100644 --- a/tools/cpp/crosstool_utils.bzl +++ b/tools/cpp/crosstool_utils.bzl @@ -31,9 +31,9 @@ COMPILE_ACTIONS = [ # All possible C++ link actions LINK_ACTIONS = [ + "c++-link-executable", "c++-link-dynamic-library", "c++-link-nodeps-dynamic-library", - "c++-link-executable", ] # All possible C++ archive actions diff --git a/tools/osx/crosstool/CROSSTOOL.tpl b/tools/osx/crosstool/CROSSTOOL.tpl index 63d1cad81f..36b30aa215 100644 --- a/tools/osx/crosstool/CROSSTOOL.tpl +++ b/tools/osx/crosstool/CROSSTOOL.tpl @@ -192,7 +192,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -659,7 +658,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -721,7 +719,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -987,6 +984,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -1079,7 +1092,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -1101,7 +1113,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -1820,7 +1831,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -2296,7 +2306,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -2358,7 +2367,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -2624,6 +2632,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -2721,7 +2745,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -2743,7 +2766,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -3464,7 +3486,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -3940,7 +3961,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -4002,7 +4022,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -4270,6 +4289,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -4367,7 +4402,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -4389,7 +4423,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -5111,7 +5144,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -5587,7 +5619,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -5649,7 +5680,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -5915,6 +5945,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -6033,7 +6079,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -6055,7 +6100,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -6786,7 +6830,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -7262,7 +7305,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -7324,7 +7366,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -7590,6 +7631,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -7687,7 +7744,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -7709,7 +7765,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -8430,7 +8485,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -8906,7 +8960,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -8968,7 +9021,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -9234,6 +9286,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -9321,7 +9389,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -9343,7 +9410,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -10062,7 +10128,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -10538,7 +10603,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -10600,7 +10664,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -10868,6 +10931,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -10955,7 +11034,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -10977,7 +11055,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -11697,7 +11774,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -12173,7 +12249,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -12235,7 +12310,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -12501,6 +12575,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -12609,7 +12699,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -12631,7 +12720,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -13360,7 +13448,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -13836,7 +13923,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -13898,7 +13984,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -14164,6 +14249,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -14251,7 +14352,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -14273,7 +14373,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -14993,7 +15092,6 @@ toolchain { action: "c++-header-preprocessing" action: "c++-module-compile" action: "c++-module-codegen" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -15469,7 +15567,6 @@ toolchain { action: "c++-link-dynamic-library" action: "c++-link-nodeps-dynamic-library" action: "linkstamp-compile" - action: "lto-backend" action: "clif-match" flag_group { flag: "--sysroot=%{sysroot}" @@ -15531,7 +15628,6 @@ toolchain { action: "c++-module-codegen" action: "assemble" action: "preprocess-assemble" - action: "lto-backend" flag_group { flag: "-gsplit-dwarf" } @@ -15797,6 +15893,22 @@ toolchain { } } feature { + name: "user_link_flags" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + action: "c++-link-nodeps-dynamic-library" + action: "objc-executable" + action: "objc++-executable" + flag_group { + flag: "%{user_link_flags}" + iterate_over: "user_link_flags" + } + expand_if_all_available: "user_link_flags" + } + enabled: true + } + feature { name: "legacy_link_flags" flag_set { action: "c++-link-executable" @@ -15884,7 +15996,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { @@ -15906,7 +16017,6 @@ toolchain { action: "c++-module-compile" action: "c++-module-codegen" action: "linkstamp-compile" - action: "lto-backend" action: "objc-compile" action: "objc++-compile" flag_group { |