termux-packages/packages/uftrace/libmcount-wrap.c.patch

63 lines
1.7 KiB
Diff

diff -uNr uftrace-0.9.3/libmcount/wrap.c uftrace-0.9.3.mod/libmcount/wrap.c
--- uftrace-0.9.3/libmcount/wrap.c 2019-07-13 17:25:47.000000000 +0300
+++ uftrace-0.9.3.mod/libmcount/wrap.c 2019-09-03 20:46:52.430226391 +0300
@@ -216,7 +216,6 @@
/*
* hooking functions
*/
-static int (*real_backtrace)(void **buffer, int sz);
static void (*real_cxa_throw)(void *exc, void *type, void *dest);
static void (*real_cxa_rethrow)(void);
static void * (*real_cxa_begin_catch)(void *exc);
@@ -241,7 +240,6 @@
void mcount_hook_functions(void)
{
- real_backtrace = dlsym(RTLD_NEXT, "backtrace");
real_cxa_throw = dlsym(RTLD_NEXT, "__cxa_throw");
real_cxa_rethrow = dlsym(RTLD_NEXT, "__cxa_rethrow");
real_cxa_begin_catch = dlsym(RTLD_NEXT, "__cxa_begin_catch");
@@ -258,22 +256,7 @@
__visible_default int backtrace(void **buffer, int sz)
{
- int ret;
- struct mcount_thread_data *mtdp;
-
- if (unlikely(real_backtrace == NULL))
- mcount_hook_functions();
-
- mtdp = get_thread_data();
- if (!check_thread_data(mtdp))
- mcount_rstack_restore(mtdp);
-
- ret = real_backtrace(buffer, sz);
-
- if (!check_thread_data(mtdp))
- mcount_rstack_reset(mtdp);
-
- return ret;
+ return 0;
}
__visible_default void __cxa_throw(void *exception, void *type, void *dest)
@@ -324,7 +307,8 @@
real_cxa_rethrow();
}
-__visible_default void _Unwind_Resume(void *exception)
+void __real__Unwind_Resume(void *exception);
+__visible_default void __wrap__Unwind_Resume(void *exception)
{
struct mcount_thread_data *mtdp;
@@ -345,7 +329,7 @@
mcount_rstack_restore(mtdp);
}
- real_unwind_resume(exception);
+ __real__Unwind_Resume(exception);
}
__visible_default void * __cxa_begin_catch(void *exception)