I want to intercept some functions and add some features to them.

I found that there are interceptors in llvm-project. llvm-project/interception.h at 1a2eaebc09c6a200f93b8beb37130c8b8aab3934 · llvm/llvm-project · GitHub

In the documentation they say we can intercept function by defining INTERCEPTOR(return type, function name, args …){} and calling INTERCEPT_FUNCTION(function name).

So I defined INTERCEPTOR(void, free, void* p){ //print message} and executed INTERCEPT_FUNCION(free) in the compiler-rt file.

But I encountered following error.

undefined reference to `__interception::InterceptFunction(char const*, unsigned long*, unsigned long, unsigned long)'

I think it need more information or implementation.

Is there anyone who knows how can solve this error?

thank you.