mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
MC: Move ordinal calculation, to make sure fragments synthesized for layout get assigned ordinals properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103711 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -598,27 +598,6 @@ void MCAssembler::Finish() {
|
|||||||
llvm::errs() << "assembler backend - pre-layout\n--\n";
|
llvm::errs() << "assembler backend - pre-layout\n--\n";
|
||||||
dump(); });
|
dump(); });
|
||||||
|
|
||||||
// Assign section and fragment ordinals, all subsequent backend code is
|
|
||||||
// responsible for updating these in place.
|
|
||||||
unsigned SectionIndex = 0;
|
|
||||||
unsigned FragmentIndex = 0;
|
|
||||||
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
|
|
||||||
// Create dummy fragments to eliminate any empty sections, this simplifies
|
|
||||||
// layout.
|
|
||||||
if (it->getFragmentList().empty()) {
|
|
||||||
unsigned ValueSize = 1;
|
|
||||||
if (getBackend().isVirtualSection(it->getSection()))
|
|
||||||
ValueSize = 1;
|
|
||||||
new MCFillFragment(0, 1, 0, it);
|
|
||||||
}
|
|
||||||
|
|
||||||
it->setOrdinal(SectionIndex++);
|
|
||||||
|
|
||||||
for (MCSectionData::iterator it2 = it->begin(),
|
|
||||||
ie2 = it->end(); it2 != ie2; ++it2)
|
|
||||||
it2->setOrdinal(FragmentIndex++);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the layout object.
|
// Create the layout object.
|
||||||
MCAsmLayout Layout(*this);
|
MCAsmLayout Layout(*this);
|
||||||
|
|
||||||
@@ -646,6 +625,27 @@ void MCAssembler::Finish() {
|
|||||||
AF->setOnlyAlignAddress(true);
|
AF->setOnlyAlignAddress(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assign section and fragment ordinals, all subsequent backend code is
|
||||||
|
// responsible for updating these in place.
|
||||||
|
unsigned SectionIndex = 0;
|
||||||
|
unsigned FragmentIndex = 0;
|
||||||
|
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
|
||||||
|
// Create dummy fragments to eliminate any empty sections, this simplifies
|
||||||
|
// layout.
|
||||||
|
if (it->getFragmentList().empty()) {
|
||||||
|
unsigned ValueSize = 1;
|
||||||
|
if (getBackend().isVirtualSection(it->getSection()))
|
||||||
|
ValueSize = 1;
|
||||||
|
new MCFillFragment(0, 1, 0, it);
|
||||||
|
}
|
||||||
|
|
||||||
|
it->setOrdinal(SectionIndex++);
|
||||||
|
|
||||||
|
for (MCSectionData::iterator it2 = it->begin(),
|
||||||
|
ie2 = it->end(); it2 != ie2; ++it2)
|
||||||
|
it2->setOrdinal(FragmentIndex++);
|
||||||
|
}
|
||||||
|
|
||||||
// Layout until everything fits.
|
// Layout until everything fits.
|
||||||
while (LayoutOnce(Layout))
|
while (LayoutOnce(Layout))
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user