How to make gcc add a function to executables?

291 Views Asked by At

I'm writing a gcc (version 5.4.0) plugin, which is intend to instrument some codes in functions. It's easy to do that by inserting some rtx or gimple instructions in a certain function:

a = foo();
instrument codes here;
b = foo();

But since the context in functions could be different, I'd like to instrument a call to my function, like:

a = foo();
call to instrument my function;
b = foo();

The problem is that I can't find a way to add my function, neither in gcc or with plugin. There's a related question: how-to-add-a-builtin-function-in-a-gcc-plugin, but it doesn't solve my problem. Any suggestions?

0

There are 0 best solutions below