diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcBinaryRule.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcBinaryRule.java index df577ad7d99387..74d15d78f76091 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcBinaryRule.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/cpp/BazelCcBinaryRule.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.bazel.rules.cpp; import static com.google.devtools.build.lib.packages.Attribute.attr; +import static com.google.devtools.build.lib.packages.BuildType.LABEL; import static com.google.devtools.build.lib.syntax.Type.BOOLEAN; import com.google.devtools.build.lib.analysis.BaseRuleClasses; @@ -25,6 +26,7 @@ import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.rules.cpp.CppConfiguration; import com.google.devtools.build.lib.rules.cpp.CppRuleClasses; +import com.google.devtools.build.lib.util.FileType; /** Rule definition for cc_binary rules. */ public final class BazelCcBinaryRule implements RuleDefinition { @@ -73,6 +75,11 @@ public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { attr("linkshared", BOOLEAN) .value(false) .nonconfigurable("used to *determine* the rule's configuration")) + /* + A file with additional options to pass to the linker. The file can be generated during + execution. + */ + .add(attr("linkopts_file", LABEL).allowedFileTypes(FileType.of("linkopts_file"))) .cfg(CppRuleClasses.LIPO_ON_DEMAND) .build(); } 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 61f6c2a18cb13b..727db97d601425 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 @@ -13,6 +13,8 @@ // limitations under the License. package com.google.devtools.build.lib.rules.cpp; +import static com.google.devtools.build.lib.packages.BuildType.LABEL; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Preconditions; @@ -165,6 +167,7 @@ public ConfiguredTarget create(RuleContext context) return CcBinary.init(semantics, context, /*fake =*/ false); } + // TODO(plf): Split up this method. public static ConfiguredTarget init(CppSemantics semantics, RuleContext ruleContext, boolean fake) throws InterruptedException, RuleErrorException { ruleContext.checkSrcsSamePackage(true); @@ -286,6 +289,12 @@ public static ConfiguredTarget init(CppSemantics semantics, RuleContext ruleCont linkCompileOutputSeparately, semantics); linkActionBuilder.setUseTestOnlyFlags(ruleContext.isTestTarget()); + if (ruleContext.isAttrDefined("linkopts_file", LABEL)) { + Artifact linkoptsFile = ruleContext.getPrerequisiteArtifact("linkopts_file", Mode.DONT_CHECK); + if (linkoptsFile != null) { + linkActionBuilder.setLinkoptsParamFile(linkoptsFile); + } + } if (linkStaticness == LinkStaticness.DYNAMIC) { linkActionBuilder.setRuntimeInputs( ArtifactCategory.DYNAMIC_LIBRARY, 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 a12e21ddadd3a8..29e78c3d9d7392 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 @@ -439,6 +439,7 @@ public static String getCppActionConfigs( " implies: 'libraries_to_link'", " implies: 'force_pic_flags'", " implies: 'legacy_link_flags'", + " implies: 'linkopts_file'", " implies: 'linker_param_file'", " implies: 'fission_support'", " implies: 'sysroot'", @@ -462,6 +463,7 @@ public static String getCppActionConfigs( " implies: 'library_search_directories'", " implies: 'libraries_to_link'", " implies: 'legacy_link_flags'", + " implies: 'linkopts_file'", " implies: 'linker_param_file'", " implies: 'fission_support'", " implies: 'sysroot'", @@ -1056,6 +1058,29 @@ public static String getFeaturesToAppearLastInToolchain( " }", " }", "}"), + ifTrue( + !existingFeatureNames.contains("linkopts_file"), + "feature {", + " name: 'linkopts_file'", + " flag_set {", + " expand_if_all_available: 'linkopts_file'", + " action: 'c++-link-executable'", + " action: 'c++-link-dynamic-library'", + " flag_group {", + " flag: '-Wl,@%{linkopts_file}'", + " }", + " }", + " flag_set {", + " expand_if_all_available: 'linkopts_file'", + " action: 'c++-link-static-library'", + " action: 'c++-link-alwayslink-static-library'", + " action: 'c++-link-pic-static-library'", + " action: 'c++-link-alwayslink-pic-static-library'", + " flag_group {", + " flag: '@%{linkopts_file}'", + " }", + " }", + "}"), ifTrue( !existingFeatureNames.contains("linker_param_file"), "feature {", 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 200bd3a7aebd8a..e0cd9a44d9e82d 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 @@ -111,6 +111,9 @@ public class CppLinkActionBuilder { */ public static final String LINKER_PARAM_FILE_VARIABLE = "linker_param_file"; + /** A build variable for linker flags read from a file provided by the user. */ + public static final String LINK_OPTS_FILE_VARIABLE = "linkopts_file"; + /** A build variable for the execpath of the output of the linker. */ public static final String OUTPUT_EXECPATH_VARIABLE = "output_execpath"; @@ -195,6 +198,7 @@ public class CppLinkActionBuilder { private final ImmutableSet.Builder linkstampsBuilder = ImmutableSet.builder(); private ImmutableList additionalLinkstampDefines = ImmutableList.of(); private final List linkopts = new ArrayList<>(); + private Artifact linkoptsFile; private LinkTargetType linkType = LinkTargetType.STATIC_LIBRARY; private LinkStaticness linkStaticness = LinkStaticness.FULLY_STATIC; private String libraryIdentifier = null; @@ -918,6 +922,7 @@ public CppLinkAction build() throws InterruptedException { runtimeLinkerInputs, /* output= */ null, paramFile, + linkoptsFile, thinltoParamFile, thinltoMergedObjectFile, ltoOutputRootPrefix, @@ -932,6 +937,7 @@ public CppLinkAction build() throws InterruptedException { runtimeLinkerInputs, output, paramFile, + linkoptsFile, thinltoParamFile, thinltoMergedObjectFile, /* ltoOutputRootPrefix= */ PathFragment.EMPTY_FRAGMENT, @@ -1273,7 +1279,7 @@ public CppLinkActionBuilder addVariablesExtensions(List vari for (VariablesExtension variablesExtension : variablesExtensions) { addVariablesExtension(variablesExtension); } - return this; + return this; } /** @@ -1474,6 +1480,15 @@ public CppLinkActionBuilder addLinkParams( return this; } + /** Will pass a file with additional options to the linker. */ + public CppLinkActionBuilder setLinkoptsParamFile(Artifact linkoptsFile) { + Preconditions.checkState(this.linkoptsFile == null); + Preconditions.checkNotNull(linkoptsFile); + this.linkoptsFile = linkoptsFile; + addActionInput(linkoptsFile); + return this; + } + /** Sets whether this link action will be used for a cc_fake_binary; false by default. */ public CppLinkActionBuilder setFake(boolean fake) { this.fake = fake; @@ -1593,6 +1608,7 @@ private class CppLinkVariablesExtension implements VariablesExtension { private final Artifact interfaceLibraryBuilder; private final Artifact interfaceLibraryOutput; private final Artifact paramFile; + private final Artifact linkoptsFile; private final Artifact thinltoParamFile; private final Artifact thinltoMergedObjectFile; private final PathFragment ltoOutputRootPrefix; @@ -1607,6 +1623,7 @@ public CppLinkVariablesExtension( ImmutableList runtimeLinkerInputs, Artifact output, Artifact paramFile, + Artifact linkoptsFile, Artifact thinltoParamFile, Artifact thinltoMergedObjectFile, PathFragment ltoOutputRootPrefix, @@ -1621,6 +1638,7 @@ public CppLinkVariablesExtension( this.interfaceLibraryBuilder = interfaceLibraryBuilder; this.interfaceLibraryOutput = interfaceLibraryOutput; this.paramFile = paramFile; + this.linkoptsFile = linkoptsFile; this.thinltoParamFile = thinltoParamFile; this.thinltoMergedObjectFile = thinltoMergedObjectFile; this.ltoOutputRootPrefix = ltoOutputRootPrefix; @@ -1679,6 +1697,10 @@ public void addVariables(Variables.Builder buildVariables) { buildVariables.addStringVariable(LINKER_PARAM_FILE_VARIABLE, paramFile.getExecPathString()); } + if (linkoptsFile != null) { + buildVariables.addStringVariable(LINK_OPTS_FILE_VARIABLE, linkoptsFile.getExecPathString()); + } + // output exec path if (outputArtifact != null) { buildVariables.addStringVariable( diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java index aa21798b4ca478..1f039cf09532c2 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/LinkBuildVariablesTest.java @@ -104,6 +104,26 @@ public void testLinkerParamFileIsExported() throws Exception { assertThat(variableValue).matches(".*bin/x/bin" + OsUtils.executableExtension() + "-2.params$"); } + @Test + public void testLinkoptsFileIsExported() throws Exception { + AnalysisMock.get().ccSupport().setupCrosstool(mockToolsConfig); + useConfiguration(); + + scratch.file( + "x/BUILD", + "cc_binary(", + " name = 'bin',", + " srcs = ['bin.cc'],", + " linkopts_file= 'bin.linkopts_file'", + ")"); + + ConfiguredTarget target = getConfiguredTarget("//x:bin"); + Variables variables = getLinkBuildVariables(target, Link.LinkTargetType.EXECUTABLE); + String variableValue = + getVariableValue(variables, CppLinkActionBuilder.LINK_OPTS_FILE_VARIABLE); + assertThat(variableValue).matches("x/bin.linkopts_file"); + } + @Test public void testInterfaceLibraryBuildingVariablesWhenGenerationPossible() throws Exception { // Make sure the interface shared object generation is enabled in the configuration diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl index 8f87512fd86fbe..d69036d39d1146 100644 --- a/tools/cpp/CROSSTOOL.tpl +++ b/tools/cpp/CROSSTOOL.tpl @@ -424,6 +424,7 @@ toolchain { implies: 'input_param_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' implies: 'use_linker' @@ -443,6 +444,7 @@ toolchain { implies: 'input_param_flags' implies: 'legacy_link_flags' implies: 'linker_subsystem_flag' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' implies: 'use_linker' @@ -460,6 +462,7 @@ toolchain { implies: 'nologo' implies: 'archiver_flags' implies: 'input_param_flags' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' } @@ -473,6 +476,7 @@ toolchain { implies: 'nologo' implies: 'archiver_flags' implies: 'input_param_flags' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' } @@ -488,6 +492,7 @@ toolchain { implies: 'nologo' implies: 'archiver_flags' implies: 'input_param_flags' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' } @@ -501,6 +506,7 @@ toolchain { implies: 'nologo' implies: 'archiver_flags' implies: 'input_param_flags' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' } @@ -512,6 +518,7 @@ toolchain { tool_path: '%{msvc_lib_path}' } implies: 'nologo' + implies: 'linkopts_file' implies: 'linker_param_file' implies: 'msvc_env' } @@ -847,6 +854,22 @@ toolchain { } } + feature { + name: 'linkopts_file' + flag_set { + expand_if_all_available: 'linkopts_file' + action: 'c++-link-executable' + action: 'c++-link-dynamic-library' + action: 'c++-link-static-library' + action: 'c++-link-alwayslink-static-library' + action: 'c++-link-pic-static-library' + action: 'c++-link-alwayslink-pic-static-library' + flag_group { + flag: '@%{linkopts_file}' + } + } + } + feature { name: 'linker_param_file' flag_set { diff --git a/tools/osx/crosstool/CROSSTOOL.tpl b/tools/osx/crosstool/CROSSTOOL.tpl index e16052b0f758cb..d0058a70235406 100644 --- a/tools/osx/crosstool/CROSSTOOL.tpl +++ b/tools/osx/crosstool/CROSSTOOL.tpl @@ -1143,6 +1143,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -1627,6 +1648,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -1650,6 +1672,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -1666,6 +1689,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -1680,6 +1704,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -1694,6 +1719,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -1708,6 +1734,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -2857,6 +2884,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -3343,6 +3391,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -3366,6 +3415,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -3382,6 +3432,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -3396,6 +3447,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -3410,6 +3462,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -3424,6 +3477,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -4575,6 +4629,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -5061,6 +5136,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -5084,6 +5160,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -5100,6 +5177,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -5114,6 +5192,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -5128,6 +5207,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -5142,6 +5222,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -6313,6 +6394,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -6806,6 +6908,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -6830,6 +6933,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -6847,6 +6951,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -6861,6 +6966,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -6875,6 +6981,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -6889,6 +6996,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -8038,6 +8146,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -8524,6 +8653,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -8547,6 +8677,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -8563,6 +8694,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -8577,6 +8709,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -8591,6 +8724,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -8605,6 +8739,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -9744,6 +9879,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -10228,6 +10384,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -10251,6 +10408,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -10267,6 +10425,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -10281,6 +10440,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -10295,6 +10455,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -10309,6 +10470,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -11450,6 +11612,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -11934,6 +12117,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -11957,6 +12141,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -11973,6 +12158,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -11987,6 +12173,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -12001,6 +12188,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -12015,6 +12203,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -13176,6 +13365,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -13667,6 +13877,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -13691,6 +13902,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -13708,6 +13920,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -13722,6 +13935,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -13736,6 +13950,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -13750,6 +13965,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -14889,6 +15105,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -15373,6 +15610,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -15396,6 +15634,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -15412,6 +15651,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -15426,6 +15666,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -15440,6 +15681,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -15454,6 +15696,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -16596,6 +16839,27 @@ toolchain { expand_if_all_available: "unfiltered_compile_flags" } } + feature { + name: "linkopts_file" + flag_set { + action: "c++-link-executable" + action: "c++-link-dynamic-library" + flag_group { + flag: "-Wl,@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + flag_set { + action: "c++-link-static-library" + action: "c++-link-alwayslink-static-library" + action: "c++-link-pic-static-library" + action: "c++-link-alwayslink-pic-static-library" + flag_group { + flag: "@%{linkopts_file}" + } + expand_if_all_available: "linkopts_file" + } + } feature { name: "linker_param_file" flag_set { @@ -17080,6 +17344,7 @@ toolchain { implies: "force_pic_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -17103,6 +17368,7 @@ toolchain { implies: "input_param_flags" implies: "legacy_link_flags" implies: "strip_debug_symbols" + implies: "linkopts_file" implies: "linker_param_file" implies: "version_min" implies: "apple_env" @@ -17119,6 +17385,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -17133,6 +17400,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -17147,6 +17415,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" } @@ -17161,6 +17430,7 @@ toolchain { implies: "runtime_root_flags" implies: "archiver_flags" implies: "input_param_flags" + implies: "linkopts_file" implies: "linker_param_file" implies: "apple_env" }