[PATCH] D87852: [lld-macho] Allow the entry symbol to be dynamically bound

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 14:24:43 PDT 2020


smeenai added inline comments.


================
Comment at: lld/MachO/Writer.cpp:196
+      c->entryoff =
+          in.stubs->fileOff + config->entry->stubsIndex * target->stubSize;
+    else
----------------
int3 wrote:
> smeenai wrote:
> > Possible follow-up: I think this calculation is done in a bunch of places. Is there a nice place where a function for this calculation could live?
> it's not really identical with anything else -- I mean, there's another place where we do `addr + stubsIndex * stubSize`, but here we are calculating the file offset and not the address. There are also a bunch of other places where we multiply by WordSize (to index into `__la_symbol_ptrs`) instead of by stubSize.
You're right; I didn't pay attention to the VA vs the file offset.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87852



More information about the llvm-commits mailing list