mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-22 19:38:40 +00:00
Switch MCAssembler to method names starting w/ lower-case.
per http://llvm.org/docs/CodingStandards.html#ll_naming git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145873 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f503ef6800
commit
f77d5b14af
@ -711,43 +711,43 @@ private:
|
|||||||
/// \return Whether the fixup value was fully resolved. This is true if the
|
/// \return Whether the fixup value was fully resolved. This is true if the
|
||||||
/// \arg Value result is fixed, otherwise the value may change due to
|
/// \arg Value result is fixed, otherwise the value may change due to
|
||||||
/// relocation.
|
/// relocation.
|
||||||
bool EvaluateFixup(const MCAsmLayout &Layout,
|
bool evaluateFixup(const MCAsmLayout &Layout,
|
||||||
const MCFixup &Fixup, const MCFragment *DF,
|
const MCFixup &Fixup, const MCFragment *DF,
|
||||||
MCValue &Target, uint64_t &Value) const;
|
MCValue &Target, uint64_t &Value) const;
|
||||||
|
|
||||||
/// Check whether a fixup can be satisfied, or whether it needs to be relaxed
|
/// Check whether a fixup can be satisfied, or whether it needs to be relaxed
|
||||||
/// (increased in size, in order to hold its value correctly).
|
/// (increased in size, in order to hold its value correctly).
|
||||||
bool FixupNeedsRelaxation(const MCFixup &Fixup, const MCFragment *DF,
|
bool fixupNeedsRelaxation(const MCFixup &Fixup, const MCFragment *DF,
|
||||||
const MCAsmLayout &Layout) const;
|
const MCAsmLayout &Layout) const;
|
||||||
|
|
||||||
/// Check whether the given fragment needs relaxation.
|
/// Check whether the given fragment needs relaxation.
|
||||||
bool FragmentNeedsRelaxation(const MCInstFragment *IF,
|
bool fragmentNeedsRelaxation(const MCInstFragment *IF,
|
||||||
const MCAsmLayout &Layout) const;
|
const MCAsmLayout &Layout) const;
|
||||||
|
|
||||||
/// LayoutOnce - Perform one layout iteration and return true if any offsets
|
/// layoutOnce - Perform one layout iteration and return true if any offsets
|
||||||
/// were adjusted.
|
/// were adjusted.
|
||||||
bool LayoutOnce(MCAsmLayout &Layout);
|
bool layoutOnce(MCAsmLayout &Layout);
|
||||||
|
|
||||||
bool LayoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
|
bool layoutSectionOnce(MCAsmLayout &Layout, MCSectionData &SD);
|
||||||
|
|
||||||
bool RelaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
|
bool relaxInstruction(MCAsmLayout &Layout, MCInstFragment &IF);
|
||||||
|
|
||||||
bool RelaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
|
bool relaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
|
||||||
|
|
||||||
bool RelaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
|
bool relaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
|
||||||
bool RelaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
bool relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
||||||
MCDwarfCallFrameFragment &DF);
|
MCDwarfCallFrameFragment &DF);
|
||||||
|
|
||||||
/// FinishLayout - Finalize a layout, including fragment lowering.
|
/// finishLayout - Finalize a layout, including fragment lowering.
|
||||||
void FinishLayout(MCAsmLayout &Layout);
|
void finishLayout(MCAsmLayout &Layout);
|
||||||
|
|
||||||
uint64_t HandleFixup(const MCAsmLayout &Layout,
|
uint64_t handleFixup(const MCAsmLayout &Layout,
|
||||||
MCFragment &F, const MCFixup &Fixup);
|
MCFragment &F, const MCFixup &Fixup);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Compute the effective fragment size assuming it is laid out at the given
|
/// Compute the effective fragment size assuming it is laid out at the given
|
||||||
/// \arg SectionAddress and \arg FragmentOffset.
|
/// \arg SectionAddress and \arg FragmentOffset.
|
||||||
uint64_t ComputeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const;
|
uint64_t computeFragmentSize(const MCAsmLayout &Layout, const MCFragment &F) const;
|
||||||
|
|
||||||
/// Find the symbol which defines the atom containing the given symbol, or
|
/// Find the symbol which defines the atom containing the given symbol, or
|
||||||
/// null if there is no such symbol.
|
/// null if there is no such symbol.
|
||||||
@ -760,7 +760,7 @@ public:
|
|||||||
bool isSymbolLinkerVisible(const MCSymbol &SD) const;
|
bool isSymbolLinkerVisible(const MCSymbol &SD) const;
|
||||||
|
|
||||||
/// Emit the section contents using the given object writer.
|
/// Emit the section contents using the given object writer.
|
||||||
void WriteSectionData(const MCSectionData *Section,
|
void writeSectionData(const MCSectionData *Section,
|
||||||
const MCAsmLayout &Layout) const;
|
const MCAsmLayout &Layout) const;
|
||||||
|
|
||||||
/// Check whether a given symbol has been flagged with .thumb_func.
|
/// Check whether a given symbol has been flagged with .thumb_func.
|
||||||
|
@ -1072,7 +1072,7 @@ void ELFObjectWriter::WriteDataSectionData(MCAssembler &Asm,
|
|||||||
WriteBytes(cast<MCDataFragment>(F).getContents().str());
|
WriteBytes(cast<MCDataFragment>(F).getContents().str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Asm.WriteSectionData(&SD, Layout);
|
Asm.writeSectionData(&SD, Layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ using namespace llvm;
|
|||||||
namespace {
|
namespace {
|
||||||
namespace stats {
|
namespace stats {
|
||||||
STATISTIC(EmittedFragments, "Number of emitted assembler fragments");
|
STATISTIC(EmittedFragments, "Number of emitted assembler fragments");
|
||||||
STATISTIC(EvaluateFixup, "Number of evaluated fixups");
|
STATISTIC(evaluateFixup, "Number of evaluated fixups");
|
||||||
STATISTIC(FragmentLayouts, "Number of fragment layouts");
|
STATISTIC(FragmentLayouts, "Number of fragment layouts");
|
||||||
STATISTIC(ObjectBytes, "Number of emitted object file bytes");
|
STATISTIC(ObjectBytes, "Number of emitted object file bytes");
|
||||||
STATISTIC(RelaxationSteps, "Number of assembler layout and relaxation steps");
|
STATISTIC(RelaxationSteps, "Number of assembler layout and relaxation steps");
|
||||||
@ -136,7 +136,7 @@ uint64_t MCAsmLayout::getSymbolOffset(const MCSymbolData *SD) const {
|
|||||||
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
|
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
|
||||||
// The size is the last fragment's end offset.
|
// The size is the last fragment's end offset.
|
||||||
const MCFragment &F = SD->getFragmentList().back();
|
const MCFragment &F = SD->getFragmentList().back();
|
||||||
return getFragmentOffset(&F) + getAssembler().ComputeFragmentSize(*this, F);
|
return getFragmentOffset(&F) + getAssembler().computeFragmentSize(*this, F);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t MCAsmLayout::getSectionFileSize(const MCSectionData *SD) const {
|
uint64_t MCAsmLayout::getSectionFileSize(const MCSectionData *SD) const {
|
||||||
@ -237,10 +237,10 @@ const MCSymbolData *MCAssembler::getAtom(const MCSymbolData *SD) const {
|
|||||||
return SD->getFragment()->getAtom();
|
return SD->getFragment()->getAtom();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
|
bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
|
||||||
const MCFixup &Fixup, const MCFragment *DF,
|
const MCFixup &Fixup, const MCFragment *DF,
|
||||||
MCValue &Target, uint64_t &Value) const {
|
MCValue &Target, uint64_t &Value) const {
|
||||||
++stats::EvaluateFixup;
|
++stats::evaluateFixup;
|
||||||
|
|
||||||
if (!Fixup.getValue()->EvaluateAsRelocatable(Target, Layout))
|
if (!Fixup.getValue()->EvaluateAsRelocatable(Target, Layout))
|
||||||
report_fatal_error("expected relocatable expression");
|
report_fatal_error("expected relocatable expression");
|
||||||
@ -312,7 +312,7 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
|
|||||||
return IsResolved;
|
return IsResolved;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t MCAssembler::ComputeFragmentSize(const MCAsmLayout &Layout,
|
uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
|
||||||
const MCFragment &F) const {
|
const MCFragment &F) const {
|
||||||
switch (F.getKind()) {
|
switch (F.getKind()) {
|
||||||
case MCFragment::FT_Data:
|
case MCFragment::FT_Data:
|
||||||
@ -374,7 +374,7 @@ void MCAsmLayout::LayoutFragment(MCFragment *F) {
|
|||||||
// Compute fragment offset and size.
|
// Compute fragment offset and size.
|
||||||
uint64_t Offset = 0;
|
uint64_t Offset = 0;
|
||||||
if (Prev)
|
if (Prev)
|
||||||
Offset += Prev->Offset + getAssembler().ComputeFragmentSize(*this, *Prev);
|
Offset += Prev->Offset + getAssembler().computeFragmentSize(*this, *Prev);
|
||||||
|
|
||||||
F->Offset = Offset;
|
F->Offset = Offset;
|
||||||
LastValidFragment[F->getParent()] = F;
|
LastValidFragment[F->getParent()] = F;
|
||||||
@ -390,7 +390,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|||||||
++stats::EmittedFragments;
|
++stats::EmittedFragments;
|
||||||
|
|
||||||
// FIXME: Embed in fragments instead?
|
// FIXME: Embed in fragments instead?
|
||||||
uint64_t FragmentSize = Asm.ComputeFragmentSize(Layout, F);
|
uint64_t FragmentSize = Asm.computeFragmentSize(Layout, F);
|
||||||
switch (F.getKind()) {
|
switch (F.getKind()) {
|
||||||
case MCFragment::FT_Align: {
|
case MCFragment::FT_Align: {
|
||||||
MCAlignFragment &AF = cast<MCAlignFragment>(F);
|
MCAlignFragment &AF = cast<MCAlignFragment>(F);
|
||||||
@ -493,7 +493,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
|||||||
assert(OW->getStream().tell() - Start == FragmentSize);
|
assert(OW->getStream().tell() - Start == FragmentSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAssembler::WriteSectionData(const MCSectionData *SD,
|
void MCAssembler::writeSectionData(const MCSectionData *SD,
|
||||||
const MCAsmLayout &Layout) const {
|
const MCAsmLayout &Layout) const {
|
||||||
// Ignore virtual sections.
|
// Ignore virtual sections.
|
||||||
if (SD->getSection().isVirtualSection()) {
|
if (SD->getSection().isVirtualSection()) {
|
||||||
@ -546,13 +546,13 @@ void MCAssembler::WriteSectionData(const MCSectionData *SD,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint64_t MCAssembler::HandleFixup(const MCAsmLayout &Layout,
|
uint64_t MCAssembler::handleFixup(const MCAsmLayout &Layout,
|
||||||
MCFragment &F,
|
MCFragment &F,
|
||||||
const MCFixup &Fixup) {
|
const MCFixup &Fixup) {
|
||||||
// Evaluate the fixup.
|
// Evaluate the fixup.
|
||||||
MCValue Target;
|
MCValue Target;
|
||||||
uint64_t FixedValue;
|
uint64_t FixedValue;
|
||||||
if (!EvaluateFixup(Layout, Fixup, &F, Target, FixedValue)) {
|
if (!evaluateFixup(Layout, Fixup, &F, Target, FixedValue)) {
|
||||||
// The fixup was unresolved, we need a relocation. Inform the object
|
// The fixup was unresolved, we need a relocation. Inform the object
|
||||||
// writer of the relocation, and give it an opportunity to adjust the
|
// writer of the relocation, and give it an opportunity to adjust the
|
||||||
// fixup value if need be.
|
// fixup value if need be.
|
||||||
@ -592,7 +592,7 @@ void MCAssembler::Finish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Layout until everything fits.
|
// Layout until everything fits.
|
||||||
while (LayoutOnce(Layout))
|
while (layoutOnce(Layout))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DEBUG_WITH_TYPE("mc-dump", {
|
DEBUG_WITH_TYPE("mc-dump", {
|
||||||
@ -600,7 +600,7 @@ void MCAssembler::Finish() {
|
|||||||
dump(); });
|
dump(); });
|
||||||
|
|
||||||
// Finalize the layout, including fragment lowering.
|
// Finalize the layout, including fragment lowering.
|
||||||
FinishLayout(Layout);
|
finishLayout(Layout);
|
||||||
|
|
||||||
DEBUG_WITH_TYPE("mc-dump", {
|
DEBUG_WITH_TYPE("mc-dump", {
|
||||||
llvm::errs() << "assembler backend - final-layout\n--\n";
|
llvm::errs() << "assembler backend - final-layout\n--\n";
|
||||||
@ -621,7 +621,7 @@ void MCAssembler::Finish() {
|
|||||||
for (MCDataFragment::fixup_iterator it3 = DF->fixup_begin(),
|
for (MCDataFragment::fixup_iterator it3 = DF->fixup_begin(),
|
||||||
ie3 = DF->fixup_end(); it3 != ie3; ++it3) {
|
ie3 = DF->fixup_end(); it3 != ie3; ++it3) {
|
||||||
MCFixup &Fixup = *it3;
|
MCFixup &Fixup = *it3;
|
||||||
uint64_t FixedValue = HandleFixup(Layout, *DF, Fixup);
|
uint64_t FixedValue = handleFixup(Layout, *DF, Fixup);
|
||||||
getBackend().ApplyFixup(Fixup, DF->getContents().data(),
|
getBackend().ApplyFixup(Fixup, DF->getContents().data(),
|
||||||
DF->getContents().size(), FixedValue);
|
DF->getContents().size(), FixedValue);
|
||||||
}
|
}
|
||||||
@ -631,7 +631,7 @@ void MCAssembler::Finish() {
|
|||||||
for (MCInstFragment::fixup_iterator it3 = IF->fixup_begin(),
|
for (MCInstFragment::fixup_iterator it3 = IF->fixup_begin(),
|
||||||
ie3 = IF->fixup_end(); it3 != ie3; ++it3) {
|
ie3 = IF->fixup_end(); it3 != ie3; ++it3) {
|
||||||
MCFixup &Fixup = *it3;
|
MCFixup &Fixup = *it3;
|
||||||
uint64_t FixedValue = HandleFixup(Layout, *IF, Fixup);
|
uint64_t FixedValue = handleFixup(Layout, *IF, Fixup);
|
||||||
getBackend().ApplyFixup(Fixup, IF->getCode().data(),
|
getBackend().ApplyFixup(Fixup, IF->getCode().data(),
|
||||||
IF->getCode().size(), FixedValue);
|
IF->getCode().size(), FixedValue);
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ void MCAssembler::Finish() {
|
|||||||
stats::ObjectBytes += OS.tell() - StartOffset;
|
stats::ObjectBytes += OS.tell() - StartOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::FixupNeedsRelaxation(const MCFixup &Fixup,
|
bool MCAssembler::fixupNeedsRelaxation(const MCFixup &Fixup,
|
||||||
const MCFragment *DF,
|
const MCFragment *DF,
|
||||||
const MCAsmLayout &Layout) const {
|
const MCAsmLayout &Layout) const {
|
||||||
if (getRelaxAll())
|
if (getRelaxAll())
|
||||||
@ -654,7 +654,7 @@ bool MCAssembler::FixupNeedsRelaxation(const MCFixup &Fixup,
|
|||||||
// If we cannot resolve the fixup value, it requires relaxation.
|
// If we cannot resolve the fixup value, it requires relaxation.
|
||||||
MCValue Target;
|
MCValue Target;
|
||||||
uint64_t Value;
|
uint64_t Value;
|
||||||
if (!EvaluateFixup(Layout, Fixup, DF, Target, Value))
|
if (!evaluateFixup(Layout, Fixup, DF, Target, Value))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Otherwise, relax if the value is too big for a (signed) i8.
|
// Otherwise, relax if the value is too big for a (signed) i8.
|
||||||
@ -663,7 +663,7 @@ bool MCAssembler::FixupNeedsRelaxation(const MCFixup &Fixup,
|
|||||||
return int64_t(Value) != int64_t(int8_t(Value));
|
return int64_t(Value) != int64_t(int8_t(Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::FragmentNeedsRelaxation(const MCInstFragment *IF,
|
bool MCAssembler::fragmentNeedsRelaxation(const MCInstFragment *IF,
|
||||||
const MCAsmLayout &Layout) const {
|
const MCAsmLayout &Layout) const {
|
||||||
// If this inst doesn't ever need relaxation, ignore it. This occurs when we
|
// If this inst doesn't ever need relaxation, ignore it. This occurs when we
|
||||||
// are intentionally pushing out inst fragments, or because we relaxed a
|
// are intentionally pushing out inst fragments, or because we relaxed a
|
||||||
@ -673,15 +673,15 @@ bool MCAssembler::FragmentNeedsRelaxation(const MCInstFragment *IF,
|
|||||||
|
|
||||||
for (MCInstFragment::const_fixup_iterator it = IF->fixup_begin(),
|
for (MCInstFragment::const_fixup_iterator it = IF->fixup_begin(),
|
||||||
ie = IF->fixup_end(); it != ie; ++it)
|
ie = IF->fixup_end(); it != ie; ++it)
|
||||||
if (FixupNeedsRelaxation(*it, IF, Layout))
|
if (fixupNeedsRelaxation(*it, IF, Layout))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::RelaxInstruction(MCAsmLayout &Layout,
|
bool MCAssembler::relaxInstruction(MCAsmLayout &Layout,
|
||||||
MCInstFragment &IF) {
|
MCInstFragment &IF) {
|
||||||
if (!FragmentNeedsRelaxation(&IF, Layout))
|
if (!fragmentNeedsRelaxation(&IF, Layout))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
++stats::RelaxedInstructions;
|
++stats::RelaxedInstructions;
|
||||||
@ -715,7 +715,7 @@ bool MCAssembler::RelaxInstruction(MCAsmLayout &Layout,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::RelaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
|
bool MCAssembler::relaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
|
||||||
int64_t Value = 0;
|
int64_t Value = 0;
|
||||||
uint64_t OldSize = LF.getContents().size();
|
uint64_t OldSize = LF.getContents().size();
|
||||||
bool IsAbs = LF.getValue().EvaluateAsAbsolute(Value, Layout);
|
bool IsAbs = LF.getValue().EvaluateAsAbsolute(Value, Layout);
|
||||||
@ -732,7 +732,7 @@ bool MCAssembler::RelaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
|
|||||||
return OldSize != LF.getContents().size();
|
return OldSize != LF.getContents().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::RelaxDwarfLineAddr(MCAsmLayout &Layout,
|
bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layout,
|
||||||
MCDwarfLineAddrFragment &DF) {
|
MCDwarfLineAddrFragment &DF) {
|
||||||
int64_t AddrDelta = 0;
|
int64_t AddrDelta = 0;
|
||||||
uint64_t OldSize = DF.getContents().size();
|
uint64_t OldSize = DF.getContents().size();
|
||||||
@ -749,7 +749,7 @@ bool MCAssembler::RelaxDwarfLineAddr(MCAsmLayout &Layout,
|
|||||||
return OldSize != Data.size();
|
return OldSize != Data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::RelaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
bool MCAssembler::relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
||||||
MCDwarfCallFrameFragment &DF) {
|
MCDwarfCallFrameFragment &DF) {
|
||||||
int64_t AddrDelta = 0;
|
int64_t AddrDelta = 0;
|
||||||
uint64_t OldSize = DF.getContents().size();
|
uint64_t OldSize = DF.getContents().size();
|
||||||
@ -764,7 +764,7 @@ bool MCAssembler::RelaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
|||||||
return OldSize != Data.size();
|
return OldSize != Data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::LayoutSectionOnce(MCAsmLayout &Layout,
|
bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout,
|
||||||
MCSectionData &SD) {
|
MCSectionData &SD) {
|
||||||
MCFragment *FirstInvalidFragment = NULL;
|
MCFragment *FirstInvalidFragment = NULL;
|
||||||
// Scan for fragments that need relaxation.
|
// Scan for fragments that need relaxation.
|
||||||
@ -776,19 +776,19 @@ bool MCAssembler::LayoutSectionOnce(MCAsmLayout &Layout,
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_Inst:
|
case MCFragment::FT_Inst:
|
||||||
relaxedFrag = RelaxInstruction(Layout, *cast<MCInstFragment>(it2));
|
relaxedFrag = relaxInstruction(Layout, *cast<MCInstFragment>(it2));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_Dwarf:
|
case MCFragment::FT_Dwarf:
|
||||||
relaxedFrag = RelaxDwarfLineAddr(Layout,
|
relaxedFrag = relaxDwarfLineAddr(Layout,
|
||||||
*cast<MCDwarfLineAddrFragment>(it2));
|
*cast<MCDwarfLineAddrFragment>(it2));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_DwarfFrame:
|
case MCFragment::FT_DwarfFrame:
|
||||||
relaxedFrag =
|
relaxedFrag =
|
||||||
RelaxDwarfCallFrameFragment(Layout,
|
relaxDwarfCallFrameFragment(Layout,
|
||||||
*cast<MCDwarfCallFrameFragment>(it2));
|
*cast<MCDwarfCallFrameFragment>(it2));
|
||||||
break;
|
break;
|
||||||
case MCFragment::FT_LEB:
|
case MCFragment::FT_LEB:
|
||||||
relaxedFrag = RelaxLEB(Layout, *cast<MCLEBFragment>(it2));
|
relaxedFrag = relaxLEB(Layout, *cast<MCLEBFragment>(it2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Update the layout, and remember that we relaxed.
|
// Update the layout, and remember that we relaxed.
|
||||||
@ -802,20 +802,20 @@ bool MCAssembler::LayoutSectionOnce(MCAsmLayout &Layout,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCAssembler::LayoutOnce(MCAsmLayout &Layout) {
|
bool MCAssembler::layoutOnce(MCAsmLayout &Layout) {
|
||||||
++stats::RelaxationSteps;
|
++stats::RelaxationSteps;
|
||||||
|
|
||||||
bool WasRelaxed = false;
|
bool WasRelaxed = false;
|
||||||
for (iterator it = begin(), ie = end(); it != ie; ++it) {
|
for (iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||||
MCSectionData &SD = *it;
|
MCSectionData &SD = *it;
|
||||||
while(LayoutSectionOnce(Layout, SD))
|
while(layoutSectionOnce(Layout, SD))
|
||||||
WasRelaxed = true;
|
WasRelaxed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WasRelaxed;
|
return WasRelaxed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAssembler::FinishLayout(MCAsmLayout &Layout) {
|
void MCAssembler::finishLayout(MCAsmLayout &Layout) {
|
||||||
// The layout is done. Mark every fragment as valid.
|
// The layout is done. Mark every fragment as valid.
|
||||||
for (unsigned int i = 0, n = Layout.getSectionOrder().size(); i != n; ++i) {
|
for (unsigned int i = 0, n = Layout.getSectionOrder().size(); i != n; ++i) {
|
||||||
Layout.getFragmentOffset(&*Layout.getSectionOrder()[i]->rbegin());
|
Layout.getFragmentOffset(&*Layout.getSectionOrder()[i]->rbegin());
|
||||||
|
@ -731,7 +731,7 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
|
|||||||
// Write the actual section data.
|
// Write the actual section data.
|
||||||
for (MCAssembler::const_iterator it = Asm.begin(),
|
for (MCAssembler::const_iterator it = Asm.begin(),
|
||||||
ie = Asm.end(); it != ie; ++it) {
|
ie = Asm.end(); it != ie; ++it) {
|
||||||
Asm.WriteSectionData(it, Layout);
|
Asm.writeSectionData(it, Layout);
|
||||||
|
|
||||||
uint64_t Pad = getPaddingSize(it, Layout);
|
uint64_t Pad = getPaddingSize(it, Layout);
|
||||||
for (unsigned int i = 0; i < Pad; ++i)
|
for (unsigned int i = 0; i < Pad; ++i)
|
||||||
|
@ -850,7 +850,7 @@ void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,
|
|||||||
assert(OS.tell() == (*i)->Header.PointerToRawData &&
|
assert(OS.tell() == (*i)->Header.PointerToRawData &&
|
||||||
"Section::PointerToRawData is insane!");
|
"Section::PointerToRawData is insane!");
|
||||||
|
|
||||||
Asm.WriteSectionData(j, Layout);
|
Asm.writeSectionData(j, Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*i)->Relocations.size() > 0) {
|
if ((*i)->Relocations.size() > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user