This is the mail archive of the
mailing list for the GCC project.
How to create new functions with a gcc plugin?
- From: Benxi Liu <lbxlbxlbxlbxlbx at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 7 Jun 2017 21:03:53 +0800
- Subject: How to create new functions with a gcc plugin?
- Authentication-results: sourceware.org; auth=none
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.
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)?