[PATCH] D130725: [lld/mac] Add support for $ld$previous symbols with explicit symbol name
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 12:25:00 PDT 2022
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added projects: lld-macho, All.
thakis requested review of this revision.
A symbol `$ld$previous$/Another$1.2.3$1$3.0$14.0$_xxx$` means
"pretend symbol `_xxx` is in dylib `/Another` with version `1.2.3`
if the deployment target is between `3.0` and `14.0` and we're
targeting platform `1` (ie macOS)".
This means dylibs can now inject synthetic dylibs into the link, so
DylibFile needs to grow a 3rd constructor.
The only other interesting thing is that such an injected dylib
counts as a use of the original dylib. This patch gets this mostly
right (if _only_ `$ld$previous` symbols are used from a dylib,
we don't add a dep on the dylib itself, matching ld64), but one case
where we don't match ld64 yet is that ld64 even omits the original
dylib when linking it with `-needed-l`. Lld currently still adds a load
command for the original dylib in that case. (That's for a future
patch.)
Fixes #56074.
https://reviews.llvm.org/D130725
Files:
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Writer.cpp
lld/test/MachO/special-symbol-ld-previous.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130725.448411.patch
Type: text/x-patch
Size: 20131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220728/1c8a4f0d/attachment.bin>
More information about the llvm-commits
mailing list