From f69e1981a609bd0932adedcdffc9d6a5520b0f2e Mon Sep 17 00:00:00 2001 From: Chenchu Kolli Date: Mon, 9 May 2022 19:39:02 -0500 Subject: [PATCH] Revert "Fixes incorrect install names on darwin platforms" (#15450) 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 Co-authored-by: Chris Clearwater --- .../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 d807f2e6bba5c8..330bcdce43b2cd 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 <