Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix rpath for symlinks in cc_shared_library
The rpath were set based on the path of the linker inputs relative to the output being created by the linking action. However, for shared objects after creating the linking action in most cases we also create a symlink. The dynamic loader takes into account the location of the symlink to resolve $ORIGIN in the rpath, not the target of the symlink. The RPATH was therefore wrong in most cases. This misunderstanding of how the dynamic loader treats symlinks also influenced changes introduced in 95ae4db. All the features introduced in that change are not needed: - No need to switch from RUNPATH to RPATH - No need to stop RPATHs from being added to a shared library - cc_test can avoid linking everything shared library (just like cc_binary) - We don't ever need to link indirect shared libraries into a cc_binary except on Windows This CL also fixes the name of the symlink for a shared library which was mangled so that the original name is preserved. This is important because if a distribution artifact is linked against the library with the mangled name, even if the shared library was installed in the system and the RPATH set correctly, the dynamic loader won't find it. Fixes #18790 RELNOTES:none PiperOrigin-RevId: 543768869 Change-Id: I48a2a6553e97cd611814051e731c874552d1de27
- Loading branch information
Showing
11 changed files
with
144 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.