[llvm-commits] [llvm] r103710 - /llvm/trunk/lib/MC/MCAssembler.cpp
Daniel Dunbar
daniel at zuster.org
Thu May 13 01:43:34 PDT 2010
Author: ddunbar
Date: Thu May 13 03:43:34 2010
New Revision: 103710
URL: http://llvm.org/viewvc/llvm-project?rev=103710&view=rev
Log:
MC: Create dummy fragments to avoid ever having empty sections, which simplifies layout.
Modified:
llvm/trunk/lib/MC/MCAssembler.cpp
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=103710&r1=103709&r2=103710&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Thu May 13 03:43:34 2010
@@ -116,10 +116,6 @@
}
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.
const MCFragment &F = SD->getFragmentList().back();
return getFragmentOffset(&F) + getFragmentEffectiveSize(&F);
@@ -135,10 +131,6 @@
}
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.
uint64_t Size = getSectionAddressSize(SD);
const MCAlignFragment *AF =
@@ -611,6 +603,15 @@
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(),
More information about the llvm-commits
mailing list