Revert previous patch while I debug the darwin bootstrap failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120246 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
index 0286991..2e0d85a 100644
--- a/lib/MC/MCELFStreamer.cpp
+++ b/lib/MC/MCELFStreamer.cpp
@@ -189,13 +189,26 @@
}
void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
- MCObjectStreamer::EmitLabel(Symbol);
+ assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
+
+ Symbol->setSection(*CurSection);
+
+ MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
const MCSectionELF &Section =
static_cast<const MCSectionELF&>(Symbol->getSection());
- MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
if (Section.getFlags() & MCSectionELF::SHF_TLS)
SetType(SD, ELF::STT_TLS);
+
+ // FIXME: This is wasteful, we don't necessarily need to create a data
+ // fragment. Instead, we should mark the symbol as pointing into the data
+ // fragment if it exists, otherwise we should just queue the label and set its
+ // fragment pointer when we emit the next fragment.
+ MCDataFragment *F = getOrCreateDataFragment();
+
+ assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
+ SD.setFragment(F);
+ SD.setOffset(F->getContents().size());
}
void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {