diff tools/dsymutil/MachOUtils.cpp @ 100:7d135dc70f03 LLVM 3.9

LLVM 3.9
author Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
date Tue, 26 Jan 2016 22:53:40 +0900
parents afa8332a0e37
children 1172e4bd9c6f
line wrap: on
line diff
--- a/tools/dsymutil/MachOUtils.cpp	Tue Oct 13 17:49:56 2015 +0900
+++ b/tools/dsymutil/MachOUtils.cpp	Tue Jan 26 22:53:40 2016 +0900
@@ -241,7 +241,7 @@
   // start address leave a sufficient gap to store the __DWARF
   // segment.
   uint64_t PrevEndAddress = EndAddress;
-  EndAddress = RoundUpToAlignment(EndAddress, 0x1000);
+  EndAddress = alignTo(EndAddress, 0x1000);
   if (GapForDwarf == UINT64_MAX && Segment.vmaddr > EndAddress &&
       Segment.vmaddr - EndAddress >= DwarfSegmentSize)
     GapForDwarf = EndAddress;
@@ -268,8 +268,8 @@
                                uint64_t FileSize, unsigned NumSections,
                                MCAsmLayout &Layout, MachObjectWriter &Writer) {
   Writer.writeSegmentLoadCommand("__DWARF", NumSections, VMAddr,
-                                 RoundUpToAlignment(FileSize, 0x1000),
-                                 FileOffset, FileSize, /* MaxProt */ 7,
+                                 alignTo(FileSize, 0x1000), FileOffset,
+                                 FileSize, /* MaxProt */ 7,
                                  /* InitProt =*/3);
 
   for (unsigned int i = 0, n = Layout.getSectionOrder().size(); i != n; ++i) {
@@ -279,8 +279,8 @@
 
     unsigned Align = Sec->getAlignment();
     if (Align > 1) {
-      VMAddr = RoundUpToAlignment(VMAddr, Align);
-      FileOffset = RoundUpToAlignment(FileOffset, Align);
+      VMAddr = alignTo(VMAddr, Align);
+      FileOffset = alignTo(FileOffset, Align);
     }
     Writer.writeSection(Layout, *Sec, VMAddr, FileOffset, 0, 0, 0);
 
@@ -394,8 +394,7 @@
       continue;
 
     if (uint64_t Size = Layout.getSectionFileSize(Sec)) {
-      DwarfSegmentSize =
-          RoundUpToAlignment(DwarfSegmentSize, Sec->getAlignment());
+      DwarfSegmentSize = alignTo(DwarfSegmentSize, Sec->getAlignment());
       DwarfSegmentSize += Size;
       ++NumDwarfSections;
     }
@@ -419,7 +418,7 @@
 
   uint64_t SymtabStart = LoadCommandSize;
   SymtabStart += HeaderSize;
-  SymtabStart = RoundUpToAlignment(SymtabStart, 0x1000);
+  SymtabStart = alignTo(SymtabStart, 0x1000);
 
   // We gathered all the information we need, start emitting the output file.
   Writer.writeHeader(MachO::MH_DSYM, NumLoadCommands, LoadCommandSize, false);
@@ -441,7 +440,7 @@
                                   NewStringsSize);
 
   uint64_t DwarfSegmentStart = StringStart + NewStringsSize;
-  DwarfSegmentStart = RoundUpToAlignment(DwarfSegmentStart, 0x1000);
+  DwarfSegmentStart = alignTo(DwarfSegmentStart, 0x1000);
 
   // Write the load commands for the segments and sections we 'import' from
   // the original binary.
@@ -460,7 +459,7 @@
                                  DwarfSegmentSize, GapForDwarf, EndAddress);
   }
 
-  uint64_t DwarfVMAddr = RoundUpToAlignment(EndAddress, 0x1000);
+  uint64_t DwarfVMAddr = alignTo(EndAddress, 0x1000);
   uint64_t DwarfVMMax = Is64Bit ? UINT64_MAX : UINT32_MAX;
   if (DwarfVMAddr + DwarfSegmentSize > DwarfVMMax ||
       DwarfVMAddr + DwarfSegmentSize < DwarfVMAddr /* Overflow */) {
@@ -510,7 +509,7 @@
       continue;
 
     uint64_t Pos = OutFile.tell();
-    Writer.WriteZeros(RoundUpToAlignment(Pos, Sec.getAlignment()) - Pos);
+    Writer.WriteZeros(alignTo(Pos, Sec.getAlignment()) - Pos);
     MCAsm.writeSectionData(&Sec, Layout);
   }