[PATCH] D80177: [lld-macho] Set __PAGEZERO size to 4GB

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 19 15:27:53 PDT 2020


int3 marked 2 inline comments as done.
int3 added inline comments.


================
Comment at: lld/MachO/Target.h:28
+  PageZeroSize = 1ull << 32, // XXX should be 4096 for 32-bit targets
   ImageBase = 4096,
   MaxAlignmentPowerOf2 = 32,
----------------
smeenai wrote:
> It's really confusing to have PageZeroSize and ImageBase be different, and for that matter, to have both of them.
> 
> With this diff, we're only using ImageBase in one place: https://github.com/llvm/llvm-project/blob/master/lld/MachO/Writer.cpp#L171. From looking into LC_MAIN, it seems like the entryoff is supposed to be an offset in the file rather than a virtual address, so computing it in terms of `getVA` is confusing. We should also fix that and then get rid of either ImageBase or PageZeroSize.
> 
> For that matter, is our LC_MAIN entryoff calculation gonna be correct after this? I have a hard time imagining that, and we don't have any tests for it :/
oops, good catch...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80177





More information about the llvm-commits mailing list