diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-02-13 09:28:15 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-13 09:28:15 +0000 |
| commit | 8e53203154884d7d7390f8d65c637ecbb6de5f52 (patch) | |
| tree | 2e8276368657213fd447365f09ec10a8958fab8d /llvm/lib/MC/MCAssembler.cpp | |
| parent | bedf1d4a41e112080e84a7af97b5f5c9166f755e (diff) | |
| download | bcm5719-llvm-8e53203154884d7d7390f8d65c637ecbb6de5f52.tar.gz bcm5719-llvm-8e53203154884d7d7390f8d65c637ecbb6de5f52.zip | |
MCAssembler: Start applying fixups in the data section.
llvm-svn: 96090
Diffstat (limited to 'llvm/lib/MC/MCAssembler.cpp')
| -rw-r--r-- | llvm/lib/MC/MCAssembler.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index a5df4ba42be..c8fa6bd589d 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -481,6 +481,8 @@ public: if (Target.isAbsolute()) { // constant // SymbolNum of 0 indicates the absolute section. + // + // FIXME: When is this generated? Type = RIT_Vanilla; Value = 0; llvm_unreachable("FIXME: Not yet implemented!"); @@ -875,6 +877,12 @@ public: OS << StringTable.str(); } } + + void ApplyFixup(const MCAsmFixup &Fixup, MCDataFragment &DF) { + // FIXME: Endianness assumption. + for (unsigned i = 0; i != Fixup.Size; ++i) + DF.getContents()[Fixup.Offset + i] = uint8_t(Fixup.FixedValue >> (i * 8)); + } }; /* *** */ @@ -1070,9 +1078,19 @@ static void WriteFileData(raw_ostream &OS, const MCFragment &F, break; } - case MCFragment::FT_Data: + case MCFragment::FT_Data: { + MCDataFragment &DF = cast<MCDataFragment>(F); + + // Apply the fixups. + // + // FIXME: Move elsewhere. + for (MCDataFragment::const_fixup_iterator it = DF.fixup_begin(), + ie = DF.fixup_end(); it != ie; ++it) + MOW.ApplyFixup(*it, DF); + OS << cast<MCDataFragment>(F).getContents().str(); break; + } case MCFragment::FT_Fill: { MCFillFragment &FF = cast<MCFillFragment>(F); |

