summaryrefslogtreecommitdiffstats
path: root/llvm/tools/dsymutil/MachOUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/dsymutil/MachOUtils.cpp')
-rw-r--r--llvm/tools/dsymutil/MachOUtils.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp
index 44cc528ed8f..628c1b6380a 100644
--- a/llvm/tools/dsymutil/MachOUtils.cpp
+++ b/llvm/tools/dsymutil/MachOUtils.cpp
@@ -241,7 +241,7 @@ static void transferSegmentAndSections(
// 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 @@ static void createDwarfSegment(uint64_t VMAddr, uint64_t FileOffset,
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 @@ static void createDwarfSegment(uint64_t VMAddr, uint64_t FileOffset,
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 @@ bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
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 @@ bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
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 @@ bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
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 @@ bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
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 @@ bool generateDsymCompanion(const DebugMap &DM, MCStreamer &MS,
continue;
uint64_t Pos = OutFile.tell();
- Writer.WriteZeros(RoundUpToAlignment(Pos, Sec.getAlignment()) - Pos);
+ Writer.WriteZeros(alignTo(Pos, Sec.getAlignment()) - Pos);
MCAsm.writeSectionData(&Sec, Layout);
}
OpenPOWER on IntegriCloud