[PATCH] D118724: [lld-macho] Add -pagezero_size

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 5 20:40:14 PST 2022


int3 added inline comments.


================
Comment at: lld/MachO/Driver.cpp:641-642
+
+    // __PAGEZERO should be aligned to 4KB, not to the page alignment like ld64
+    // says.
+    if ((pagezeroSize % 0x1000) != 0) {
----------------
Link1J wrote:
> int3 wrote:
> > Hm, this seems like an ld64 implementation error. Personally I think it makes more sense to round it to the page size...
> Well, ld64 has some interesting behavior because of what it does. 
> If you are to set `-pagezero_size` to 0x1000 on ARM64, but round up to page size (16KB).
> If you are to set `-pagezero_size` to 0x1001 on ARM64, it will report the rounding down, but round up to page size. 
> 
> I am going to make it operate on page size, over whatever ld64 does, so that it makes a lot more sense. So it will round down to page size, and never make it larger then expected.
lol that's pretty funny behavior. yeah I agree with your choice here


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

https://reviews.llvm.org/D118724



More information about the llvm-commits mailing list