12
12
13
13
#include " llvm/BinaryFormat/XCOFF.h"
14
14
#include " llvm/MC/MCAsmBackend.h"
15
- #include " llvm/MC/MCAsmLayout.h"
16
15
#include " llvm/MC/MCAssembler.h"
17
16
#include " llvm/MC/MCFixup.h"
18
17
#include " llvm/MC/MCFixupKindInfo.h"
@@ -379,18 +378,16 @@ class XCOFFObjectWriter : public MCObjectWriter {
379
378
void writeSectionHeaderTable ();
380
379
void writeSections (const MCAssembler &Asm);
381
380
void writeSectionForControlSectionEntry (const MCAssembler &Asm,
382
- const MCAsmLayout &Layout,
383
381
const CsectSectionEntry &CsectEntry,
384
382
uint64_t &CurrentAddressLocation);
385
383
void writeSectionForDwarfSectionEntry (const MCAssembler &Asm,
386
- const MCAsmLayout &Layout,
387
384
const DwarfSectionEntry &DwarfEntry,
388
385
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);
392
390
void writeSectionForCInfoSymSectionEntry (const MCAssembler &Asm,
393
- const MCAsmLayout &Layout,
394
391
CInfoSymSectionEntry &CInfoSymEntry,
395
392
uint64_t &CurrentAddressLocation);
396
393
void writeSymbolTable (MCAssembler &Asm);
@@ -419,7 +416,7 @@ class XCOFFObjectWriter : public MCObjectWriter {
419
416
// *) Assigns symbol table indices.
420
417
// *) Builds up the section header table by adding any non-empty sections to
421
418
// `Sections`.
422
- void assignAddressesAndIndices (MCAssembler &Asm, const MCAsmLayout & );
419
+ void assignAddressesAndIndices (MCAssembler &Asm);
423
420
// Called after relocations are recorded.
424
421
void finalizeSectionInfo ();
425
422
void finalizeRelocationInfo (SectionEntry *Sec, uint64_t RelCount);
@@ -655,7 +652,7 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm) {
655
652
Strings.add (Vers);
656
653
657
654
Strings.finalize ();
658
- assignAddressesAndIndices (Asm, *Asm. getLayout () );
655
+ assignAddressesAndIndices (Asm);
659
656
}
660
657
661
658
void XCOFFObjectWriter::recordRelocation (MCAssembler &Asm,
@@ -813,17 +810,14 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
813
810
}
814
811
815
812
void XCOFFObjectWriter::writeSections (const MCAssembler &Asm) {
816
- auto &Layout = *Asm.getLayout ();
817
813
uint64_t CurrentAddressLocation = 0 ;
818
814
for (const auto *Section : Sections)
819
- writeSectionForControlSectionEntry (Asm, Layout, *Section,
820
- CurrentAddressLocation);
815
+ writeSectionForControlSectionEntry (Asm, *Section, CurrentAddressLocation);
821
816
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,
825
819
CurrentAddressLocation);
826
- writeSectionForCInfoSymSectionEntry (Asm, Layout, CInfoSymSection,
820
+ writeSectionForCInfoSymSectionEntry (Asm, CInfoSymSection,
827
821
CurrentAddressLocation);
828
822
}
829
823
@@ -1419,8 +1413,7 @@ void XCOFFObjectWriter::addCInfoSymEntry(StringRef Name, StringRef Metadata) {
1419
1413
std::make_unique<CInfoSymInfo>(Name.str (), Metadata.str ()));
1420
1414
}
1421
1415
1422
- void XCOFFObjectWriter::assignAddressesAndIndices (MCAssembler &Asm,
1423
- const MCAsmLayout &Layout) {
1416
+ void XCOFFObjectWriter::assignAddressesAndIndices (MCAssembler &Asm) {
1424
1417
// The symbol table starts with all the C_FILE symbols. Each C_FILE symbol
1425
1418
// requires 1 or 2 auxiliary entries.
1426
1419
uint32_t SymbolTableIndex =
@@ -1597,8 +1590,8 @@ void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
1597
1590
}
1598
1591
1599
1592
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) {
1602
1595
// Nothing to write for this Section.
1603
1596
if (CsectEntry.Index == SectionEntry::UninitializedIndex)
1604
1597
return ;
@@ -1644,8 +1637,8 @@ void XCOFFObjectWriter::writeSectionForControlSectionEntry(
1644
1637
}
1645
1638
1646
1639
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) {
1649
1642
// There could be a gap (without corresponding zero padding) between
1650
1643
// sections. For example DWARF section alignment is bigger than
1651
1644
// DefaultSectionAlign.
@@ -1672,8 +1665,8 @@ void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
1672
1665
}
1673
1666
1674
1667
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) {
1677
1670
for (auto it = ExceptionEntry.ExceptionTable .begin ();
1678
1671
it != ExceptionEntry.ExceptionTable .end (); it++) {
1679
1672
// For every symbol that has exception entries, you must start the entries
@@ -1695,8 +1688,8 @@ void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
1695
1688
}
1696
1689
1697
1690
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) {
1700
1693
if (!CInfoSymSection.Entry )
1701
1694
return ;
1702
1695
0 commit comments