Skip to content

Commit 1db504c

Browse files
Move IndirectSymbols to MCObjectWriter
1 parent 1eb1101 commit 1db504c

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

llvm/include/llvm/MC/MCMachObjectWriter.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@ class MachObjectWriter : public MCObjectWriter {
112112
bool operator<(const MachSymbolData &RHS) const;
113113
};
114114

115-
struct IndirectSymbolData {
116-
MCSymbol *Symbol;
117-
MCSection *Section;
118-
};
119-
120115
/// The target specific Mach-O writer instance.
121116
std::unique_ptr<MCMachObjectTargetWriter> TargetObjectWriter;
122117

@@ -137,7 +132,6 @@ class MachObjectWriter : public MCObjectWriter {
137132

138133
private:
139134
DenseMap<const MCSection *, std::vector<RelAndSymbol>> Relocations;
140-
std::vector<IndirectSymbolData> IndirectSymbols;
141135
DenseMap<const MCSection *, unsigned> IndirectSymBase;
142136

143137
SectionAddrMap SectionAddress;
@@ -200,9 +194,6 @@ class MachObjectWriter : public MCObjectWriter {
200194

201195
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind);
202196

203-
std::vector<IndirectSymbolData> &getIndirectSymbols() {
204-
return IndirectSymbols;
205-
}
206197
const llvm::SmallVectorImpl<MCSection *> &getSectionOrder() const {
207198
return SectionOrder;
208199
}

llvm/include/llvm/MC/MCObjectWriter.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ class MCObjectWriter {
4141
};
4242

4343
protected:
44+
struct IndirectSymbolData {
45+
MCSymbol *Symbol;
46+
MCSection *Section;
47+
};
48+
49+
std::vector<IndirectSymbolData> IndirectSymbols;
50+
4451
std::vector<DataRegionData> DataRegions;
4552

4653
// The list of linker options for LC_LINKER_OPTION.
@@ -81,6 +88,10 @@ class MCObjectWriter {
8188
return LinkerOptions;
8289
}
8390

91+
std::vector<IndirectSymbolData> &getIndirectSymbols() {
92+
return IndirectSymbols;
93+
}
94+
8495
MCLOHContainer &getLOHContainer() { return LOHContainer; }
8596

8697
std::vector<DataRegionData> &getDataRegions() { return DataRegions; }

llvm/lib/MC/MCMachOStreamer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ bool MCMachOStreamer::emitSymbolAttribute(MCSymbol *Sym,
297297
if (Attribute == MCSA_IndirectSymbol) {
298298
// Note that we intentionally cannot use the symbol data here; this is
299299
// important for matching the string table that 'as' generates.
300-
getWriter().getIndirectSymbols().push_back(
300+
getMCObjectWriter().getIndirectSymbols().push_back(
301301
{Symbol, getCurrentSectionOnly()});
302302
return true;
303303
}

llvm/lib/MC/MCObjectWriter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void MCObjectWriter::reset() {
2828
LinkerOptions.clear();
2929
LOHContainer.reset();
3030
DataRegions.clear();
31+
IndirectSymbols.clear();
3132
}
3233

3334
bool MCObjectWriter::isSymbolRefDifferenceFullyResolved(

0 commit comments

Comments
 (0)