As a rule, the Linux kernel is compiled, replacing / connecting a static function at runtime is not possible (with the exception of unloading / reloading the entire module if you are talking about the module code).
This is because inlines static compilation works most of the time (unless you take the address somewhere) and therefore they will not appear in the symbol table. After compilation, there is no way to find out where in the generated binary code the static code ended - it is unlikely that you will find several built-in versions of it in all sites calling func.
So, the main question: why should the function be static ? What exactly are you trying to do, does this require the use of static ?
source share