[PATCH] D108780: [lld-macho] Refactor archive loading

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 12:12:43 PDT 2021


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added a reviewer: gkm.
Herald added a project: lld-macho.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The previous logic was duplicated between symbol-initiated
archive loads versus flag-initiated loads (i.e. `-force_load` and
`-ObjC`). This resulted in code duplication as well as redundant work --
we would create Archive instances twice whenever we had one of those
flags; once in `getArchiveMembers` and again when we constructed the
ArchiveFile.

This was motivated by an upcoming diff where we load archive members
containing ObjC-related symbols before loading those containing
ObjC-related sections, as well as before performing symbol resolution.
Without this refactor, it would be difficult to do that while avoiding
loading the same archive member twice.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108780

Files:
  lld/MachO/Driver.cpp
  lld/MachO/Driver.h
  lld/MachO/DriverUtils.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/MachO/ObjC.cpp
  lld/test/MachO/invalid/bad-archive-member.s
  lld/test/MachO/thin-archive.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108780.368954.patch
Type: text/x-patch
Size: 16021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210826/a2b5762b/attachment.bin>


More information about the llvm-commits mailing list