From 71c10c484e7dc113396cccb7e503befb759c6346 Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Thu, 9 May 2013 11:42:23 +0200 Subject: libubacktrace: fix backtrace for statically linked application libgcc_s.so's unwinder could not access unwind tables of statically linked binaries, so we really want to use _Unwind_* stuff from libgcc_eh.a. It required to build backtrace.c differentiating between shared and static case. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- libubacktrace/arm/Makefile.arch | 2 +- libubacktrace/arm/backtrace.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'libubacktrace/arm') diff --git a/libubacktrace/arm/Makefile.arch b/libubacktrace/arm/Makefile.arch index 53b8c0e21..b3fb500e2 100644 --- a/libubacktrace/arm/Makefile.arch +++ b/libubacktrace/arm/Makefile.arch @@ -14,4 +14,4 @@ libubacktrace-a-y+=$(libubacktrace_ARCH_OBJS:.o=.os) else libubacktrace-a-y+=$(libubacktrace_ARCH_OBJS) endif -libubacktrace-so-y+=$(libubacktrace_ARCH_OBJS:.o=.os) +libubacktrace-so-y+=$(libubacktrace_ARCH_OBJS:.o=.oS) diff --git a/libubacktrace/arm/backtrace.c b/libubacktrace/arm/backtrace.c index c154496a7..55689a741 100644 --- a/libubacktrace/arm/backtrace.c +++ b/libubacktrace/arm/backtrace.c @@ -26,6 +26,7 @@ struct trace_arg int cnt, size; }; +#ifdef SHARED static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *); static _Unwind_VRS_Result (*unwind_vrs_get) (_Unwind_Context *, _Unwind_VRS_RegClass, @@ -43,6 +44,10 @@ static void backtrace_init (void) abort(); } } +#else +# define unwind_backtrace _Unwind_Backtrace +# define unwind_vrs_get _Unwind_VRS_Get +#endif /* This function is identical to "_Unwind_GetGR", except that it uses "unwind_vrs_get" instead of "_Unwind_VRS_Get". */ static inline _Unwind_Word @@ -81,8 +86,10 @@ int backtrace (void **array, int size) { struct trace_arg arg = { .array = array, .size = size, .cnt = -1 }; +#ifdef SHARED if (unwind_backtrace == NULL) backtrace_init(); +#endif if (size >= 1) unwind_backtrace (backtrace_helper, &arg); -- cgit v1.2.3