[LLVMdev] MCFixup for distance from instruction to end of .text section
Tim Northover
t.p.northover at gmail.com
Sun Jul 13 00:55:00 PDT 2014
Hi Tom,
On 12 July 2014 22:52, Tom Stellard <tom at stellard.net> wrote:
> I would like to use a MCFixup to encode the distance in number of bytes
> from an instruction to the end of the .text section. Is there an
> existing MCFixup type I can use for this? If not, does anyone have any
> suggestions for how to add a new MCFixup type that will do this?
If that end-point is going to be resolved at compile-time, I think
we'd usually create a dummy (local) label and then emit it at the
correct place; you'd probably just need a generic FK_PCRel_N fixup.
Otherwise, it's probably a target-specific FixupKind that gets emitted
as a relocation and some assembly syntax that you make up. I suppose
you could do the same trick with a real symbol and demand that the
linker defines it (similar to how "_GLOBAL_OFFSET_TABLE_" gets
defined, for example).
Cheers.
Tim.
More information about the llvm-dev
mailing list