[LLVMdev] Emitting switch table data to section (previously - subclassing MCELFStreamer)

Carter, Jack jcarter at mips.com
Wed Nov 16 13:55:52 PST 2011


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);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111116/948d029f/attachment.html>


More information about the llvm-dev mailing list