[lld] r257801 - Update for LLVM function name change.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 14 12:53:51 PST 2016
Author: ruiu
Date: Thu Jan 14 14:53:50 2016
New Revision: 257801
URL: http://llvm.org/viewvc/llvm-project?rev=257801&view=rev
Log:
Update for LLVM function name change.
Modified:
lld/trunk/COFF/Chunks.cpp
lld/trunk/COFF/Chunks.h
lld/trunk/COFF/DLL.cpp
lld/trunk/COFF/Writer.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
lld/trunk/ELF/Writer.cpp
lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp
lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.cpp
lld/trunk/lib/ReaderWriter/ELF/TargetLayout.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Thu Jan 14 14:53:50 2016
@@ -310,7 +310,7 @@ void SEHTableChunk::writeTo(uint8_t *Buf
BaserelChunk::BaserelChunk(uint32_t Page, Baserel *Begin, Baserel *End) {
// Block header consists of 4 byte page RVA and 4 byte block size.
// Each entry is 2 byte. Last entry may be padding.
- Data.resize(align((End - Begin) * 2 + 8, 4));
+ Data.resize(alignTo((End - Begin) * 2 + 8, 4));
uint8_t *P = Data.data();
write32le(P, Page);
write32le(P + 4, Data.size());
Modified: lld/trunk/COFF/Chunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.h?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.h (original)
+++ lld/trunk/COFF/Chunks.h Thu Jan 14 14:53:50 2016
@@ -326,10 +326,6 @@ public:
uint8_t Type;
};
-inline uint64_t align(uint64_t Value, uint64_t Align) {
- return llvm::RoundUpToAlignment(Value, Align);
-}
-
} // namespace coff
} // namespace lld
Modified: lld/trunk/COFF/DLL.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DLL.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/COFF/DLL.cpp (original)
+++ lld/trunk/COFF/DLL.cpp Thu Jan 14 14:53:50 2016
@@ -45,7 +45,7 @@ public:
size_t getSize() const override {
// Starts with 2 byte Hint field, followed by a null-terminated string,
// ends with 0 or 1 byte padding.
- return align(Name.size() + 3, 2);
+ return alignTo(Name.size() + 3, 2);
}
void writeTo(uint8_t *Buf) const override {
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Thu Jan 14 14:53:50 2016
@@ -163,13 +163,13 @@ void OutputSection::addChunk(Chunk *C) {
Chunks.push_back(C);
C->setOutputSection(this);
uint64_t Off = Header.VirtualSize;
- Off = align(Off, C->getAlign());
+ Off = alignTo(Off, C->getAlign());
C->setRVA(Off);
C->setOutputSectionOff(Off);
Off += C->getSize();
Header.VirtualSize = Off;
if (C->hasData())
- Header.SizeOfRawData = align(Off, SectorSize);
+ Header.SizeOfRawData = alignTo(Off, SectorSize);
}
void OutputSection::addPermissions(uint32_t C) {
@@ -447,15 +447,15 @@ void Writer::createSymbolAndStringTable(
OutputSection *LastSection = OutputSections.back();
// We position the symbol table to be adjacent to the end of the last section.
- uint64_t FileOff =
- LastSection->getFileOff() + align(LastSection->getRawSize(), SectorSize);
+ uint64_t FileOff = LastSection->getFileOff() +
+ alignTo(LastSection->getRawSize(), SectorSize);
if (!OutputSymtab.empty()) {
PointerToSymbolTable = FileOff;
FileOff += OutputSymtab.size() * sizeof(coff_symbol16);
}
if (!Strtab.empty())
FileOff += Strtab.size() + 4;
- FileSize = align(FileOff, SectorSize);
+ FileSize = alignTo(FileOff, SectorSize);
}
// Visits all sections to assign incremental, non-overlapping RVAs and
@@ -466,7 +466,7 @@ void Writer::assignAddresses() {
sizeof(coff_section) * OutputSections.size();
SizeOfHeaders +=
Config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header);
- SizeOfHeaders = align(SizeOfHeaders, SectorSize);
+ SizeOfHeaders = alignTo(SizeOfHeaders, SectorSize);
uint64_t RVA = 0x1000; // The first page is kept unmapped.
FileSize = SizeOfHeaders;
// Move DISCARDABLE (or non-memory-mapped) sections to the end of file because
@@ -480,10 +480,10 @@ void Writer::assignAddresses() {
addBaserels(Sec);
Sec->setRVA(RVA);
Sec->setFileOffset(FileSize);
- RVA += align(Sec->getVirtualSize(), PageSize);
- FileSize += align(Sec->getRawSize(), SectorSize);
+ RVA += alignTo(Sec->getVirtualSize(), PageSize);
+ FileSize += alignTo(Sec->getRawSize(), SectorSize);
}
- SizeOfImage = SizeOfHeaders + align(RVA - 0x1000, PageSize);
+ SizeOfImage = SizeOfHeaders + alignTo(RVA - 0x1000, PageSize);
}
template <typename PEHeaderTy> void Writer::writeHeader() {
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Jan 14 14:53:50 2016
@@ -770,7 +770,7 @@ void OutputSection<ELFT>::addSection(Inp
this->Header.sh_addralign = Align;
uintX_t Off = this->Header.sh_size;
- Off = align(Off, Align);
+ Off = alignTo(Off, Align);
S->OutSecOff = Off;
Off += S->getSize();
this->Header.sh_size = Off;
@@ -976,7 +976,7 @@ void EHOutputSection<ELFT>::addSectionAu
auto P = CieMap.insert(std::make_pair(CieInfo, Cies.size()));
if (P.second) {
Cies.push_back(C);
- this->Header.sh_size += align(Length, sizeof(uintX_t));
+ this->Header.sh_size += alignTo(Length, sizeof(uintX_t));
}
OffsetToIndex[Offset] = P.first->second;
} else {
@@ -989,7 +989,7 @@ void EHOutputSection<ELFT>::addSectionAu
if (I == OffsetToIndex.end())
error("Invalid CIE reference");
Cies[I->second].Fdes.push_back(EHRegion<ELFT>(S, Index));
- this->Header.sh_size += align(Length, sizeof(uintX_t));
+ this->Header.sh_size += alignTo(Length, sizeof(uintX_t));
}
}
@@ -1042,7 +1042,7 @@ static typename ELFFile<ELFT>::uintX_t w
uint8_t *Buf) {
typedef typename ELFFile<ELFT>::uintX_t uintX_t;
const endianness E = ELFT::TargetEndianness;
- uint64_t Len = align(Data.size(), sizeof(uintX_t));
+ uint64_t Len = alignTo(Data.size(), sizeof(uintX_t));
write32<E>(Buf, Len - 4);
memcpy(Buf + 4, Data.data() + 4, Data.size() - 4);
return Len;
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Thu Jan 14 14:53:50 2016
@@ -429,10 +429,6 @@ private:
uint32_t GprMask = 0;
};
-inline uint64_t align(uint64_t Value, uint64_t Align) {
- return llvm::RoundUpToAlignment(Value, Align);
-}
-
// All output sections that are hadnled by the linker specially are
// globally accessible. Writer initializes them, so don't use them
// until Writer is initialized.
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jan 14 14:53:50 2016
@@ -504,7 +504,7 @@ void Writer<ELFT>::addCommonSymbols(std:
uintX_t Off = getBss()->getSize();
for (DefinedCommon *C : Syms) {
- Off = align(Off, C->MaxAlignment);
+ Off = alignTo(Off, C->MaxAlignment);
C->OffsetInBss = Off;
Off += C->Size;
}
@@ -527,7 +527,7 @@ void Writer<ELFT>::addCopyRelSymbols(std
countTrailingZeros((uintX_t)Sym.st_value));
uintX_t Align = 1 << TrailingZeros;
Out<ELFT>::Bss->updateAlign(Align);
- Off = align(Off, Align);
+ Off = alignTo(Off, Align);
C->OffsetInBss = Off;
Off += Sym.st_size;
}
@@ -1045,8 +1045,8 @@ template <class ELFT> void Writer<ELFT>:
bool InRelRo = Config->ZRelro && (Flags & PF_W) && isRelroSection(Sec);
bool FirstNonRelRo = GnuRelroPhdr.p_type && !InRelRo && !RelroAligned;
if (FirstNonRelRo || PH->p_flags != Flags) {
- VA = align(VA, Target->getPageSize());
- FileOff = align(FileOff, Target->getPageSize());
+ VA = alignTo(VA, Target->getPageSize());
+ FileOff = alignTo(FileOff, Target->getPageSize());
if (FirstNonRelRo)
RelroAligned = true;
}
@@ -1063,8 +1063,8 @@ template <class ELFT> void Writer<ELFT>:
if (!TlsPhdr.p_vaddr)
setPhdr(&TlsPhdr, PT_TLS, PF_R, FileOff, VA, 0, Sec->getAlign());
if (Sec->getType() != SHT_NOBITS)
- VA = align(VA, Sec->getAlign());
- uintX_t TVA = align(VA + ThreadBssOffset, Sec->getAlign());
+ VA = alignTo(VA, Sec->getAlign());
+ uintX_t TVA = alignTo(VA + ThreadBssOffset, Sec->getAlign());
Sec->setVA(TVA);
TlsPhdr.p_memsz += Sec->getSize();
if (Sec->getType() == SHT_NOBITS) {
@@ -1075,7 +1075,7 @@ template <class ELFT> void Writer<ELFT>:
}
TlsPhdr.p_align = std::max<uintX_t>(TlsPhdr.p_align, Sec->getAlign());
} else {
- VA = align(VA, Sec->getAlign());
+ VA = alignTo(VA, Sec->getAlign());
Sec->setVA(VA);
VA += Sec->getSize();
if (InRelRo)
@@ -1083,7 +1083,7 @@ template <class ELFT> void Writer<ELFT>:
}
}
- FileOff = align(FileOff, Sec->getAlign());
+ FileOff = alignTo(FileOff, Sec->getAlign());
Sec->setFileOffset(FileOff);
if (Sec->getType() != SHT_NOBITS)
FileOff += Sec->getSize();
@@ -1096,7 +1096,7 @@ template <class ELFT> void Writer<ELFT>:
if (TlsPhdr.p_vaddr) {
// The TLS pointer goes after PT_TLS. At least glibc will align it,
// so round up the size to make sure the offsets are correct.
- TlsPhdr.p_memsz = align(TlsPhdr.p_memsz, TlsPhdr.p_align);
+ TlsPhdr.p_memsz = alignTo(TlsPhdr.p_memsz, TlsPhdr.p_align);
Phdrs[++PhdrIdx] = TlsPhdr;
Out<ELFT>::TlsPhdr = &Phdrs[PhdrIdx];
}
@@ -1128,7 +1128,7 @@ template <class ELFT> void Writer<ELFT>:
}
// Add space for section headers.
- SectionHeaderOff = align(FileOff, ELFT::Is64Bits ? 8 : 4);
+ SectionHeaderOff = alignTo(FileOff, ELFT::Is64Bits ? 8 : 4);
FileSize = SectionHeaderOff + getNumSections() * sizeof(Elf_Shdr);
// Update "_end" and "end" symbols so that they
Modified: lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/AArch64/AArch64TargetHandler.h Thu Jan 14 14:53:50 2016
@@ -40,7 +40,7 @@ public:
std::call_once(_tpOffOnce, [this]() {
for (const auto &phdr : *_programHeader) {
if (phdr->p_type == llvm::ELF::PT_TLS) {
- _tpOff = llvm::RoundUpToAlignment(TCB_SIZE, phdr->p_align);
+ _tpOff = llvm::alignTo(TCB_SIZE, phdr->p_align);
break;
}
}
Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMTargetHandler.h Thu Jan 14 14:53:50 2016
@@ -122,7 +122,7 @@ public:
std::call_once(_tpOffOnce, [this]() {
for (const auto &phdr : *_programHeader) {
if (phdr->p_type == llvm::ELF::PT_TLS) {
- _tpOff = llvm::RoundUpToAlignment(TCB_SIZE, phdr->p_align);
+ _tpOff = llvm::alignTo(TCB_SIZE, phdr->p_align);
break;
}
}
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.cpp Thu Jan 14 14:53:50 2016
@@ -58,7 +58,7 @@ MipsOptionsSection<ELFT>::MipsOptionsSec
this->setOrder(MipsTargetLayout<ELFT>::ORDER_MIPS_OPTIONS);
this->_entSize = 1;
this->_alignment = 8;
- this->_fsize = llvm::RoundUpToAlignment(
+ this->_fsize = llvm::alignTo(
sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo), this->_alignment);
this->_msize = this->_fsize;
this->_type = SHT_MIPS_OPTIONS;
@@ -100,7 +100,7 @@ MipsAbiFlagsSection<ELFT>::MipsAbiFlagsS
_targetLayout(targetLayout) {
this->setOrder(MipsTargetLayout<ELFT>::ORDER_MIPS_ABI_FLAGS);
this->_alignment = 8;
- this->_fsize = llvm::RoundUpToAlignment(sizeof(_abiFlags), this->_alignment);
+ this->_fsize = llvm::alignTo(sizeof(_abiFlags), this->_alignment);
this->_msize = this->_fsize;
this->_entSize = this->_fsize;
this->_type = SHT_MIPS_ABIFLAGS;
Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.cpp Thu Jan 14 14:53:50 2016
@@ -156,7 +156,7 @@ void Segment<ELFT>::assignFileOffsets(ui
fileOffset = newOffset;
}
// Align fileoffset to the alignment of the section.
- fileOffset = llvm::RoundUpToAlignment(fileOffset, section->alignment());
+ fileOffset = llvm::alignTo(fileOffset, section->alignment());
// If the linker outputmagic is set to OutputMagic::NMAGIC, align the Data
// to a page boundary
if (isFirstSection &&
@@ -165,18 +165,17 @@ void Segment<ELFT>::assignFileOffsets(ui
// Align to a page only if the output is not
// OutputMagic::NMAGIC/OutputMagic::OMAGIC
if (alignSegments)
- fileOffset = llvm::RoundUpToAlignment(fileOffset, p_align);
+ fileOffset = llvm::alignTo(fileOffset, p_align);
// Align according to ELF spec.
// in p75, http://www.sco.com/developers/devspecs/gabi41.pdf
uint64_t virtualAddress = slice->virtualAddr();
Section<ELFT> *sect = dyn_cast<Section<ELFT>>(section);
if (sect && sect->isLoadableSection() &&
((virtualAddress & (p_align - 1)) != (fileOffset & (p_align - 1))))
- fileOffset = llvm::RoundUpToAlignment(fileOffset, p_align) +
- (virtualAddress % p_align);
+ fileOffset =
+ llvm::alignTo(fileOffset, p_align) + (virtualAddress % p_align);
} else if (!isDataPageAlignedForNMagic && needAlign(section)) {
- fileOffset =
- llvm::RoundUpToAlignment(fileOffset, this->_ctx.getPageSize());
+ fileOffset = llvm::alignTo(fileOffset, this->_ctx.getPageSize());
isDataPageAlignedForNMagic = true;
}
if (isFirstSection) {
@@ -228,15 +227,15 @@ template <class ELFT> void Segment<ELFT>
_outputMagic != ELFLinkingContext::OutputMagic::OMAGIC) {
// Align to a page only if the output is not
// OutputMagic::NMAGIC/OutputMagic::OMAGIC
- startAddr = llvm::RoundUpToAlignment(startAddr, this->_ctx.getPageSize());
+ startAddr = llvm::alignTo(startAddr, this->_ctx.getPageSize());
} else if (needAlign(*si)) {
// If the linker outputmagic is set to OutputMagic::NMAGIC, align the
// Data to a page boundary.
- startAddr = llvm::RoundUpToAlignment(startAddr, this->_ctx.getPageSize());
+ startAddr = llvm::alignTo(startAddr, this->_ctx.getPageSize());
isDataPageAlignedForNMagic = true;
}
// align the startOffset to the section alignment
- uint64_t newAddr = llvm::RoundUpToAlignment(startAddr, (*si)->alignment());
+ uint64_t newAddr = llvm::alignTo(startAddr, (*si)->alignment());
// Handle linker script expressions, which *may update newAddr* if the
// expression assigns to "."
if (auto expr = dyn_cast<ExpressionChunk<ELFT>>(*si))
@@ -248,8 +247,7 @@ template <class ELFT> void Segment<ELFT>
// Handle TLS.
if (auto section = dyn_cast<Section<ELFT>>(*si)) {
if (section->getSegmentType() == llvm::ELF::PT_TLS) {
- tlsStartAddr =
- llvm::RoundUpToAlignment(tlsStartAddr, (*si)->alignment());
+ tlsStartAddr = llvm::alignTo(tlsStartAddr, (*si)->alignment());
section->assignVirtualAddress(tlsStartAddr);
tlsStartAddr += (*si)->memSize();
} else {
@@ -278,11 +276,11 @@ template <class ELFT> void Segment<ELFT>
// If the linker outputmagic is set to OutputMagic::NMAGIC, align the
// Data
// to a page boundary
- curAddr = llvm::RoundUpToAlignment(curAddr, this->_ctx.getPageSize());
+ curAddr = llvm::alignTo(curAddr, this->_ctx.getPageSize());
isDataPageAlignedForNMagic = true;
}
- uint64_t newAddr = llvm::RoundUpToAlignment(
- forceScriptAddr ? scriptAddr : curAddr, (*si)->alignment());
+ uint64_t newAddr = llvm::alignTo(forceScriptAddr ? scriptAddr : curAddr,
+ (*si)->alignment());
forceScriptAddr = false;
// Handle linker script expressions, which may force an address change if
@@ -347,8 +345,7 @@ template <class ELFT> void Segment<ELFT>
// Handle TLS.
if (auto section = dyn_cast<Section<ELFT>>(*si)) {
if (section->getSegmentType() == llvm::ELF::PT_TLS) {
- tlsStartAddr =
- llvm::RoundUpToAlignment(tlsStartAddr, (*si)->alignment());
+ tlsStartAddr = llvm::alignTo(tlsStartAddr, (*si)->alignment());
section->assignVirtualAddress(tlsStartAddr);
tlsStartAddr += (*si)->memSize();
} else {
Modified: lld/trunk/lib/ReaderWriter/ELF/TargetLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetLayout.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/TargetLayout.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/TargetLayout.cpp Thu Jan 14 14:53:50 2016
@@ -616,7 +616,7 @@ void TargetLayout<ELFT>::assignFileOffse
section = dyn_cast<Section<ELFT>>(si);
if (section && TargetLayout<ELFT>::hasOutputSegment(section))
continue;
- fileoffset = llvm::RoundUpToAlignment(fileoffset, si->alignment());
+ fileoffset = llvm::alignTo(fileoffset, si->alignment());
si->setFileOffset(fileoffset);
si->setVirtualAddr(0);
fileoffset += si->fileSize();
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp Thu Jan 14 14:53:50 2016
@@ -255,7 +255,7 @@ StringRef MachOFileLayout::dyldPath() {
}
uint32_t MachOFileLayout::pointerAlign(uint32_t value) {
- return llvm::RoundUpToAlignment(value, _is64 ? 8 : 4);
+ return llvm::alignTo(value, _is64 ? 8 : 4);
}
@@ -292,7 +292,7 @@ MachOFileLayout::MachOFileLayout(const N
if (isZeroFillSection(sect.type))
_sectInfo[§].fileOffset = 0;
else {
- offset = llvm::RoundUpToAlignment(offset, sect.alignment);
+ offset = llvm::alignTo(offset, sect.alignment);
_sectInfo[§].fileOffset = offset;
offset += sect.content.size();
}
@@ -539,10 +539,8 @@ void MachOFileLayout::buildFileOffsets()
<< ", fileOffset=" << fileOffset << "\n");
}
- _segInfo[&sg].fileSize = llvm::RoundUpToAlignment(segFileSize,
- _file.pageSize);
- fileOffset = llvm::RoundUpToAlignment(fileOffset + segFileSize,
- _file.pageSize);
+ _segInfo[&sg].fileSize = llvm::alignTo(segFileSize, _file.pageSize);
+ fileOffset = llvm::alignTo(fileOffset + segFileSize, _file.pageSize);
_addressOfLinkEdit = sg.address + sg.size;
}
_startOfLinkEdit = fileOffset;
@@ -679,7 +677,7 @@ std::error_code MachOFileLayout::writeSe
uint8_t *next = lc + cmd->cmdsize;
setString16("__LINKEDIT", cmd->segname);
cmd->vmaddr = _addressOfLinkEdit;
- cmd->vmsize = llvm::RoundUpToAlignment(linkeditSize, _file.pageSize);
+ cmd->vmsize = llvm::alignTo(linkeditSize, _file.pageSize);
cmd->fileoff = _startOfLinkEdit;
cmd->filesize = linkeditSize;
cmd->maxprot = VM_PROT_READ;
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=257801&r1=257800&r2=257801&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Thu Jan 14 14:53:50 2016
@@ -465,10 +465,10 @@ void Util::organizeSections() {
void Util::layoutSectionsInSegment(SegmentInfo *seg, uint64_t &addr) {
seg->address = addr;
for (SectionInfo *sect : seg->sections) {
- sect->address = llvm::RoundUpToAlignment(addr, sect->alignment);
+ sect->address = llvm::alignTo(addr, sect->alignment);
addr = sect->address + sect->size;
}
- seg->size = llvm::RoundUpToAlignment(addr - seg->address, _ctx.pageSize());
+ seg->size = llvm::alignTo(addr - seg->address, _ctx.pageSize());
}
// __TEXT segment lays out backwards so padding is at front after load commands.
@@ -488,10 +488,10 @@ void Util::layoutSectionsInTextSegment(s
// Start assigning section address starting at padded offset.
addr += (padding + hlcSize);
for (SectionInfo *sect : seg->sections) {
- sect->address = llvm::RoundUpToAlignment(addr, sect->alignment);
+ sect->address = llvm::alignTo(addr, sect->alignment);
addr = sect->address + sect->size;
}
- seg->size = llvm::RoundUpToAlignment(addr - seg->address, _ctx.pageSize());
+ seg->size = llvm::alignTo(addr - seg->address, _ctx.pageSize());
}
void Util::assignAddressesToSections(const NormalizedFile &file) {
@@ -511,7 +511,7 @@ void Util::assignAddressesToSections(con
} else
layoutSectionsInSegment(seg, address);
- address = llvm::RoundUpToAlignment(address, _ctx.pageSize());
+ address = llvm::alignTo(address, _ctx.pageSize());
}
DEBUG_WITH_TYPE("WriterMachO-norm",
llvm::dbgs() << "assignAddressesToSections()\n";
More information about the llvm-commits
mailing list