summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2019-09-13 09:29:59 +0000
committerGuillaume Chatelet <gchatelet@google.com>2019-09-13 09:29:59 +0000
commit36202635323be0f6436c8d5fed1f5cb03808dbb7 (patch)
treee5c92d30e09334dddfc647ddf947d6ae175811f3 /llvm/lib/MC/ELFObjectWriter.cpp
parent7da559f2f60ef69a0098487ea25e0d81fdccc2f2 (diff)
downloadbcm5719-llvm-36202635323be0f6436c8d5fed1f5cb03808dbb7.tar.gz
bcm5719-llvm-36202635323be0f6436c8d5fed1f5cb03808dbb7.zip
[Alignment] Introduce llvm::Align to MCSection
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet, JDevlieghere Subscribers: arsenm, sdardis, jvesely, nhaehnle, sbc100, hiraditya, aheejin, jrtc27, atanasyan, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67486 llvm-svn: 371831
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index b70f1dc46f7..b237d5620bf 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -638,7 +638,7 @@ void ELFWriter::computeSymbolTable(
unsigned EntrySize = is64Bit() ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
MCSectionELF *SymtabSection =
Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, "");
- SymtabSection->setAlignment(is64Bit() ? 8 : 4);
+ SymtabSection->setAlignment(is64Bit() ? llvm::Align(8) : llvm::Align(4));
SymbolTableIndex = addToSectionTable(SymtabSection);
align(SymtabSection->getAlignment());
@@ -736,7 +736,7 @@ void ELFWriter::computeSymbolTable(
MCSectionELF *SymtabShndxSection =
Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
SymtabShndxSectionIndex = addToSectionTable(SymtabShndxSection);
- SymtabShndxSection->setAlignment(4);
+ SymtabShndxSection->setAlignment(llvm::Align(4));
}
ArrayRef<std::string> FileNames = Asm.getFileNames();
@@ -824,7 +824,7 @@ MCSectionELF *ELFWriter::createRelocationSection(MCContext &Ctx,
MCSectionELF *RelaSection = Ctx.createELFRelSection(
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
Flags, EntrySize, Sec.getGroup(), &Sec);
- RelaSection->setAlignment(is64Bit() ? 8 : 4);
+ RelaSection->setAlignment(is64Bit() ? llvm::Align(8) : llvm::Align(4));
return RelaSection;
}
@@ -911,7 +911,7 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec,
Section.setFlags(Section.getFlags() | ELF::SHF_COMPRESSED);
// Alignment field should reflect the requirements of
// the compressed section header.
- Section.setAlignment(is64Bit() ? 8 : 4);
+ Section.setAlignment(is64Bit() ? llvm::Align(8) : llvm::Align(4));
} else {
// Add "z" prefix to section name. This is zlib-gnu style.
MC.renameELFSection(&Section, (".z" + SectionName.drop_front(1)).str());
@@ -1135,7 +1135,7 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) {
if (!GroupIdx) {
MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
GroupIdx = addToSectionTable(Group);
- Group->setAlignment(4);
+ Group->setAlignment(llvm::Align(4));
Groups.push_back(Group);
}
std::vector<const MCSectionELF *> &Members =
OpenPOWER on IntegriCloud