diff --git a/site/docs/crosstool-reference.md b/site/docs/crosstool-reference.md index e114630aa0abce..0fadb74f263edd 100644 --- a/site/docs/crosstool-reference.md +++ b/site/docs/crosstool-reference.md @@ -1003,4 +1003,13 @@ conditions. static libraries. + + supports_interface_shared_libraries + + If enabled (and the option --interface_shared_objects is + set), Bazel will link targets that have linkstatic set to + False (cc_tests by default) against interface shared + libraries. This makes incremental relinking faster. + + 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 9c03f6408f4bd3..4a725e6bf7678f 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 @@ -351,7 +351,7 @@ public static ConfiguredTarget init(CppSemantics semantics, RuleContext ruleCont ruleContext.getConfiguration()) .fromCommon(common) .addDeps(ImmutableList.of(CppHelper.mallocForTarget(ruleContext))) - .emitInterfaceSharedObjects(true) + .emitInterfaceSharedLibraries(true) .setAlwayslink(false); ccLinkingOutputs = linkingHelper.link(ccCompilationOutputs); } @@ -700,10 +700,11 @@ public static ConfiguredTarget init(CppSemantics semantics, RuleContext ruleCont .setDynamicLinkType(linkType) .setLinkerOutputArtifact(binary) .setNeverLink(true) - .emitInterfaceSharedObjects( + .emitInterfaceSharedLibraries( isLinkShared(ruleContext) && featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS) - && CppHelper.useInterfaceSharedObjects(cppConfiguration, ccToolchain)) + && CppHelper.useInterfaceSharedLibraries( + cppConfiguration, ccToolchain, featureConfiguration)) .setPdbFile(pdbFile) .setFake(fake); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java index 2c247edfe5a48e..de63cc9cc46bc1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java @@ -157,7 +157,7 @@ public static void init( ruleContext.getConfiguration()) .fromCommon(common) .addLinkopts(common.getLinkopts()) - .emitInterfaceSharedObjects(true) + .emitInterfaceSharedLibraries(true) .setAlwayslink(alwaysLink) .setNeverLink(neverLink) .addLinkstamps(ruleContext.getPrerequisites("linkstamp", Mode.TARGET)); @@ -217,7 +217,8 @@ public static void init( ccToolchain, ruleContext.getConfiguration(), LinkTargetType.NODEPS_DYNAMIC_LIBRARY)); - if (CppHelper.useInterfaceSharedObjects(ccToolchain.getCppConfiguration(), ccToolchain)) { + if (CppHelper.useInterfaceSharedLibraries( + ccToolchain.getCppConfiguration(), ccToolchain, featureConfiguration)) { dynamicLibraries.add( CppHelper.getLinkedArtifact( ruleContext, @@ -241,7 +242,8 @@ public static void init( ccToolchain, ruleContext.getConfiguration(), LinkTargetType.NODEPS_DYNAMIC_LIBRARY)); - if (CppHelper.useInterfaceSharedObjects(ccToolchain.getCppConfiguration(), ccToolchain)) { + if (CppHelper.useInterfaceSharedLibraries( + ccToolchain.getCppConfiguration(), ccToolchain, featureConfiguration)) { dynamicLibraries.add( CppHelper.getLinkedArtifact( ruleContext, @@ -347,7 +349,11 @@ public static void init( if (!ccLinkingOutputs.isEmpty()) { outputGroups.putAll( addLinkerOutputArtifacts( - ruleContext, ccToolchain, ruleContext.getConfiguration(), ccCompilationOutputs)); + ruleContext, + ccToolchain, + ruleContext.getConfiguration(), + ccCompilationOutputs, + featureConfiguration)); } CcLinkingOutputs ccLinkingOutputsWithPrecompiledLibraries = addPrecompiledLibrariesToLinkingOutputs( @@ -558,7 +564,8 @@ private static Map> addLinkerOutputArtifacts( RuleContext ruleContext, CcToolchainProvider ccToolchain, BuildConfiguration configuration, - CcCompilationOutputs ccCompilationOutputs) + CcCompilationOutputs ccCompilationOutputs, + FeatureConfiguration featureConfiguration) throws RuleErrorException { NestedSetBuilder archiveFile = new NestedSetBuilder<>(Order.STABLE_ORDER); @@ -599,7 +606,8 @@ private static Map> addLinkerOutputArtifacts( Link.LinkTargetType.NODEPS_DYNAMIC_LIBRARY, /* linkedArtifactNameSuffix= */ "")); - if (CppHelper.useInterfaceSharedObjects(ccToolchain.getCppConfiguration(), ccToolchain)) { + if (CppHelper.useInterfaceSharedLibraries( + ccToolchain.getCppConfiguration(), ccToolchain, featureConfiguration)) { dynamicLibrary.add( CppHelper.getLinkedArtifact( ruleContext, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java index 7c19f0df97d6e9..8b63c040d5698a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java @@ -102,7 +102,7 @@ public CcLinkingOutputs getCcLinkingOutputs() { private boolean neverlink; private boolean checkDepsGenerateCpp = true; - private boolean emitInterfaceSharedObjects; + private boolean emitInterfaceSharedLibraries; private boolean shouldCreateDynamicLibrary = true; private boolean shouldCreateStaticLibraries = true; private boolean willOnlyBeLinkedIntoDynamicLibraries; @@ -307,8 +307,8 @@ public CcLinkingHelper setLinkedArtifactNameSuffix(String suffix) { * linker generates a dynamic library, and only if the crosstool supports it. The default is not * to generate interface dynamic libraries. */ - public CcLinkingHelper emitInterfaceSharedObjects(boolean emitInterfaceSharedObjects) { - this.emitInterfaceSharedObjects = emitInterfaceSharedObjects; + public CcLinkingHelper emitInterfaceSharedLibraries(boolean emitInterfaceSharedLibraries) { + this.emitInterfaceSharedLibraries = emitInterfaceSharedLibraries; return this; } @@ -394,7 +394,7 @@ public CcLinkingInfo buildCcLinkingInfoFromLibraryToLinkWrappers( * *

For dynamic libraries, this method can additionally create an interface shared library that * can be used for linking, but doesn't contain any executable code. This increases the number of - * cache hits for link actions. Call {@link #emitInterfaceSharedObjects(boolean)} to enable this + * cache hits for link actions. Call {@link #emitInterfaceSharedLibraries(boolean)} to enable this * behavior. * * @throws RuleErrorException @@ -603,8 +603,8 @@ private void createDynamicLibrary( List sonameLinkopts = ImmutableList.of(); Artifact soInterface = null; - if (CppHelper.useInterfaceSharedObjects(cppConfiguration, ccToolchain) - && emitInterfaceSharedObjects) { + if (CppHelper.useInterfaceSharedLibraries(cppConfiguration, ccToolchain, featureConfiguration) + && emitInterfaceSharedLibraries) { soInterface = getLinkedArtifact(LinkTargetType.INTERFACE_DYNAMIC_LIBRARY); // TODO(b/28946988): Remove this hard-coded flag. if (!featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS)) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java index f057d14ba8b773..93455e53315608 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcModule.java @@ -1080,8 +1080,8 @@ public CcToolchainConfigInfo ccToolchainConfigInfoFromSkylark( boolean supportsGoldLinker = featureNames.contains("supports_gold_linker"); boolean supportsStartEndLib = featureNames.contains("supports_start_end_lib"); - boolean supportsInterfaceSharedObjects = - featureNames.contains("supports_interface_shared_objects"); + boolean supportsInterfaceSharedLibraries = + featureNames.contains("supports_interface_shared_libraries"); boolean supportsEmbeddedRuntimes = featureNames.contains("supports_embedded_runtimes"); boolean supportsFission = featureNames.contains("supports_fission"); boolean dynamicLinkingMode = featureNames.contains("dynamic_linking_mode"); @@ -1175,7 +1175,7 @@ public CcToolchainConfigInfo ccToolchainConfigInfoFromSkylark( // This should be toolchain-based, rather than feature based, because // it controls whether or not to declare the feature at all. supportsEmbeddedRuntimes, - supportsInterfaceSharedObjects)) { + supportsInterfaceSharedLibraries)) { legacyFeaturesBuilder.add(new Feature(feature)); } legacyFeaturesBuilder.addAll( @@ -1244,7 +1244,7 @@ public CcToolchainConfigInfo ccToolchainConfigInfoFromSkylark( abiLibcVersion, supportsGoldLinker, supportsStartEndLib, - supportsInterfaceSharedObjects, + supportsInterfaceSharedLibraries, supportsEmbeddedRuntimes, /* staticRuntimesFilegroup= */ "", /* dynamicRuntimesFilegroup= */ "", diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainConfigInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainConfigInfo.java index 6ba62534885e95..c8aed0b0ccc5b2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainConfigInfo.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainConfigInfo.java @@ -63,7 +63,7 @@ public class CcToolchainConfigInfo extends NativeInfo implements CcToolchainConf private final String abiLibcVersion; private final boolean supportsGoldLinker; private final boolean supportsStartEndLib; - private final boolean supportsInterfaceSharedObjects; + private final boolean supportsInterfaceSharedLibraries; private final boolean supportsEmbeddedRuntimes; private final String staticRuntimesFilegroup; private final String dynamicRuntimesFilegroup; @@ -109,7 +109,7 @@ public CcToolchainConfigInfo( String abiLibcVersion, boolean supportsGoldLinker, boolean supportsStartEndLib, - boolean supportsInterfaceSharedObjects, + boolean supportsInterfaceSharedLibraries, boolean supportsEmbeddedRuntimes, String staticRuntimesFilegroup, String dynamicRuntimesFilegroup, @@ -153,7 +153,7 @@ public CcToolchainConfigInfo( this.abiLibcVersion = abiLibcVersion; this.supportsGoldLinker = supportsGoldLinker; this.supportsStartEndLib = supportsStartEndLib; - this.supportsInterfaceSharedObjects = supportsInterfaceSharedObjects; + this.supportsInterfaceSharedLibraries = supportsInterfaceSharedLibraries; this.supportsEmbeddedRuntimes = supportsEmbeddedRuntimes; this.staticRuntimesFilegroup = staticRuntimesFilegroup; this.dynamicRuntimesFilegroup = dynamicRuntimesFilegroup; @@ -407,8 +407,8 @@ public boolean supportsStartEndLib() { // TODO(b/65151735): Remove once this field is migrated to features. @Deprecated - public boolean supportsInterfaceSharedObjects() { - return supportsInterfaceSharedObjects; + public boolean supportsInterfaceSharedLibraries() { + return supportsInterfaceSharedLibraries; } // TODO(b/65151735): Remove once this field is migrated to features. diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java index e85c33e63d8f58..525edc11089817 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java @@ -582,13 +582,10 @@ public boolean supportsStartEndLib(FeatureConfiguration featureConfiguration) { || featureConfiguration.isEnabled(CppRuleClasses.SUPPORTS_START_END_LIB); } - /** - * Returns whether this toolchain supports interface shared objects. - * - *

Should be true if this toolchain generates ELF objects. - */ - public boolean supportsInterfaceSharedObjects() { - return toolchainInfo.supportsInterfaceSharedObjects(); + /** Returns whether this toolchain supports interface shared libraries. */ + public boolean supportsInterfaceSharedLibraries(FeatureConfiguration featureConfiguration) { + return toolchainInfo.supportsInterfaceSharedLibraries() + || featureConfiguration.isEnabled(CppRuleClasses.SUPPORTS_INTERFACE_SHARED_LIBRARIES); } @Nullable diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java index 7719d075db55b7..748b194fc99848 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java @@ -661,7 +661,7 @@ static CcToolchainProvider getCcToolchainProvider( attributes.getAdditionalBuildVariables()), getBuiltinIncludes(attributes.getLibc()), coverageEnvironment.build(), - toolchainInfo.supportsInterfaceSharedObjects() + toolchainInfo.supportsInterfaceSharedLibraries() ? attributes.getLinkDynamicLibraryTool() : null, builtInIncludeDirectories, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java index 799af389b3d525..7e66da91885dea 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java @@ -408,7 +408,7 @@ public boolean getParseHeadersVerifiesModules() { return cppOptions.parseHeadersVerifiesModules; } - public boolean getUseInterfaceSharedObjects() { + public boolean getUseInterfaceSharedLibraries() { return cppOptions.useInterfaceSharedObjects; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index 9ade40704dc17f..c21ccea7d757b0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -833,9 +833,12 @@ public static Link.ArchiveType getArchiveType( * Returns true if interface shared objects should be used in the build implied by the given * cppConfiguration and toolchain. */ - public static boolean useInterfaceSharedObjects( - CppConfiguration config, CcToolchainProvider toolchain) { - return toolchain.supportsInterfaceSharedObjects() && config.getUseInterfaceSharedObjects(); + public static boolean useInterfaceSharedLibraries( + CppConfiguration cppConfiguration, + CcToolchainProvider toolchain, + FeatureConfiguration featureConfiguration) { + return toolchain.supportsInterfaceSharedLibraries(featureConfiguration) + && cppConfiguration.getUseInterfaceSharedLibraries(); } public static CcNativeLibraryProvider collectNativeCcLibraries( 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 318dc1ca368614..397ac627aecdc3 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 @@ -1075,7 +1075,7 @@ private ImmutableSet getArtifactsPossiblyLtoMapped( private boolean shouldUseLinkDynamicLibraryTool() { return linkType.isDynamicLibrary() - && toolchain.supportsInterfaceSharedObjects() + && toolchain.supportsInterfaceSharedLibraries(featureConfiguration) && !featureConfiguration.hasConfiguredLinkerPathInActionConfig(); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java index d207467e39a83e..f1e1ed75326d2a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java @@ -332,6 +332,12 @@ public static Label ccToolchainTypeAttribute(RuleDefinitionEnvironment env) { */ public static final String TARGETS_WINDOWS = "targets_windows"; + /** + * A string constant for a feature that indicates we are using a toolchain building for Windows. + */ + public static final String SUPPORTS_INTERFACE_SHARED_LIBRARIES = + "supports_interface_shared_libraries"; + /** * A string constant for no_stripping feature, if it's specified, then no strip action config is * needed, instead the stripped binary will simply be a symlink (or a copy on Windows) of the diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java index dc7a982bb5f91a..691600aea7901e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppToolchainInfo.java @@ -104,7 +104,7 @@ public final class CppToolchainInfo { private final boolean supportsStartEndLib; private final boolean supportsEmbeddedRuntimes; private final boolean supportsDynamicLinker; - private final boolean supportsInterfaceSharedObjects; + private final boolean supportsInterfaceSharedLibraries; private final boolean supportsGoldLinker; private final boolean toolchainNeedsPic; @@ -244,7 +244,7 @@ public static CppToolchainInfo create( ccToolchainConfigInfo.supportsStartEndLib(), ccToolchainConfigInfo.supportsEmbeddedRuntimes(), haveDynamicMode || !ccToolchainConfigInfo.getDynamicLibraryLinkerFlags().isEmpty(), - ccToolchainConfigInfo.supportsInterfaceSharedObjects(), + ccToolchainConfigInfo.supportsInterfaceSharedLibraries(), ccToolchainConfigInfo.supportsGoldLinker(), ccToolchainConfigInfo.needsPic()); } catch (LabelSyntaxException e) { @@ -292,7 +292,7 @@ public static CppToolchainInfo create( boolean supportsStartEndLib, boolean supportsEmbeddedRuntimes, boolean supportsDynamicLinker, - boolean supportsInterfaceSharedObjects, + boolean supportsInterfaceSharedLibraries, boolean supportsGoldLinker, boolean toolchainNeedsPic) throws EvalException { @@ -337,7 +337,7 @@ public static CppToolchainInfo create( || toolchainFeatures .getActivatableNames() .contains(CppRuleClasses.DYNAMIC_LINKING_MODE); - this.supportsInterfaceSharedObjects = supportsInterfaceSharedObjects; + this.supportsInterfaceSharedLibraries = supportsInterfaceSharedLibraries; this.supportsGoldLinker = supportsGoldLinker; this.toolchainNeedsPic = toolchainNeedsPic; } @@ -600,8 +600,8 @@ public boolean supportsDynamicLinker() { * *

Should be true if this toolchain generates ELF objects. */ - public boolean supportsInterfaceSharedObjects() { - return supportsInterfaceSharedObjects; + public boolean supportsInterfaceSharedLibraries() { + return supportsInterfaceSharedLibraries; } /** diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java index 61b2517bd2cf9a..4ae243e28c8f9f 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LibrariesToLinkCollector.java @@ -287,7 +287,7 @@ private void addDynamicInputLinkOptions( input, CppHelper.getArchiveType(cppConfiguration, ccToolchainProvider, featureConfiguration))); if (featureConfiguration.isEnabled(CppRuleClasses.TARGETS_WINDOWS) - && ccToolchainProvider.supportsInterfaceSharedObjects()) { + && ccToolchainProvider.supportsInterfaceSharedLibraries(featureConfiguration)) { // On Windows, dynamic library (dll) cannot be linked directly when using toolchains that // support interface library (eg. MSVC). Preconditions.checkState( diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java index df018d254a1836..016e9e1fa9f68d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java @@ -203,8 +203,8 @@ private static class Impl { depsBuilder.addAll(ruleContext.getPrerequisites("deps", TARGET)); ImmutableList deps = depsBuilder.build(); CcLinkingHelper ccLinkingHelper = initializeLinkingHelper(featureConfiguration, deps); - if (ccToolchain(ruleContext).supportsInterfaceSharedObjects()) { - ccLinkingHelper.emitInterfaceSharedObjects(true); + if (ccToolchain(ruleContext).supportsInterfaceSharedLibraries(featureConfiguration)) { + ccLinkingHelper.emitInterfaceSharedLibraries(true); } CcLinkingOutputs ccLinkingOutputs = CcLinkingOutputs.EMPTY; ImmutableList.Builder libraryToLinkWrapperBuilder = diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java index 02ce7bf7b51abe..d03c7a3fdb449e 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java @@ -74,8 +74,10 @@ public void testInterfaceSharedObjects() throws Exception { CcToolchainProvider toolchainProvider = (CcToolchainProvider) target.get(ToolchainInfo.PROVIDER); assertThat( - CppHelper.useInterfaceSharedObjects( - getConfiguration(target).getFragment(CppConfiguration.class), toolchainProvider)) + CppHelper.useInterfaceSharedLibraries( + getConfiguration(target).getFragment(CppConfiguration.class), + toolchainProvider, + FeatureConfiguration.EMPTY)) .isFalse(); useConfiguration("--interface_shared_objects"); @@ -83,8 +85,10 @@ public void testInterfaceSharedObjects() throws Exception { target = getConfiguredTarget("//a:b"); toolchainProvider = (CcToolchainProvider) target.get(ToolchainInfo.PROVIDER); assertThat( - CppHelper.useInterfaceSharedObjects( - getConfiguration(target).getFragment(CppConfiguration.class), toolchainProvider)) + CppHelper.useInterfaceSharedLibraries( + getConfiguration(target).getFragment(CppConfiguration.class), + toolchainProvider, + FeatureConfiguration.EMPTY)) .isFalse(); getAnalysisMock() @@ -100,8 +104,10 @@ public void testInterfaceSharedObjects() throws Exception { target = getConfiguredTarget("//a:b"); toolchainProvider = (CcToolchainProvider) target.get(ToolchainInfo.PROVIDER); assertThat( - CppHelper.useInterfaceSharedObjects( - getConfiguration(target).getFragment(CppConfiguration.class), toolchainProvider)) + CppHelper.useInterfaceSharedLibraries( + getConfiguration(target).getFragment(CppConfiguration.class), + toolchainProvider, + FeatureConfiguration.EMPTY)) .isTrue(); useConfiguration("--nointerface_shared_objects"); @@ -109,8 +115,10 @@ public void testInterfaceSharedObjects() throws Exception { target = getConfiguredTarget("//a:b"); toolchainProvider = (CcToolchainProvider) target.get(ToolchainInfo.PROVIDER); assertThat( - CppHelper.useInterfaceSharedObjects( - getConfiguration(target).getFragment(CppConfiguration.class), toolchainProvider)) + CppHelper.useInterfaceSharedLibraries( + getConfiguration(target).getFragment(CppConfiguration.class), + toolchainProvider, + FeatureConfiguration.EMPTY)) .isFalse(); } diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java index 2e6272a65abffc..bfe5cc3bf773dc 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CrosstoolConfigurationLoaderTest.java @@ -177,7 +177,7 @@ public void testSimpleCompleteConfiguration() throws Exception { assertThat(ccProvider.supportsGoldLinker()).isTrue(); assertThat(ccProvider.supportsStartEndLib(FeatureConfiguration.EMPTY)).isFalse(); - assertThat(ccProvider.supportsInterfaceSharedObjects()).isFalse(); + assertThat(ccProvider.supportsInterfaceSharedLibraries(FeatureConfiguration.EMPTY)).isFalse(); assertThat(ccProvider.supportsEmbeddedRuntimes()).isFalse(); assertThat(ccProvider.toolchainNeedsPic()).isFalse(); assertThat(ccProvider.supportsFission()).isTrue(); @@ -561,7 +561,7 @@ public void testComprehensiveCompleteConfiguration() throws Exception { // Don't bother with testing the list of tools again. assertThat(ccProviderC.supportsGoldLinker()).isFalse(); assertThat(ccProviderC.supportsStartEndLib(FeatureConfiguration.EMPTY)).isFalse(); - assertThat(ccProviderC.supportsInterfaceSharedObjects()).isFalse(); + assertThat(ccProviderC.supportsInterfaceSharedLibraries(FeatureConfiguration.EMPTY)).isFalse(); assertThat(ccProviderC.supportsEmbeddedRuntimes()).isFalse(); assertThat(ccProviderC.toolchainNeedsPic()).isFalse(); assertThat(ccProviderC.supportsFission()).isFalse();