@@ -54,9 +54,6 @@ class MCMachOStreamer : public MCObjectStreamer {
54
54
// / need for local relocations. False by default.
55
55
bool LabelSections;
56
56
57
- bool DWARFMustBeAtTheEnd;
58
- bool CreatedADWARFSection;
59
-
60
57
// / HasSectionLabel - map of which sections have already had a non-local
61
58
// / label emitted to them. Used so we don't emit extraneous linker local
62
59
// / labels in the middle of the section.
@@ -70,16 +67,13 @@ class MCMachOStreamer : public MCObjectStreamer {
70
67
public:
71
68
MCMachOStreamer (MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
72
69
std::unique_ptr<MCObjectWriter> OW,
73
- std::unique_ptr<MCCodeEmitter> Emitter,
74
- bool DWARFMustBeAtTheEnd, bool label)
70
+ std::unique_ptr<MCCodeEmitter> Emitter, bool label)
75
71
: MCObjectStreamer(Context, std::move(MAB), std::move(OW),
76
72
std::move (Emitter)),
77
- LabelSections(label), DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd),
78
- CreatedADWARFSection(false ) {}
73
+ LabelSections(label) {}
79
74
80
75
// / state management
81
76
void reset () override {
82
- CreatedADWARFSection = false ;
83
77
HasSectionLabel.clear ();
84
78
MCObjectStreamer::reset ();
85
79
}
@@ -141,48 +135,9 @@ class MCMachOStreamer : public MCObjectStreamer {
141
135
142
136
} // end anonymous namespace.
143
137
144
- static bool canGoAfterDWARF (const MCSectionMachO &MSec) {
145
- // These sections are created by the assembler itself after the end of
146
- // the .s file.
147
- StringRef SegName = MSec.getSegmentName ();
148
- StringRef SecName = MSec.getName ();
149
-
150
- if (SegName == " __LD" && SecName == " __compact_unwind" )
151
- return true ;
152
-
153
- if (SegName == " __IMPORT" ) {
154
- if (SecName == " __jump_table" )
155
- return true ;
156
-
157
- if (SecName == " __pointers" )
158
- return true ;
159
- }
160
-
161
- if (SegName == " __TEXT" && SecName == " __eh_frame" )
162
- return true ;
163
-
164
- if (SegName == " __DATA" &&
165
- (SecName == " __llvm_addrsig" || SecName == " __nl_symbol_ptr" ||
166
- SecName == " __thread_ptr" ))
167
- return true ;
168
- if (SegName == " __LLVM" && (SecName == " __cg_profile" ))
169
- return true ;
170
-
171
- if (SegName == " __DATA" && SecName == " __auth_ptr" )
172
- return true ;
173
-
174
- return false ;
175
- }
176
-
177
138
void MCMachOStreamer::changeSection (MCSection *Section, uint32_t Subsection) {
178
139
// Change the section normally.
179
- bool Created = changeSectionImpl (Section, Subsection);
180
- const MCSectionMachO &MSec = *cast<MCSectionMachO>(Section);
181
- StringRef SegName = MSec.getSegmentName ();
182
- if (SegName == " __DWARF" )
183
- CreatedADWARFSection = true ;
184
- else if (Created && DWARFMustBeAtTheEnd && !canGoAfterDWARF (MSec))
185
- assert (!CreatedADWARFSection && " Creating regular section after DWARF" );
140
+ changeSectionImpl (Section, Subsection);
186
141
187
142
// Output a linker-local symbol so we don't need section-relative local
188
143
// relocations. The linker hates us when we do that.
@@ -576,9 +531,8 @@ MCStreamer *llvm::createMachOStreamer(MCContext &Context,
576
531
std::unique_ptr<MCCodeEmitter> &&CE,
577
532
bool DWARFMustBeAtTheEnd,
578
533
bool LabelSections) {
579
- MCMachOStreamer *S =
580
- new MCMachOStreamer (Context, std::move (MAB), std::move (OW), std::move (CE),
581
- DWARFMustBeAtTheEnd, LabelSections);
534
+ MCMachOStreamer *S = new MCMachOStreamer (
535
+ Context, std::move (MAB), std::move (OW), std::move (CE), LabelSections);
582
536
const Triple &Target = Context.getTargetTriple ();
583
537
S->emitVersionForTarget (
584
538
Target, Context.getObjectFileInfo ()->getSDKVersion (),
0 commit comments