Lines Matching defs:func

80 // function "func", the interceptor implementation is in ___interceptor_func,
82 // aliased (via a trampoline) by weak wrapper function "func".
86 // - provide a non-weak function "func" that performs interception;
96 // - provide a weak function "func" that is an alias to __interceptor_func.
150 # define DECLARE_WRAPPER(ret_type, func, ...)
156 # define DECLARE_WRAPPER(ret_type, func, ...) \
157 extern "C" ret_type func(__VA_ARGS__);
158 # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
159 extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
164 // trampoline function. The function "func" is a weak alias to the trampoline
165 // (so that we may check if "func" was overridden), which calls the weak
169 // [wrapper "func": weak] --(alias)--> [TRAMPOLINE(func)]
174 // [__interceptor_func: weak] --(alias)--> [WRAP(func)]
184 # define __ASM_WEAK_WRAPPER(func) ".globl " #func "\n"
186 # define __ASM_WEAK_WRAPPER(func) ".weak " #func "\n"
194 # define DECLARE_WRAPPER(ret_type, func, ...) \
195 extern "C" ret_type func(__VA_ARGS__); \
196 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
197 extern "C" ret_type __interceptor_##func(__VA_ARGS__) \
198 INTERCEPTOR_ATTRIBUTE __attribute__((weak)) ALIAS(WRAP(func)); \
201 __ASM_WEAK_WRAPPER(func) \
202 ".set " #func ", " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
203 ".globl " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
204 ".type " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", " \
206 SANITIZER_STRINGIFY(TRAMPOLINE(func)) ":\n" \
208 C_ASM_TAIL_CALL(SANITIZER_STRINGIFY(TRAMPOLINE(func)), \
210 SANITIZER_STRINGIFY(ASM_PREEMPTIBLE_SYM(func))) "\n" \
212 ".size " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", " \
213 ".-" SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
220 // [wrapper "func": weak] --(alias)--> [WRAP(func)]
229 # define DECLARE_WRAPPER(ret_type, func, ...) \
230 extern "C" ret_type func(__VA_ARGS__) \
231 INTERCEPTOR_ATTRIBUTE __ATTRIBUTE_WEAK_WRAPPER ALIAS(WRAP(func));
242 # define DECLARE_REAL(ret_type, func, ...)
248 # define DECLARE_REAL(ret_type, func, ...) \
249 typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
251 extern FUNC_TYPE(func) PTR_TO_REAL(func); \
256 # define DECLARE_REAL(ret_type, func, ...) \
257 extern "C" ret_type func(__VA_ARGS__);
262 # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \
263 DECLARE_REAL(ret_type, func, __VA_ARGS__) \
264 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
265 extern "C" ret_type WRAP(func)(__VA_ARGS__);
268 # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) \
269 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
270 extern "C" ret_type WRAP(func)(__VA_ARGS__); \
271 extern "C" ret_type func(__VA_ARGS__);
273 # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...)
274 # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...)
282 # define DEFINE_REAL(ret_type, func, ...) \
283 typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
285 FUNC_TYPE(func) PTR_TO_REAL(func); \
288 # define DEFINE_REAL(ret_type, func, ...)
294 // sanitizer_common/scripts/gen_dynamic_list.py to export func.
296 #define INTERCEPTOR(ret_type, func, ...) \
297 extern "C"[[ gnu::alias(#func), gnu::visibility("hidden") ]] ret_type \
298 __interceptor_##func(__VA_ARGS__); \
299 extern "C" INTERCEPTOR_ATTRIBUTE ret_type func(__VA_ARGS__)
303 #define INTERCEPTOR(ret_type, func, ...) \
304 DEFINE_REAL(ret_type, func, __VA_ARGS__) \
305 DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \
306 extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__)
309 #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \
310 INTERCEPTOR(ret_type, func, __VA_ARGS__)
314 #define INTERCEPTOR_ZZZ(suffix, ret_type, func, ...) \
315 extern "C" ret_type func(__VA_ARGS__) suffix; \
316 extern "C" ret_type WRAP(func)(__VA_ARGS__); \
317 INTERPOSER(func); \
318 extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__)
320 #define INTERCEPTOR(ret_type, func, ...) \
321 INTERCEPTOR_ZZZ(/*no symbol variants*/, ret_type, func, __VA_ARGS__)
323 #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \
324 INTERCEPTOR_ZZZ(__DARWIN_ALIAS_C(func), ret_type, func, __VA_ARGS__)
332 # define INTERCEPTOR_WINAPI(ret_type, func, ...) \
333 typedef ret_type (__stdcall *FUNC_TYPE(func))(__VA_ARGS__); \
335 FUNC_TYPE(func) PTR_TO_REAL(func); \
337 extern "C" INTERCEPTOR_ATTRIBUTE ret_type __stdcall WRAP(func)(__VA_ARGS__)
371 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
372 # define INTERCEPT_FUNCTION_VER(func, symver) \
373 INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver)
376 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func)
377 # define INTERCEPT_FUNCTION_VER(func, symver) \
378 INTERCEPT_FUNCTION_VER_MAC(func, symver)
381 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_WIN(func)
382 # define INTERCEPT_FUNCTION_VER(func, symver) \
383 INTERCEPT_FUNCTION_VER_WIN(func, symver)