]> granicus.if.org Git - llvm/commitdiff
[dsymutil] Fix __LINKEDIT vmsize in dsymutil upgrade path
authorSteven Wu <stevenwu@apple.com>
Thu, 2 Feb 2017 00:00:13 +0000 (00:00 +0000)
committerSteven Wu <stevenwu@apple.com>
Thu, 2 Feb 2017 00:00:13 +0000 (00:00 +0000)
Summary:
dsymutil upgrade path can change the size of segment and it needs to update
the vmsize of the segment to reflect the size change.

rdar://problem/30290714

Reviewers: friss

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29433

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293842 91177308-0d34-0410-b5e6-96231b3b80d8

tools/dsymutil/MachOUtils.cpp

index 8a730a1d0c8a2e36989071661a889690f2e981ba..c1422f6eaab5cb558ff15deb01bfa10ae7e20ccd 100644 (file)
@@ -236,6 +236,8 @@ static void transferSegmentAndSections(
   if (StringRef("__LINKEDIT") == Segment.segname) {
     Segment.fileoff = LinkeditOffset;
     Segment.filesize = LinkeditSize;
+    // Resize vmsize by rounding to the page size.
+    Segment.vmsize = alignTo(LinkeditSize, 0x1000);
   }
 
   // Check if the end address of the last segment and our current