[PATCH] D98795: [lld-macho][NFC] Minor refactor of Writer::run()

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 10:45:19 PDT 2021


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

Move some functions closer to their uses. Move detailed address-assignment logic out of the otherwise abstract `Writer::run()`. This prepares the ground for a diff to implement branch range extension thunks.

- `SyntheticSections.cpp`
  - move `needsBinding()` and `prepareBranchTarget()` into `Writer.cpp`
  - move `addNonLazyBindingEntries()` adjacent to its use.

- `Writer.cpp`
  - move address-assignment logic from `Writer::run()` into new function `Writer::assignAddresses()`
  - move `needsBinding()` and `prepareBranchTarget()` from `SyntheticSections.cpp`

- `Target.h`
  - remove orphaned decls of `prepareSymbolRelocation()` and `validateRelocationInfo()` which were moved to other files in earlier diffs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98795

Files:
  lld/MachO/SyntheticSections.cpp
  lld/MachO/SyntheticSections.h
  lld/MachO/Target.h
  lld/MachO/Writer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98795.331313.patch
Type: text/x-patch
Size: 9448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210317/a4a7188b/attachment.bin>


More information about the llvm-commits mailing list