diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-22 08:27:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-22 08:27:54 +0000 |
commit | fef19ffe3ad064d9a18fc3b2c9056a93944517cf (patch) | |
tree | fb8313fdf093e5b9b6f800f0183a9ca14ab70d37 /llvm/lib/MC/MCAssembler.cpp | |
parent | 6860ac7375966b81791b009a4a60b12fea85c0ce (diff) | |
download | bcm5719-llvm-fef19ffe3ad064d9a18fc3b2c9056a93944517cf.tar.gz bcm5719-llvm-fef19ffe3ad064d9a18fc3b2c9056a93944517cf.zip |
llvm-mc: Rename / redefine MCFragment::FileOffset to MCFragment::Offset (the
section offset).
llvm-svn: 79734
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
-rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 9d8c3c5600d..16864f96072 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -202,7 +202,6 @@ MCFragment::MCFragment() : Kind(FragmentType(~0)) { MCFragment::MCFragment(FragmentType _Kind, MCSectionData *SD) : Kind(_Kind), - FileOffset(~UINT64_C(0)), FileSize(~UINT64_C(0)) { if (SD) @@ -234,22 +233,20 @@ MCAssembler::~MCAssembler() { } void MCAssembler::LayoutSection(MCSectionData &SD) { - uint64_t FileOffset = SD.getFileOffset(); - uint64_t SectionOffset = 0; + uint64_t Offset = 0; for (MCSectionData::iterator it = SD.begin(), ie = SD.end(); it != ie; ++it) { MCFragment &F = *it; - F.setFileOffset(FileOffset); + F.setOffset(Offset); // Evaluate fragment size. switch (F.getKind()) { case MCFragment::FT_Align: { MCAlignFragment &AF = cast<MCAlignFragment>(F); - uint64_t AlignedOffset = - RoundUpToAlignment(SectionOffset, AF.getAlignment()); - uint64_t PaddingBytes = AlignedOffset - SectionOffset; + uint64_t AlignedOffset = RoundUpToAlignment(Offset, AF.getAlignment()); + uint64_t PaddingBytes = AlignedOffset - Offset; if (PaddingBytes > AF.getMaxBytesToEmit()) AF.setFileSize(0); @@ -271,21 +268,20 @@ void MCAssembler::LayoutSection(MCSectionData &SD) { uint64_t OrgOffset = OF.getOffset().getConstant(); // FIXME: We need a way to communicate this error. - if (OrgOffset < SectionOffset) + if (OrgOffset < Offset) llvm_report_error("invalid .org offset '" + Twine(OrgOffset) + - "' (section offset '" + Twine(SectionOffset) + "'"); + "' (section offset '" + Twine(Offset) + "'"); - F.setFileSize(OrgOffset - SectionOffset); + F.setFileSize(OrgOffset - Offset); break; } } - FileOffset += F.getFileSize(); - SectionOffset += F.getFileSize(); + Offset += F.getFileSize(); } // FIXME: Pad section? - SD.setFileSize(FileOffset - SD.getFileOffset()); + SD.setFileSize(Offset); } /// WriteFileData - Write the \arg F data to the output file. @@ -294,8 +290,6 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, uint64_t Start = OS.tell(); (void) Start; - assert(F.getFileOffset() == Start && "Invalid file offset!"); - // FIXME: Embed in fragments instead? switch (F.getKind()) { case MCFragment::FT_Align: { |