@@ -120,9 +120,8 @@ struct ELFWriter {
120
120
DwoOnly,
121
121
} Mode;
122
122
123
- static uint64_t symbolValue (const MCAssembler &Asm, const MCSymbol &Sym);
124
- static bool isInSymtab (const MCAssembler &Asm, const MCSymbolELF &Symbol,
125
- bool Used, bool Renamed);
123
+ uint64_t symbolValue (const MCSymbol &Sym);
124
+ bool isInSymtab (const MCSymbolELF &Symbol, bool Used, bool Renamed);
126
125
127
126
// / Helper struct for containing some precomputed information on symbols.
128
127
struct ELFSymbolData {
@@ -181,7 +180,7 @@ struct ELFWriter {
181
180
W.write (Val);
182
181
}
183
182
184
- void writeHeader (const MCAssembler &Asm );
183
+ void writeHeader ();
185
184
186
185
void writeSymbol (SymbolTableWriter &Writer, uint32_t StringIndex,
187
186
ELFSymbolData &MSD);
@@ -193,16 +192,16 @@ struct ELFWriter {
193
192
// /
194
193
// / \param Asm - The assembler.
195
194
// / \param RevGroupMap - Maps a signature symbol to the group section.
196
- void computeSymbolTable (MCAssembler &Asm, const RevGroupMapTy &RevGroupMap);
195
+ void computeSymbolTable (const RevGroupMapTy &RevGroupMap);
197
196
198
197
void writeAddrsigSection ();
199
198
200
199
MCSectionELF *createRelocationSection (MCContext &Ctx,
201
200
const MCSectionELF &Sec);
202
201
203
- void writeSectionHeaders (const MCAssembler &Asm );
202
+ void writeSectionHeaders ();
204
203
205
- void writeSectionData (const MCAssembler &Asm, MCSection &Sec);
204
+ void writeSectionData (MCSection &Sec);
206
205
207
206
void writeSectionHeaderEntry (uint32_t Name, uint32_t Type, uint64_t Flags,
208
207
uint64_t Address, uint64_t Offset, uint64_t Size ,
@@ -285,7 +284,7 @@ bool ELFWriter::is64Bit() const {
285
284
}
286
285
287
286
// Emit the ELF header.
288
- void ELFWriter::writeHeader (const MCAssembler &Asm ) {
287
+ void ELFWriter::writeHeader () {
289
288
// ELF Header
290
289
// ----------
291
290
//
@@ -346,7 +345,7 @@ void ELFWriter::writeHeader(const MCAssembler &Asm) {
346
345
W.write <uint16_t >(StringTableIndex);
347
346
}
348
347
349
- uint64_t ELFWriter::symbolValue (const MCAssembler &Asm, const MCSymbol &Sym) {
348
+ uint64_t ELFWriter::symbolValue (const MCSymbol &Sym) {
350
349
if (Sym.isCommon ())
351
350
return Sym.getCommonAlignment ()->value ();
352
351
@@ -433,7 +432,7 @@ void ELFWriter::writeSymbol(SymbolTableWriter &Writer, uint32_t StringIndex,
433
432
uint8_t Visibility = Symbol.getVisibility ();
434
433
uint8_t Other = Symbol.getOther () | Visibility;
435
434
436
- uint64_t Value = symbolValue (Asm, *MSD.Symbol );
435
+ uint64_t Value = symbolValue (*MSD.Symbol );
437
436
uint64_t Size = 0 ;
438
437
439
438
const MCExpr *ESize = MSD.Symbol ->getSize ();
@@ -470,8 +469,7 @@ void ELFWriter::writeSymbol(SymbolTableWriter &Writer, uint32_t StringIndex,
470
469
IsReserved);
471
470
}
472
471
473
- bool ELFWriter::isInSymtab (const MCAssembler &Asm, const MCSymbolELF &Symbol,
474
- bool Used, bool Renamed) {
472
+ bool ELFWriter::isInSymtab (const MCSymbolELF &Symbol, bool Used, bool Renamed) {
475
473
if (Symbol.isVariable ()) {
476
474
const MCExpr *Expr = Symbol.getVariableValue ();
477
475
// Target Expressions that are always inlined do not appear in the symtab
@@ -505,8 +503,7 @@ bool ELFWriter::isInSymtab(const MCAssembler &Asm, const MCSymbolELF &Symbol,
505
503
return true ;
506
504
}
507
505
508
- void ELFWriter::computeSymbolTable (MCAssembler &Asm,
509
- const RevGroupMapTy &RevGroupMap) {
506
+ void ELFWriter::computeSymbolTable (const RevGroupMapTy &RevGroupMap) {
510
507
MCContext &Ctx = Asm.getContext ();
511
508
SymbolTableWriter Writer (*this , is64Bit ());
512
509
@@ -537,7 +534,7 @@ void ELFWriter::computeSymbolTable(MCAssembler &Asm,
537
534
bool WeakrefUsed = Symbol.isWeakrefUsedInReloc ();
538
535
bool isSignature = Symbol.isSignature ();
539
536
540
- if (!isInSymtab (Asm, Symbol, Used || WeakrefUsed || isSignature,
537
+ if (!isInSymtab (Symbol, Used || WeakrefUsed || isSignature,
541
538
OWriter.Renames .count (&Symbol)))
542
539
continue ;
543
540
@@ -747,7 +744,7 @@ bool ELFWriter::maybeWriteCompression(
747
744
return true ;
748
745
}
749
746
750
- void ELFWriter::writeSectionData (const MCAssembler &Asm, MCSection &Sec) {
747
+ void ELFWriter::writeSectionData (MCSection &Sec) {
751
748
MCSectionELF &Section = static_cast <MCSectionELF &>(Sec);
752
749
StringRef SectionName = Section.getName ();
753
750
auto &Ctx = Asm.getContext ();
@@ -828,7 +825,7 @@ void ELFWriter::writeRelocations(const MCSectionELF &Sec) {
828
825
const bool Rela = OWriter.usesRela (TO, Sec);
829
826
830
827
// Sort the relocation entries. MIPS needs this.
831
- OWriter.TargetObjectWriter ->sortRelocs (Asm, Relocs);
828
+ OWriter.TargetObjectWriter ->sortRelocs (Relocs);
832
829
833
830
if (OWriter.TargetObjectWriter ->getEMachine () == ELF::EM_MIPS) {
834
831
for (const ELFRelocationEntry &Entry : Relocs) {
@@ -946,7 +943,7 @@ void ELFWriter::writeSectionHeader(uint32_t GroupSymbolIndex, uint64_t Offset,
946
943
Section.getEntrySize ());
947
944
}
948
945
949
- void ELFWriter::writeSectionHeaders (const MCAssembler &Asm ) {
946
+ void ELFWriter::writeSectionHeaders () {
950
947
uint64_t Start = W.OS .tell ();
951
948
const unsigned NumSections = SectionTable.size ();
952
949
@@ -1028,7 +1025,7 @@ uint64_t ELFWriter::writeObject() {
1028
1025
RevGroupMapTy RevGroupMap;
1029
1026
1030
1027
// Write out the ELF header ...
1031
- writeHeader (Asm );
1028
+ writeHeader ();
1032
1029
1033
1030
stats::ELFHeaderBytes += W.OS .tell () - StartOffset;
1034
1031
@@ -1048,7 +1045,7 @@ uint64_t ELFWriter::writeObject() {
1048
1045
const uint64_t SecStart = align (Section.getAlign ());
1049
1046
1050
1047
const MCSymbolELF *SignatureSymbol = Section.getGroup ();
1051
- writeSectionData (Asm, Section);
1048
+ writeSectionData (Section);
1052
1049
1053
1050
uint64_t SecEnd = W.OS .tell ();
1054
1051
Section.setOffsets (SecStart, SecEnd);
@@ -1108,7 +1105,7 @@ uint64_t ELFWriter::writeObject() {
1108
1105
}
1109
1106
1110
1107
// Compute symbol table information.
1111
- computeSymbolTable (Asm, RevGroupMap);
1108
+ computeSymbolTable (RevGroupMap);
1112
1109
1113
1110
for (MCSectionELF *RelSection : Relocations) {
1114
1111
// Remember the offset into the file for this section.
@@ -1137,7 +1134,7 @@ uint64_t ELFWriter::writeObject() {
1137
1134
const uint64_t SectionHeaderOffset = align (is64Bit () ? Align (8 ) : Align (4 ));
1138
1135
1139
1136
// ... then the section header table ...
1140
- writeSectionHeaders (Asm );
1137
+ writeSectionHeaders ();
1141
1138
1142
1139
uint16_t NumSections = support::endian::byte_swap<uint16_t >(
1143
1140
(SectionTable.size () + 1 >= ELF::SHN_LORESERVE) ? (uint16_t )ELF::SHN_UNDEF
0 commit comments