Skip to content

Commit a7ddd60

Browse files
committed
XCOFFObjectWriter: replace the MCAsmLayout parameter with MCAssembler
1 parent 5571687 commit a7ddd60

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

llvm/lib/MC/XCOFFObjectWriter.cpp

+19-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
#include "llvm/BinaryFormat/XCOFF.h"
1414
#include "llvm/MC/MCAsmBackend.h"
15-
#include "llvm/MC/MCAsmLayout.h"
1615
#include "llvm/MC/MCAssembler.h"
1716
#include "llvm/MC/MCFixup.h"
1817
#include "llvm/MC/MCFixupKindInfo.h"
@@ -379,18 +378,16 @@ class XCOFFObjectWriter : public MCObjectWriter {
379378
void writeSectionHeaderTable();
380379
void writeSections(const MCAssembler &Asm);
381380
void writeSectionForControlSectionEntry(const MCAssembler &Asm,
382-
const MCAsmLayout &Layout,
383381
const CsectSectionEntry &CsectEntry,
384382
uint64_t &CurrentAddressLocation);
385383
void writeSectionForDwarfSectionEntry(const MCAssembler &Asm,
386-
const MCAsmLayout &Layout,
387384
const DwarfSectionEntry &DwarfEntry,
388385
uint64_t &CurrentAddressLocation);
389-
void writeSectionForExceptionSectionEntry(
390-
const MCAssembler &Asm, const MCAsmLayout &Layout,
391-
ExceptionSectionEntry &ExceptionEntry, uint64_t &CurrentAddressLocation);
386+
void
387+
writeSectionForExceptionSectionEntry(const MCAssembler &Asm,
388+
ExceptionSectionEntry &ExceptionEntry,
389+
uint64_t &CurrentAddressLocation);
392390
void writeSectionForCInfoSymSectionEntry(const MCAssembler &Asm,
393-
const MCAsmLayout &Layout,
394391
CInfoSymSectionEntry &CInfoSymEntry,
395392
uint64_t &CurrentAddressLocation);
396393
void writeSymbolTable(MCAssembler &Asm);
@@ -419,7 +416,7 @@ class XCOFFObjectWriter : public MCObjectWriter {
419416
// *) Assigns symbol table indices.
420417
// *) Builds up the section header table by adding any non-empty sections to
421418
// `Sections`.
422-
void assignAddressesAndIndices(MCAssembler &Asm, const MCAsmLayout &);
419+
void assignAddressesAndIndices(MCAssembler &Asm);
423420
// Called after relocations are recorded.
424421
void finalizeSectionInfo();
425422
void finalizeRelocationInfo(SectionEntry *Sec, uint64_t RelCount);
@@ -655,7 +652,7 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm) {
655652
Strings.add(Vers);
656653

657654
Strings.finalize();
658-
assignAddressesAndIndices(Asm, *Asm.getLayout());
655+
assignAddressesAndIndices(Asm);
659656
}
660657

661658
void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
@@ -813,17 +810,14 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
813810
}
814811

815812
void XCOFFObjectWriter::writeSections(const MCAssembler &Asm) {
816-
auto &Layout = *Asm.getLayout();
817813
uint64_t CurrentAddressLocation = 0;
818814
for (const auto *Section : Sections)
819-
writeSectionForControlSectionEntry(Asm, Layout, *Section,
820-
CurrentAddressLocation);
815+
writeSectionForControlSectionEntry(Asm, *Section, CurrentAddressLocation);
821816
for (const auto &DwarfSection : DwarfSections)
822-
writeSectionForDwarfSectionEntry(Asm, Layout, DwarfSection,
823-
CurrentAddressLocation);
824-
writeSectionForExceptionSectionEntry(Asm, Layout, ExceptionSection,
817+
writeSectionForDwarfSectionEntry(Asm, DwarfSection, CurrentAddressLocation);
818+
writeSectionForExceptionSectionEntry(Asm, ExceptionSection,
825819
CurrentAddressLocation);
826-
writeSectionForCInfoSymSectionEntry(Asm, Layout, CInfoSymSection,
820+
writeSectionForCInfoSymSectionEntry(Asm, CInfoSymSection,
827821
CurrentAddressLocation);
828822
}
829823

@@ -1419,8 +1413,7 @@ void XCOFFObjectWriter::addCInfoSymEntry(StringRef Name, StringRef Metadata) {
14191413
std::make_unique<CInfoSymInfo>(Name.str(), Metadata.str()));
14201414
}
14211415

1422-
void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
1423-
const MCAsmLayout &Layout) {
1416+
void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm) {
14241417
// The symbol table starts with all the C_FILE symbols. Each C_FILE symbol
14251418
// requires 1 or 2 auxiliary entries.
14261419
uint32_t SymbolTableIndex =
@@ -1597,8 +1590,8 @@ void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
15971590
}
15981591

15991592
void XCOFFObjectWriter::writeSectionForControlSectionEntry(
1600-
const MCAssembler &Asm, const MCAsmLayout &Layout,
1601-
const CsectSectionEntry &CsectEntry, uint64_t &CurrentAddressLocation) {
1593+
const MCAssembler &Asm, const CsectSectionEntry &CsectEntry,
1594+
uint64_t &CurrentAddressLocation) {
16021595
// Nothing to write for this Section.
16031596
if (CsectEntry.Index == SectionEntry::UninitializedIndex)
16041597
return;
@@ -1644,8 +1637,8 @@ void XCOFFObjectWriter::writeSectionForControlSectionEntry(
16441637
}
16451638

16461639
void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
1647-
const MCAssembler &Asm, const MCAsmLayout &Layout,
1648-
const DwarfSectionEntry &DwarfEntry, uint64_t &CurrentAddressLocation) {
1640+
const MCAssembler &Asm, const DwarfSectionEntry &DwarfEntry,
1641+
uint64_t &CurrentAddressLocation) {
16491642
// There could be a gap (without corresponding zero padding) between
16501643
// sections. For example DWARF section alignment is bigger than
16511644
// DefaultSectionAlign.
@@ -1672,8 +1665,8 @@ void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
16721665
}
16731666

16741667
void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
1675-
const MCAssembler &Asm, const MCAsmLayout &Layout,
1676-
ExceptionSectionEntry &ExceptionEntry, uint64_t &CurrentAddressLocation) {
1668+
const MCAssembler &Asm, ExceptionSectionEntry &ExceptionEntry,
1669+
uint64_t &CurrentAddressLocation) {
16771670
for (auto it = ExceptionEntry.ExceptionTable.begin();
16781671
it != ExceptionEntry.ExceptionTable.end(); it++) {
16791672
// For every symbol that has exception entries, you must start the entries
@@ -1695,8 +1688,8 @@ void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
16951688
}
16961689

16971690
void XCOFFObjectWriter::writeSectionForCInfoSymSectionEntry(
1698-
const MCAssembler &Asm, const MCAsmLayout &Layout,
1699-
CInfoSymSectionEntry &CInfoSymEntry, uint64_t &CurrentAddressLocation) {
1691+
const MCAssembler &Asm, CInfoSymSectionEntry &CInfoSymEntry,
1692+
uint64_t &CurrentAddressLocation) {
17001693
if (!CInfoSymSection.Entry)
17011694
return;
17021695

0 commit comments

Comments
 (0)