diff options
author | comex | 2015-07-16 13:04:23 -0400 |
---|---|---|
committer | comex | 2015-07-16 13:04:23 -0400 |
commit | 83442f9005c21de839b5ed69bd3e0b4e59032020 (patch) | |
tree | ba464f6098f89f1dc29a9736cda6441044832224 /lib/substitute.h | |
parent | style police (diff) | |
download | substitute-83442f9005c21de839b5ed69bd3e0b4e59032020.tar.gz |
Add options field to struct substitute_{function,import}_hook.
I will probably need to add an option to deal with GCC 5.2's new
optimization - to not save caller-saved registers if the called function
is known not to use them, which would break with hooked functions.
Don't want to emit the required stub by default because it will likely
be slow. I need to verify that Clang doesn't currently have such an
optimization...
(ABI break - need to avoid this once it gets widely distributed Soon,
obviously)
Diffstat (limited to 'lib/substitute.h')
-rw-r--r-- | lib/substitute.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/substitute.h b/lib/substitute.h index 034cc26..72c3919 100644 --- a/lib/substitute.h +++ b/lib/substitute.h @@ -87,10 +87,17 @@ enum { const char *substitute_strerror(int err); struct substitute_function_hook { + /* The function to hook. (On ARM, Thumb functions are indicated as usual + * for function pointers.) */ void *function; + /* The replacement function. */ void *replacement; - void *old_ptr; /* optional: out *pointer* to function pointer to call old - * impl */ + /* Optional: out *pointer* to function pointer to call old implementation + * (i.e. given 'void (*old_foo)(...);', pass &old_foo) */ + void *old_ptr; + /* Currently unused; pass 0. (Protip: When using C {} struct initializer + * syntax, you can just omit this.) */ + int options; }; /* substitute_hook_functions options */ @@ -216,6 +223,9 @@ struct substitute_import_hook { * the same symbol, only one address is returned (hopefully they are all * equal) */ void *old_ptr; + /* Currently unused; pass 0. (Protip: When using C {} struct initializer + * syntax, you can just omit this.) */ + int options; }; /* Directly modify the GOT/PLT entries from a specified image corresponding to |