Pointers to Labels

34 views
Skip to first unread message

Anthony Bonkoski

unread,
May 7, 2015, 4:00:37 AM5/7/15
to asmji...@googlegroups.com
Hi all,

Thanks for all the great work on this project. It has made my life much easier!
However, I currently have a minor problem that I cannot quite figure out.

I would like to be able to determine the resultant machine-code address of asmjit labels.
That is, after assembling a sequence of instructions and binding various asmjit::Label, I'd like to compute the offset to those labels in the resulting machine-code.
I need these offsets so that I can jump into a single asmjit sequence at many different entry points.

I imagine there is a very simple solution, but I cannot seem to find it.

Thanks for your time,
-Anthony

Petr Kobalíček

unread,
May 7, 2015, 8:02:28 AM5/7/15
to asmji...@googlegroups.com
Hi Anthony,

Thanks! There is a simple solution, use Assembler's or Compiler's

  getLabelOffset(labelOperand) or
  getLabelOffset(labelId)

it will return an offset that is relative to the start of the code assembled. You can use this even before the code is generated or relocated, the only requirement for the label is to be bound.

Hope that helps !

Cheers,
Petr

--

---
You received this message because you are subscribed to the Google Groups "asmjit-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to asmjit-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony Bonkoski

unread,
May 7, 2015, 9:08:18 PM5/7/15
to asmji...@googlegroups.com
Just as simple as I've come to expect from this library!
Thanks a bunch. This is super helpful!
-Anthony
Reply all
Reply to author
Forward
0 new messages