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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 13:19:52 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Writer.cpp:448
+// DylibSymbol.)
+
+static void prepareBranchTarget(Symbol *sym) {
----------------
nit: extra line


================
Comment at: lld/MachO/Writer.cpp:473
+// Can a symbol's address can only be resolved at runtime?
+
+static bool needsBinding(const Symbol *sym) {
----------------
ditto


================
Comment at: lld/MachO/Writer.cpp:833
 
+void Writer::assignAddresses() {
+  // dyld requires __LINKEDIT segment to always exist (even if empty).
----------------
This function feels misleadingly named. Also I'm not sure why we need to put all the `finalizeContents()` calls together with the address assignment loop. Can we make `linkEditSegment` a member of `Writer` and then split all the `finalizeContents()` calls into a separate `finalizeLinkEdit()`?


================
Comment at: lld/MachO/Writer.cpp:858-859
 
-  // Sort and assign sections to their respective segments. No more sections nor
-  // segments may be created after these methods run.
   createOutputSections();
----------------
This comment seems worth keeping


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98795/new/

https://reviews.llvm.org/D98795



More information about the llvm-commits mailing list