summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-06-26 21:30:47 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-06-26 21:30:47 -0700
commit2036c29d2273e06ca424bd40d139aba6039a11ca (patch)
treefaa1bbcbf80bb64fb32bdfcd3acabf76a121af48
parent69d2fe543d02b8bc667a762ba67f6b4c0371d3e8 (diff)
downloadldid-2036c29d2273e06ca424bd40d139aba6039a11ca.tar.gz
ldid-2036c29d2273e06ca424bd40d139aba6039a11ca.tar.zst
ldid-2036c29d2273e06ca424bd40d139aba6039a11ca.zip
Align __LINKEDIT segment vmsize to match filesize.
-rw-r--r--ldid.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/ldid.cpp b/ldid.cpp
index 027ca42..8aa0b4e 100644
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -1068,10 +1068,17 @@ int main(int argc, const char *argv[]) {
signature->dataoff = mach_header.Swap(align);
signature->datasize = mach_header.Swap(allocation.alloc_);
- _foreach (segment, mach_header.GetSegments("__LINKEDIT"))
- segment->filesize = mach_header.Swap(align + allocation.alloc_ - mach_header.Swap(segment->fileoff));
- _foreach (segment, mach_header.GetSegments64("__LINKEDIT"))
- segment->filesize = mach_header.Swap(align + allocation.alloc_ - mach_header.Swap(segment->fileoff));
+ _foreach (segment, mach_header.GetSegments("__LINKEDIT")) {
+ size_t size(mach_header.Swap(align + allocation.alloc_ - mach_header.Swap(segment->fileoff)));
+ segment->filesize = size;
+ segment->vmsize = Align(size, 0x1000);
+ }
+
+ _foreach (segment, mach_header.GetSegments64("__LINKEDIT")) {
+ size_t size(mach_header.Swap(align + allocation.alloc_ - mach_header.Swap(segment->fileoff)));
+ segment->filesize = size;
+ segment->vmsize = Align(size, 0x1000);
+ }
}
}