From 6b21b7773157a1eebd3dfe79ff4c4ee750059daf Mon Sep 17 00:00:00 2001 From: Chris Clearwater Date: Thu, 5 May 2022 02:19:31 -0700 Subject: [PATCH] Revert "Fixes incorrect install names on darwin platforms" This reverts commit b06f49507e02384cb4ff1ff862da2a673e9a081f. Also had to add a missing mnemonic function call parameter to `getDynamicLibrarySoname`. Copy-pasted the parameter from the other use of that function in the codebase. Tested manually with a custom toolchain and there is also a test from the reverted code. Fixes #15214 Closes #15261. PiperOrigin-RevId: 446662219 --- .../lib/rules/cpp/CppLinkActionBuilder.java | 5 +- .../bazel/cpp_darwin_integration_test.sh | 50 ++++++------------- 2 files changed, 20 insertions(+), 35 deletions(-) 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 3a343aa1e50c94..18bbb316da6ea6 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 <