ARM calling conventions generated in gcc with different optimizations

Vasily Golubev vasily.golubev@gmail.com
Mon Sep 23 12:15:00 GMT 2013


Hello, all.

I am trying to find some way for detection of function's entry and
exit analyzing binary at runtime. It is possible to use Valgrind
(www.valgrind.org) and detect all Basic Blocks (1 entry, multiple
exits) that correspond to entry\exit of function.

As far as I understand, at the start of new function according to
calling conventions of ARM we have return address in LR (r14). And if
I will save LR at some place and then compare the address for each BB
with saved LR I can find return from function.

And my main question is it possible to rely on this fact when
compiling with gcc and different levels of optimizations? Is it
possible to generate some straightforward heuristic to detect this
evens (with\without debug info)?

Thank you in advance for any suggestions!

-- 
Best Regards,
Vasily



More information about the Gcc mailing list