mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-05 09:24:28 +00:00
Pass a const MCAssembler to writeSectionHeader.
It never creates sections, so it can use Asm.getSectionData instead of Asm.getOrCreateSectionData. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237943 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -230,7 +230,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
void ExecutePostLayoutBinding(MCAssembler &Asm,
|
void ExecutePostLayoutBinding(MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout) override;
|
const MCAsmLayout &Layout) override;
|
||||||
|
|
||||||
void writeSectionHeader(MCAssembler &Asm, const MCAsmLayout &Layout,
|
void writeSectionHeader(const MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
const SectionIndexMapTy &SectionIndexMap,
|
const SectionIndexMapTy &SectionIndexMap,
|
||||||
const SectionOffsetsTy &SectionOffsets);
|
const SectionOffsetsTy &SectionOffsets);
|
||||||
|
|
||||||
@ -1299,7 +1299,7 @@ void ELFObjectWriter::writeSection(const SectionIndexMapTy &SectionIndexMap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ELFObjectWriter::writeSectionHeader(
|
void ELFObjectWriter::writeSectionHeader(
|
||||||
MCAssembler &Asm, const MCAsmLayout &Layout,
|
const MCAssembler &Asm, const MCAsmLayout &Layout,
|
||||||
const SectionIndexMapTy &SectionIndexMap,
|
const SectionIndexMapTy &SectionIndexMap,
|
||||||
const SectionOffsetsTy &SectionOffsets) {
|
const SectionOffsetsTy &SectionOffsets) {
|
||||||
const unsigned NumSections = SectionTable.size();
|
const unsigned NumSections = SectionTable.size();
|
||||||
@ -1310,7 +1310,6 @@ void ELFObjectWriter::writeSectionHeader(
|
|||||||
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
|
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
|
||||||
|
|
||||||
for (MCSectionELF *Section : SectionTable) {
|
for (MCSectionELF *Section : SectionTable) {
|
||||||
const MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
|
|
||||||
uint32_t GroupSymbolIndex;
|
uint32_t GroupSymbolIndex;
|
||||||
unsigned Type = Section->getType();
|
unsigned Type = Section->getType();
|
||||||
if (Type != ELF::SHT_GROUP)
|
if (Type != ELF::SHT_GROUP)
|
||||||
@ -1320,8 +1319,13 @@ void ELFObjectWriter::writeSectionHeader(
|
|||||||
|
|
||||||
const std::pair<uint64_t, uint64_t> &Offsets =
|
const std::pair<uint64_t, uint64_t> &Offsets =
|
||||||
SectionOffsets.find(Section)->second;
|
SectionOffsets.find(Section)->second;
|
||||||
uint64_t Size = Type == ELF::SHT_NOBITS ? Layout.getSectionAddressSize(&SD)
|
uint64_t Size;
|
||||||
: Offsets.second - Offsets.first;
|
if (Type == ELF::SHT_NOBITS) {
|
||||||
|
const MCSectionData &SD = Asm.getSectionData(*Section);
|
||||||
|
Size = Layout.getSectionAddressSize(&SD);
|
||||||
|
} else {
|
||||||
|
Size = Offsets.second - Offsets.first;
|
||||||
|
}
|
||||||
|
|
||||||
writeSection(SectionIndexMap, GroupSymbolIndex, Offsets.first, Size,
|
writeSection(SectionIndexMap, GroupSymbolIndex, Offsets.first, Size,
|
||||||
*Section);
|
*Section);
|
||||||
|
Reference in New Issue
Block a user