From 37eb913ed8c4798b736e678f4dbd9f4a91a68f74 Mon Sep 17 00:00:00 2001 From: Salvatore Cro Date: Thu, 9 Sep 2010 15:45:44 +0200 Subject: libubacktrace: Provide uClibc with backtrace functions A new shared object, libubacktrace.so.0 is added to uClibc to provide backtrace functions to support application self-debugging. This set of functions requires to dynamically load libgcc_s.so so they need to call dlopen/dlsym that are provided by libdl. For this reason they cannot be included into libc.so.0 but are provided by a new library. User application that wants to use backtrace needs to be compiled with -fexceptions option and -rdynamic to get full symbols printed and must be linked against libubacktrace.so Signed-off-by: Carmelo Amoroso --- Rules.mak | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Rules.mak') diff --git a/Rules.mak b/Rules.mak index 89127043c..ade86c6ac 100644 --- a/Rules.mak +++ b/Rules.mak @@ -118,7 +118,7 @@ export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION ABI_VERSION LC_ALL LIBC := libc SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION) - +UBACKTRACE_DSO := libubacktrace.so.$(MAJOR_VERSION) ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 mips64 powerpc64 s390x sparc64 x86_64 ),) UCLIBC_LDSO_NAME := ld64-uClibc ARCH_NATIVE_BIT := 64 @@ -528,6 +528,13 @@ link.asneeded = $(if $(and $(CC_FLAG_ASNEEDED),$(CC_FLAG_NO_ASNEEDED)),$(CC_FLAG # Check for AS_NEEDED support in linker script (binutils>=2.16.1 has it) ifndef ASNEEDED export ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UCLIBC_LDSO) )" || echo "$(UCLIBC_LDSO)") +ifeq ($(UCLIBC_HAS_BACKTRACE),y) +# Only used in installed libc.so linker script +UBACKTRACE_FULL_NAME := $(RUNTIME_PREFIX)lib/$(UBACKTRACE_DSO) +export UBACKTRACE_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UBACKTRACE_FULL_NAME) )" || echo "$(UBACKTRACE_FULL_NAME)") +else +export UBACKTRACE_ASNEEDED:="" +endif endif # Add a bunch of extra pedantic annoyingly strict checks -- cgit v1.2.3