[llvm] [llvm-size] Add -z option for Mach-O to exclude __PAGEZERO size. (PR #159574)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 01:59:26 PDT 2025


================
@@ -307,7 +308,9 @@ static void printDarwinSegmentSizes(MachOObjectFile *MachO) {
         }
       } else {
         StringRef SegmentName = StringRef(Seg.segname);
-        if (SegmentName == "__TEXT")
+        if (SkipPageZero && SegmentName == "__PAGEZERO")
+          ; // Skip __PAGEZERO segment
----------------
jh7370 wrote:

I'd invert this and add it in place of the final `else`, so it becomes:
```
else if (!SkipPageZero || SegmentName != "__PAGEZERO")
  total_others += Seg.vmsize;
```

https://github.com/llvm/llvm-project/pull/159574


More information about the llvm-commits mailing list