Static Call
include/static_call.h View source View on GitHubFunctions
Section titled “Functions”__static_call_update
Section titled “__static_call_update”void __static_call_update(void *trampoline, void *fn); Macros
Section titled “Macros”STATIC_CALL_DECLARE
Section titled “STATIC_CALL_DECLARE”#define STATIC_CALL_DECLARE(name, default_fn) \
extern __typeof__(default_fn) name##_trampoline; \
asm(".pushsection .text, \"ax\"\n\t" \
".globl " #name "_trampoline\n\t" #name "_trampoline:\n\t" \
".byte 0xe9\n\t" /* jmp rel32 */ static_call
Section titled “static_call”#define static_call(name) name##_trampoline static_call_update
Section titled “static_call_update”#define static_call_update(name, fn) \
do { \
__typeof__(&name##_trampoline) _scu_fn = (fn); \
__static_call_update((void *) name##_trampoline, (void *) _scu_fn); \
} while (0)