How to create new functions with a gcc plugin?

Benxi Liu lbxlbxlbxlbxlbx@gmail.com
Wed Jun 7 13:03:00 GMT 2017


Hi all,

I'm using a gcc plugin to do some instrument during compilation.

Instrument in functions is simple. But how can I create new functions,
and append it to executables? I want to instrument in this way: to
create new functions,  add my codes into them, then instrument some
calls to them.

foo:
call to new_function;      //instrument a call

new_function:                 //created function
instrument  codes here

I think the most difficult part is to create functions. If it's
possible to do so, can I create functions at any phase during
compilation(with a gimple, or a rtl pass)?

 Any tips?



More information about the Gcc mailing list