diff options
author | Guillaume Chatelet <gchatelet@google.com> | 2019-09-12 15:20:36 +0000 |
---|---|---|
committer | Guillaume Chatelet <gchatelet@google.com> | 2019-09-12 15:20:36 +0000 |
commit | af11cc7eb5da320066d88a8f6d015e6296f0da25 (patch) | |
tree | 8b2da3ac0f4a3b206edd98e49cc89917fecb6e5b /llvm/lib/MC/MachObjectWriter.cpp | |
parent | 0866dbfa1a8b36db16f58d1bd60688474d1b9474 (diff) | |
download | bcm5719-llvm-af11cc7eb5da320066d88a8f6d015e6296f0da25.tar.gz bcm5719-llvm-af11cc7eb5da320066d88a8f6d015e6296f0da25.zip |
[Alignment] Move OffsetToAlignment to Alignment.h
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, alexshap, rupprecht, jhenderson
Subscribers: sdardis, nemanjai, hiraditya, kbarton, jakehehrlich, jrtc27, MaskRay, atanasyan, jsji, seiya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D67499
llvm-svn: 371742
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index 251fe5abbcf..03fb03fe1b6 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -25,6 +25,7 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCSymbolMachO.h" #include "llvm/MC/MCValue.h" +#include "llvm/Support/Alignment.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" @@ -126,7 +127,7 @@ uint64_t MachObjectWriter::getPaddingSize(const MCSection *Sec, const MCSection &NextSec = *Layout.getSectionOrder()[Next]; if (NextSec.isVirtualSection()) return 0; - return OffsetToAlignment(EndAddr, NextSec.getAlignment()); + return offsetToAlignment(EndAddr, llvm::Align(NextSec.getAlignment())); } void MachObjectWriter::writeHeader(MachO::HeaderFileType Type, @@ -444,7 +445,8 @@ void MachObjectWriter::writeLinkerOptionsLoadCommand( } // Pad to a multiple of the pointer size. - W.OS.write_zeros(OffsetToAlignment(BytesWritten, is64Bit() ? 8 : 4)); + W.OS.write_zeros(offsetToAlignment(BytesWritten, is64Bit() ? llvm::Align(8) + : llvm::Align(4))); assert(W.OS.tell() - Start == Size); } @@ -832,7 +834,8 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm, // The section data is padded to 4 bytes. // // FIXME: Is this machine dependent? - unsigned SectionDataPadding = OffsetToAlignment(SectionDataFileSize, 4); + unsigned SectionDataPadding = + offsetToAlignment(SectionDataFileSize, llvm::Align(4)); SectionDataFileSize += SectionDataPadding; // Write the prolog, starting with the header and load command... @@ -997,7 +1000,8 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm, #endif Asm.getLOHContainer().emit(*this, Layout); // Pad to a multiple of the pointer size. - W.OS.write_zeros(OffsetToAlignment(LOHRawSize, is64Bit() ? 8 : 4)); + W.OS.write_zeros(offsetToAlignment(LOHRawSize, is64Bit() ? llvm::Align(8) + : llvm::Align(4))); assert(W.OS.tell() - Start == LOHSize); } |