Lines Matching defs:func
91 // function "func", the interceptor implementation is in ___interceptor_func,
93 // aliased (via a trampoline) by weak wrapper function "func".
97 // - provide a non-weak function "func" that performs interception;
107 // - provide a weak function "func" that is an alias to __interceptor_func.
161 # define DECLARE_WRAPPER(ret_type, func, ...)
167 # define DECLARE_WRAPPER(ret_type, func, ...) \
168 extern "C" ret_type func(__VA_ARGS__);
169 # define DECLARE_WRAPPER_WINAPI(ret_type, func, ...) \
170 extern "C" __declspec(dllimport) ret_type __stdcall func(__VA_ARGS__);
175 // trampoline function. The function "func" is a weak alias to the trampoline
176 // (so that we may check if "func" was overridden), which calls the weak
180 // [wrapper "func": weak] --(alias)--> [TRAMPOLINE(func)]
185 // [__interceptor_func: weak] --(alias)--> [WRAP(func)]
195 # define __ASM_WEAK_WRAPPER(func) ".globl " #func "\n"
197 # define __ASM_WEAK_WRAPPER(func) ".weak " #func "\n"
205 # define DECLARE_WRAPPER(ret_type, func, ...) \
206 extern "C" ret_type func(__VA_ARGS__); \
207 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
208 extern "C" ret_type __interceptor_##func(__VA_ARGS__) \
209 INTERCEPTOR_ATTRIBUTE __attribute__((weak)) ALIAS(WRAP(func)); \
212 __ASM_WEAK_WRAPPER(func) \
213 ".set " #func ", " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
214 ".globl " SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
215 ".type " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", " \
217 SANITIZER_STRINGIFY(TRAMPOLINE(func)) ":\n" \
219 C_ASM_TAIL_CALL(SANITIZER_STRINGIFY(TRAMPOLINE(func)), \
221 SANITIZER_STRINGIFY(ASM_PREEMPTIBLE_SYM(func))) "\n" \
223 ".size " SANITIZER_STRINGIFY(TRAMPOLINE(func)) ", " \
224 ".-" SANITIZER_STRINGIFY(TRAMPOLINE(func)) "\n" \
231 // [wrapper "func": weak] --(alias)--> [WRAP(func)]
240 # define DECLARE_WRAPPER(ret_type, func, ...) \
241 extern "C" ret_type func(__VA_ARGS__) \
242 INTERCEPTOR_ATTRIBUTE __ATTRIBUTE_WEAK_WRAPPER ALIAS(WRAP(func));
253 # define DECLARE_REAL(ret_type, func, ...)
259 # define DECLARE_REAL(ret_type, func, ...) \
260 typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
262 extern FUNC_TYPE(func) PTR_TO_REAL(func); \
267 # define DECLARE_REAL(ret_type, func, ...) \
268 extern "C" ret_type func(__VA_ARGS__);
273 # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...) \
274 DECLARE_REAL(ret_type, func, __VA_ARGS__) \
275 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
276 extern "C" ret_type WRAP(func)(__VA_ARGS__);
279 # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...) \
280 extern "C" ret_type TRAMPOLINE(func)(__VA_ARGS__); \
281 extern "C" ret_type WRAP(func)(__VA_ARGS__); \
282 extern "C" ret_type func(__VA_ARGS__);
284 # define DECLARE_REAL_AND_INTERCEPTOR(ret_type, func, ...)
285 # define DECLARE_EXTERN_INTERCEPTOR_AND_WRAPPER(ret_type, func, ...)
293 # define DEFINE_REAL(ret_type, func, ...) \
294 typedef ret_type (*FUNC_TYPE(func))(__VA_ARGS__); \
296 FUNC_TYPE(func) PTR_TO_REAL(func); \
299 # define DEFINE_REAL(ret_type, func, ...)
305 // sanitizer_common/scripts/gen_dynamic_list.py to export func.
307 #define INTERCEPTOR(ret_type, func, ...) \
308 extern "C"[[ gnu::alias(#func), gnu::visibility("hidden") ]] ret_type \
309 __interceptor_##func(__VA_ARGS__); \
310 extern "C" INTERCEPTOR_ATTRIBUTE ret_type func(__VA_ARGS__)
314 #define INTERCEPTOR(ret_type, func, ...) \
315 DEFINE_REAL(ret_type, func, __VA_ARGS__) \
316 DECLARE_WRAPPER(ret_type, func, __VA_ARGS__) \
317 extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__)
320 #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \
321 INTERCEPTOR(ret_type, func, __VA_ARGS__)
325 #define INTERCEPTOR_ZZZ(suffix, ret_type, func, ...) \
326 extern "C" ret_type func(__VA_ARGS__) suffix; \
327 extern "C" ret_type WRAP(func)(__VA_ARGS__); \
328 INTERPOSER(func); \
329 extern "C" INTERCEPTOR_ATTRIBUTE ret_type WRAP(func)(__VA_ARGS__)
331 #define INTERCEPTOR(ret_type, func, ...) \
332 INTERCEPTOR_ZZZ(/*no symbol variants*/, ret_type, func, __VA_ARGS__)
334 #define INTERCEPTOR_WITH_SUFFIX(ret_type, func, ...) \
335 INTERCEPTOR_ZZZ(__DARWIN_ALIAS_C(func), ret_type, func, __VA_ARGS__)
343 # define INTERCEPTOR_WINAPI(ret_type, func, ...) \
344 typedef ret_type (__stdcall *FUNC_TYPE(func))(__VA_ARGS__); \
346 FUNC_TYPE(func) PTR_TO_REAL(func); \
348 extern "C" INTERCEPTOR_ATTRIBUTE ret_type __stdcall WRAP(func)(__VA_ARGS__)
374 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
375 # define INTERCEPT_FUNCTION_VER(func, symver) \
376 INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver)
379 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_MAC(func)
380 # define INTERCEPT_FUNCTION_VER(func, symver) \
381 INTERCEPT_FUNCTION_VER_MAC(func, symver)
384 # define INTERCEPT_FUNCTION(func) INTERCEPT_FUNCTION_WIN(func)
385 # define INTERCEPT_FUNCTION_VER(func, symver) \
386 INTERCEPT_FUNCTION_VER_WIN(func, symver)