@@ -169,15 +169,10 @@ struct ELFWriter {
169
169
void writeSymbol (const MCAssembler &Asm, SymbolTableWriter &Writer,
170
170
uint32_t StringIndex, ELFSymbolData &MSD);
171
171
172
- // Map from a signature symbol to the group section index
173
- using RevGroupMapTy = DenseMap<const MCSymbol *, unsigned >;
174
-
175
172
// / Compute the symbol table data
176
173
// /
177
174
// / \param Asm - The assembler.
178
- // / \param RevGroupMap - Maps a signature symbol to the group section.
179
- void computeSymbolTable (MCAssembler &Asm,
180
- const RevGroupMapTy &RevGroupMap);
175
+ void computeSymbolTable (MCAssembler &Asm);
181
176
182
177
void writeAddrsigSection ();
183
178
@@ -599,8 +594,7 @@ bool ELFWriter::isInSymtab(const MCAssembler &Asm, const MCSymbolELF &Symbol,
599
594
return true ;
600
595
}
601
596
602
- void ELFWriter::computeSymbolTable (MCAssembler &Asm,
603
- const RevGroupMapTy &RevGroupMap) {
597
+ void ELFWriter::computeSymbolTable (MCAssembler &Asm) {
604
598
MCContext &Ctx = Asm.getContext ();
605
599
SymbolTableWriter Writer (*this , is64Bit ());
606
600
@@ -658,7 +652,7 @@ void ELFWriter::computeSymbolTable(MCAssembler &Asm,
658
652
}
659
653
} else if (Symbol.isUndefined ()) {
660
654
if (isSignature && !Used) {
661
- MSD.SectionIndex = RevGroupMap. lookup (&Symbol );
655
+ MSD.SectionIndex = Symbol. getGroupIndex ( );
662
656
if (MSD.SectionIndex >= ELF::SHN_LORESERVE)
663
657
HasLargeSectionIndex = true ;
664
658
} else {
@@ -1104,8 +1098,6 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
1104
1098
Ctx.getELFSection (" .strtab" , ELF::SHT_STRTAB, 0 );
1105
1099
StringTableIndex = addToSectionTable (StrtabSection);
1106
1100
1107
- RevGroupMapTy RevGroupMap;
1108
-
1109
1101
DenseMap<const MCSymbol *, SmallVector<const MCSectionELF *, 0 >> GroupMembers;
1110
1102
1111
1103
// Write out the ELF header ...
@@ -1133,11 +1125,12 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
1133
1125
MCSectionELF *RelSection = createRelocationSection (Ctx, Section);
1134
1126
1135
1127
if (SignatureSymbol) {
1136
- unsigned & GroupIdx = RevGroupMap[ SignatureSymbol] ;
1128
+ unsigned GroupIdx = SignatureSymbol-> getGroupIndex () ;
1137
1129
if (!GroupIdx) {
1138
1130
MCSectionELF *Group =
1139
1131
Ctx.createELFGroupSection (SignatureSymbol, Section.isComdat ());
1140
1132
GroupIdx = addToSectionTable (Group);
1133
+ SignatureSymbol->setGroupIndex (GroupIdx);
1141
1134
Group->setAlignment (Align (4 ));
1142
1135
Groups.push_back (Group);
1143
1136
}
@@ -1184,7 +1177,7 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
1184
1177
}
1185
1178
1186
1179
// Compute symbol table information.
1187
- computeSymbolTable (Asm, RevGroupMap );
1180
+ computeSymbolTable (Asm);
1188
1181
1189
1182
for (MCSectionELF *RelSection : Relocations) {
1190
1183
// Remember the offset into the file for this section.
0 commit comments