File tree Expand file tree Collapse file tree 5 files changed +19
-17
lines changed Expand file tree Collapse file tree 5 files changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -86,12 +86,6 @@ class MCMachObjectTargetWriter : public MCObjectTargetWriter {
86
86
87
87
class MachObjectWriter : public MCObjectWriter {
88
88
public:
89
- struct DataRegionData {
90
- MachO::DataRegionType Kind;
91
- MCSymbol *Start;
92
- MCSymbol *End;
93
- };
94
-
95
89
// A Major version of 0 indicates that no version information was supplied
96
90
// and so the corresponding load command should not be emitted.
97
91
using VersionInfoType = struct {
@@ -146,8 +140,6 @@ class MachObjectWriter : public MCObjectWriter {
146
140
std::vector<IndirectSymbolData> IndirectSymbols;
147
141
DenseMap<const MCSection *, unsigned > IndirectSymBase;
148
142
149
- std::vector<DataRegionData> DataRegions;
150
-
151
143
SectionAddrMap SectionAddress;
152
144
153
145
// List of sections in layout order. Virtual sections are after non-virtual
@@ -211,7 +203,6 @@ class MachObjectWriter : public MCObjectWriter {
211
203
std::vector<IndirectSymbolData> &getIndirectSymbols () {
212
204
return IndirectSymbols;
213
205
}
214
- std::vector<DataRegionData> &getDataRegions () { return DataRegions; }
215
206
const llvm::SmallVectorImpl<MCSection *> &getSectionOrder () const {
216
207
return SectionOrder;
217
208
}
Original file line number Diff line number Diff line change @@ -33,7 +33,16 @@ class MCValue;
33
33
// / MCAssembler instance, which contains all the symbol and section data which
34
34
// / should be emitted as part of writeObject().
35
35
class MCObjectWriter {
36
+ public:
37
+ struct DataRegionData {
38
+ unsigned Kind;
39
+ MCSymbol *Start;
40
+ MCSymbol *End;
41
+ };
42
+
36
43
protected:
44
+ std::vector<DataRegionData> DataRegions;
45
+
37
46
// The list of linker options for LC_LINKER_OPTION.
38
47
std::vector<std::vector<std::string>> LinkerOptions;
39
48
@@ -74,6 +83,8 @@ class MCObjectWriter {
74
83
75
84
MCLOHContainer &getLOHContainer () { return LOHContainer; }
76
85
86
+ std::vector<DataRegionData> &getDataRegions () { return DataRegions; }
87
+
77
88
// / Perform any late binding of symbols (for example, to assign symbol
78
89
// / indices for use when generating relocations).
79
90
// /
Original file line number Diff line number Diff line change @@ -203,11 +203,11 @@ void MCMachOStreamer::emitDataRegion(MachO::DataRegionType Kind) {
203
203
MCSymbol *Start = getContext ().createTempSymbol ();
204
204
emitLabel (Start);
205
205
// Record the region for the object writer to use.
206
- getWriter ().getDataRegions ().push_back ({Kind, Start, nullptr });
206
+ getMCObjectWriter ().getDataRegions ().push_back ({Kind, Start, nullptr });
207
207
}
208
208
209
209
void MCMachOStreamer::emitDataRegionEnd () {
210
- auto &Regions = getWriter ().getDataRegions ();
210
+ auto &Regions = getMCObjectWriter ().getDataRegions ();
211
211
assert (!Regions.empty () && " Mismatched .end_data_region!" );
212
212
auto &Data = Regions.back ();
213
213
assert (!Data.End && " Mismatched .end_data_region!" );
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ void MCObjectWriter::reset() {
27
27
CGProfile.clear ();
28
28
LinkerOptions.clear ();
29
29
LOHContainer.reset ();
30
+ DataRegions.clear ();
30
31
}
31
32
32
33
bool MCObjectWriter::isSymbolRefDifferenceFullyResolved (
Original file line number Diff line number Diff line change @@ -49,14 +49,12 @@ void MachObjectWriter::reset() {
49
49
Relocations.clear ();
50
50
IndirectSymBase.clear ();
51
51
IndirectSymbols.clear ();
52
- DataRegions.clear ();
53
52
SectionAddress.clear ();
54
53
SectionOrder.clear ();
55
54
StringTable.clear ();
56
55
LocalSymbolData.clear ();
57
56
ExternalSymbolData.clear ();
58
57
UndefinedSymbolData.clear ();
59
- LOHContainer.reset ();
60
58
VersionInfo.Major = 0 ;
61
59
VersionInfo.SDKVersion = VersionTuple ();
62
60
TargetVariantVersionInfo.Major = 0 ;
@@ -1096,10 +1094,11 @@ void MachObjectWriter::writeDataInCodeRegion(MCAssembler &Asm) {
1096
1094
else
1097
1095
report_fatal_error (" Data region not terminated" );
1098
1096
1099
- LLVM_DEBUG (dbgs () << " data in code region-- kind: " << Data.Kind
1100
- << " start: " << Start << " (" << Data.Start ->getName ()
1101
- << " )" << " end: " << End << " (" << Data.End ->getName ()
1102
- << " )" << " size: " << End - Start << " \n " );
1097
+ LLVM_DEBUG (dbgs () << " data in code region-- kind: "
1098
+ << (MachO::DataRegionType)Data.Kind << " start: "
1099
+ << Start << " (" << Data.Start ->getName () << " )"
1100
+ << " end: " << End << " (" << Data.End ->getName () << " )"
1101
+ << " size: " << End - Start << " \n " );
1103
1102
W.write <uint32_t >(Start);
1104
1103
W.write <uint16_t >(End - Start);
1105
1104
W.write <uint16_t >(Data.Kind );
You can’t perform that action at this time.
0 commit comments