/// \brief Set the data size of the given section.
void setSectionFileSize(MCSectionData *SD, uint64_t Value);
- /// \brief Get the actual data size of the given section.
+ /// \brief Get the address space size of the given section, as it effects
+ /// layout. This may differ from the size reported by \see getSectionSize() by
+ /// not including section tail padding.
+ uint64_t getSectionAddressSize(const MCSectionData *SD) const;
+
+ /// \brief Set the address space size of the given section.
+ void setSectionAddressSize(MCSectionData *SD, uint64_t Value);
+
+ /// \brief Get the logical data size of the given section.
uint64_t getSectionSize(const MCSectionData *SD) const;
- /// \brief Set the actual data size of the given section.
+ /// \brief Set the logical data size of the given section.
void setSectionSize(MCSectionData *SD, uint64_t Value);
/// @}
SD->FileSize = Value;
}
+uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
+ assert(SD->AddressSize != ~UINT64_C(0) && "Address size not set!");
+ return SD->AddressSize;
+}
+void MCAsmLayout::setSectionAddressSize(MCSectionData *SD, uint64_t Value) {
+ SD->AddressSize = Value;
+}
+
/* *** */
MCFragment::MCFragment() : Kind(FragmentType(~0)) {
Alignment(1),
Address(~UINT64_C(0)),
Size(~UINT64_C(0)),
+ AddressSize(~UINT64_C(0)),
FileSize(~UINT64_C(0)),
HasInstructions(false)
{
uint64_t StartAddress = 0;
if (SectionOrderIndex) {
MCSectionData *Prev = Layout.getSectionOrder()[SectionOrderIndex - 1];
- StartAddress = Layout.getSectionAddress(Prev) + Layout.getSectionSize(Prev);
+ StartAddress = (Layout.getSectionAddress(Prev) +
+ Layout.getSectionAddressSize(Prev));
}
// Align this section if necessary by adding padding bytes to the previous
Size = Layout.getFragmentOffset(F) + Layout.getFragmentEffectiveSize(F);
}
Layout.setSectionSize(&SD, Size);
+ Layout.setSectionAddressSize(&SD, Size);
Layout.setSectionFileSize(&SD, IsVirtual ? 0 : Size);
}
raw_ostream &OS = llvm::errs();
OS << "<MCFragment " << (void*) this << " Offset:" << Offset
- << " EffectiveSize:" << EffectiveSize;
-
- OS << ">";
+ << " EffectiveSize:" << EffectiveSize << ">";
}
void MCAlignFragment::dump() {
OS << "<MCSectionData";
OS << " Alignment:" << getAlignment() << " Address:" << Address
- << " Size:" << Size << " FileSize:" << FileSize
- << " Fragments:[\n ";
+ << " Size:" << Size << " AddressSize:" << AddressSize
+ << " FileSize:" << FileSize << " Fragments:[\n ";
for (iterator it = begin(), ie = end(); it != ie; ++it) {
if (it != begin()) OS << ",\n ";
it->dump();