summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/dsymutil/MachOUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/tools/dsymutil/MachOUtils.cpp')
-rw-r--r--gnu/llvm/tools/dsymutil/MachOUtils.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/gnu/llvm/tools/dsymutil/MachOUtils.cpp b/gnu/llvm/tools/dsymutil/MachOUtils.cpp
index 44cc528ed8f..8a730a1d0c8 100644
--- a/gnu/llvm/tools/dsymutil/MachOUtils.cpp
+++ b/gnu/llvm/tools/dsymutil/MachOUtils.cpp
@@ -16,6 +16,7 @@
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCObjectStreamer.h"
+#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Object/MachO.h"
#include "llvm/Support/FileUtilities.h"
@@ -241,7 +242,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 +269,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 +280,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 +395,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 +419,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 +441,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 +460,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 +510,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);
}