From 4792258fd0b2dc7ac89d98b270e10264c5491e82 Mon Sep 17 00:00:00 2001 From: Yifan Lu Date: Tue, 4 Oct 2016 19:51:51 -0700 Subject: Added option to removed pthread dependency Added option to remove dynamic linker stuff Fixed a reference in strerror.c that depends on __APPLE__ being defined --- lib/hook-functions.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/hook-functions.c') diff --git a/lib/hook-functions.c b/lib/hook-functions.c index fed9e3e..8363567 100644 --- a/lib/hook-functions.c +++ b/lib/hook-functions.c @@ -5,7 +5,9 @@ #include "transform-dis.h" #include "execmem.h" #include stringify(TARGET_DIR/jump-patch.h) +#ifndef NO_PTHREADS #include +#endif struct hook_internal { int offset_by_pcdiff[MAX_EXTENDED_PATCH_SIZE + 1]; @@ -135,9 +137,13 @@ int substitute_hook_functions(const struct substitute_function_hook *hooks, size_t nhooks, struct substitute_function_hook_record **recordp, int options) { +#ifndef NO_PTHREADS bool thread_safe = !(options & SUBSTITUTE_NO_THREAD_SAFETY); if (thread_safe && !pthread_main_np()) return SUBSTITUTE_ERR_NOT_ON_MAIN_THREAD; +#else + bool thread_safe = false; +#endif if (recordp) *recordp = NULL; -- cgit v1.2.3