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 f4c391fde97a2f..e37feb6871f59a 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 @@ -820,7 +820,10 @@ public CppLinkAction build() throws InterruptedException, RuleErrorException { getLinkType().linkerOrArchiver().equals(LinkerOrArchiver.LINKER), configuration.getBinDirectory(repositoryName).getExecPath(), output.getExecPathString(), - output.getRootRelativePath().getBaseName(), + SolibSymlinkAction.getDynamicLibrarySoname( + output.getRootRelativePath(), + /* preserveName= */ false, + actionConstructionContext.getConfiguration().getMnemonic()), linkType.equals(LinkTargetType.DYNAMIC_LIBRARY), paramFile != null ? paramFile.getExecPathString() : null, thinltoParamFile != null ? thinltoParamFile.getExecPathString() : null, diff --git a/src/test/shell/bazel/cpp_darwin_integration_test.sh b/src/test/shell/bazel/cpp_darwin_integration_test.sh index 4676e6c8f38c2a..e26d2a902e93fd 100755 --- a/src/test/shell/bazel/cpp_darwin_integration_test.sh +++ b/src/test/shell/bazel/cpp_darwin_integration_test.sh @@ -124,59 +124,41 @@ EOF } function test_cc_test_with_explicit_install_name() { - mkdir -p cpp/install_name - cat > cpp/install_name/BUILD < cpp/BUILD < cpp/install_name/foo.cc < cpp/foo.h < cpp/install_name/bar.cc < cpp/foo.cc < cpp/install_name/baz.cc < cpp/install_name/test.cc < cpp/test.cc <