mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-11 13:44:28 +00:00
MCAssembler: Start applying fixups in the data section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96090 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b7c3a4b195
commit
3a30b827a5
@ -130,17 +130,14 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<MCAsmFixup> &getFixups() {
|
||||
return Fixups;
|
||||
}
|
||||
std::vector<MCAsmFixup> &getFixups() { return Fixups; }
|
||||
const std::vector<MCAsmFixup> &getFixups() const { return Fixups; }
|
||||
|
||||
fixup_iterator fixup_begin() {
|
||||
return Fixups.begin();
|
||||
}
|
||||
fixup_iterator fixup_begin() { return Fixups.begin(); }
|
||||
const_fixup_iterator fixup_begin() const { return Fixups.begin(); }
|
||||
|
||||
fixup_iterator fixup_end() {
|
||||
return Fixups.end();
|
||||
}
|
||||
fixup_iterator fixup_end() {return Fixups.end();}
|
||||
const_fixup_iterator fixup_end() const {return Fixups.end();}
|
||||
|
||||
size_t fixup_size() const { return Fixups.size(); }
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user