I have managed to produce correct relocation records for my jump table with the below code, but am baffled to how to emit the text addresses to the data section.
I’m sure it is just a few lines of code. Any suggestions?
Jack
void MCObjectStreamer::EmitGPRel32Value(const MCExpr *Value) {
MCDataFragment *DF = getOrCreateDataFragment();
int Size = 4; // Assumption is that this is alway for 4 byte value
DF->addFixup(MCFixup::Create(DF->getContents().size(),
Value,
FK_GPRel_4));
DF->getContents().resize(DF->getContents().size() + Size, 0);
}