aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCELFStreamer.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2012-07-09 10:52:46 -0700
committerDerek Schuff <dschuff@chromium.org>2012-07-09 11:00:37 -0700
commit5dbcc7e0c9c12f4a4042fb4a226654aee927999c (patch)
treeb316a3370e9286cb4e6f81b2f9d8bd8b54ce5123 /lib/MC/MCELFStreamer.cpp
parent86dc97be9ac3b4804528e087b04b4f4192cdee54 (diff)
LOCALMODs from hg 0b098ca44de7 against r158408 (hg 90a87d6bfe45)
(only non-new files; new files in git 4f429c8b) Change-Id: Ia39f818088485bd90e4d048db404f8d6ba5f836b
Diffstat (limited to 'lib/MC/MCELFStreamer.cpp')
-rw-r--r--lib/MC/MCELFStreamer.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
index 6ac9d9d51c..39cc4eb415 100644
--- a/lib/MC/MCELFStreamer.cpp
+++ b/lib/MC/MCELFStreamer.cpp
@@ -466,7 +466,6 @@ void MCELFStreamer::EmitInstToFragment(const MCInst &Inst) {
}
void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
- MCDataFragment *DF = getOrCreateDataFragment();
SmallVector<MCFixup, 4> Fixups;
SmallString<256> Code;
@@ -477,12 +476,21 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
for (unsigned i = 0, e = Fixups.size(); i != e; ++i)
fixSymbolsInTLSFixups(Fixups[i].getValue());
- // Add the fixups and data.
- for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
- Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
- DF->addFixup(Fixups[i]);
+ // @LOCALMOD-BEGIN
+ if (Fixups.size() > 0) {
+ MCDataFragment *DF = getOrCreateDataFragment();
+
+ // Add the fixups and data.
+ for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
+ Fixups[i].setOffset(Fixups[i].getOffset() + DF->getContents().size());
+ DF->addFixup(Fixups[i]);
+ }
+ DF->getContents().append(Code.begin(), Code.end());
+ } else {
+ MCTinyFragment *TF = new MCTinyFragment(getCurrentSectionData());
+ TF->getContents().append(Code.begin(), Code.end());
}
- DF->getContents().append(Code.begin(), Code.end());
+ // @LOCALMOD-END
}
void MCELFStreamer::FinishImpl() {