[PATCH] D103430: [lld/mac] Implement removal of unused dylibs
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 31 19:22:20 PDT 2021
thakis created this revision.
thakis added a reviewer: lld-macho.
Herald added a subscriber: dang.
Herald added a reviewer: int3.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
thakis requested review of this revision.
This omits load commands for unreferenced dylibs if:
- the dylib was loaded implicitly,
- it is marked MH_DEAD_STRIPPABLE_DYLIB
- or -dead_strip_dylibs is passed
This matches ld64.
Currently, the "is dylib referenced" state is computed before dead code
stripping and is not updated after dead code stripping. This too matches ld64.
We should do better here.
With this, clang-format linked with lld (like with ld64) no longer has
libobjc.A.dylib in `otool -L` output. (It was implicitly loaded as a reexport
of CoreFoundation.framework, but it's not needed.)
https://reviews.llvm.org/D103430
Files:
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Options.td
lld/MachO/SymbolTable.cpp
lld/MachO/Symbols.h
lld/MachO/SyntheticSections.cpp
lld/MachO/Writer.cpp
lld/test/MachO/dead-strip-dylibs.s
lld/test/MachO/implicit-dylibs.s
lld/test/MachO/lc-linker-option.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103430.348869.patch
Type: text/x-patch
Size: 19358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210601/49a11602/attachment.bin>
More information about the llvm-commits
mailing list