mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
MC: Create dummy fragments to avoid ever having empty sections, which simplifies layout.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103710 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -116,10 +116,6 @@ void MCAsmLayout::setSectionAddress(MCSectionData *SD, uint64_t Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
|
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
|
||||||
// Empty sections have no size.
|
|
||||||
if (SD->getFragmentList().empty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Otherwise, the size is the last fragment's end offset.
|
// Otherwise, the size is the last fragment's end offset.
|
||||||
const MCFragment &F = SD->getFragmentList().back();
|
const MCFragment &F = SD->getFragmentList().back();
|
||||||
return getFragmentOffset(&F) + getFragmentEffectiveSize(&F);
|
return getFragmentOffset(&F) + getFragmentEffectiveSize(&F);
|
||||||
@ -135,10 +131,6 @@ uint64_t MCAsmLayout::getSectionFileSize(const MCSectionData *SD) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t MCAsmLayout::getSectionSize(const MCSectionData *SD) const {
|
uint64_t MCAsmLayout::getSectionSize(const MCSectionData *SD) const {
|
||||||
// Empty sections have no size.
|
|
||||||
if (SD->getFragmentList().empty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// The logical size is the address space size minus any tail padding.
|
// The logical size is the address space size minus any tail padding.
|
||||||
uint64_t Size = getSectionAddressSize(SD);
|
uint64_t Size = getSectionAddressSize(SD);
|
||||||
const MCAlignFragment *AF =
|
const MCAlignFragment *AF =
|
||||||
@ -611,6 +603,15 @@ void MCAssembler::Finish() {
|
|||||||
unsigned SectionIndex = 0;
|
unsigned SectionIndex = 0;
|
||||||
unsigned FragmentIndex = 0;
|
unsigned FragmentIndex = 0;
|
||||||
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {
|
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++);
|
it->setOrdinal(SectionIndex++);
|
||||||
|
|
||||||
for (MCSectionData::iterator it2 = it->begin(),
|
for (MCSectionData::iterator it2 = it->begin(),
|
||||||
|
Reference in New Issue
Block a user