summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCMachOStreamer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-28 16:22:59 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-28 16:22:59 +0000
commit1679580cc94fd814f33efff5d93245769bc992c1 (patch)
tree1c1762d4de0796c6f7df62334b56a4e9ca65dd54 /llvm/lib/MC/MCMachOStreamer.cpp
parentd4b3feb3f7efabac49369683d97cbac642118728 (diff)
downloadbcm5719-llvm-1679580cc94fd814f33efff5d93245769bc992c1.tar.gz
bcm5719-llvm-1679580cc94fd814f33efff5d93245769bc992c1.zip
Revert previous patch while I debug the darwin bootstrap failure.
llvm-svn: 120246
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 02a1f089e80..3f93604caaf 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -105,6 +105,14 @@ void MCMachOStreamer::InitSections() {
}
void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
+ // TODO: This is almost exactly the same as WinCOFFStreamer. Consider merging
+ // into MCObjectStreamer.
+ assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
+ assert(!Symbol->isVariable() && "Cannot emit a variable symbol!");
+ assert(CurSection && "Cannot emit before setting section!");
+
+ Symbol->setSection(*CurSection);
+
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
// We have to create a new fragment if this is an atom defining symbol,
@@ -112,7 +120,14 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
if (getAssembler().isSymbolLinkerVisible(SD.getSymbol()))
new MCDataFragment(getCurrentSectionData());
- MCObjectStreamer::EmitLabel(Symbol);
+ // 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());
// This causes the reference type flag to be cleared. Darwin 'as' was "trying"
// to clear the weak reference and weak definition bits too, but the
OpenPOWER on IntegriCloud