Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a5a4977 authored by Jing Yu's avatar Jing Yu
Browse files

Link with libgccdemangle.so for name demangling.

1. X86 target will also have name demangling feature.
2. Remove dependency on libiberty.so, since it will not come
with prebuilt toolchain in gcc-4.6 and after.

Change-Id: Iefbb021c5c3171b9467954eafa54046ad6805753
parent 1e339a71
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ ifeq ($(TARGET_ARCH),arm)
LOCAL_SRC_FILES += \
	arch-arm/backtrace-arm.c \
	arch-arm/ptrace-arm.c
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH -DCORKSCREW_HAVE_LIBIBERTY
LOCAL_LDFLAGS += -liberty
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_SRC_FILES += \
@@ -38,7 +37,7 @@ LOCAL_SRC_FILES += \
LOCAL_CFLAGS += -DCORKSCREW_HAVE_ARCH
endif

LOCAL_SHARED_LIBRARIES += libdl libcutils
LOCAL_SHARED_LIBRARIES += libdl libcutils libgccdemangle

LOCAL_CFLAGS += -std=gnu99 -Werror
LOCAL_MODULE := libcorkscrew
+4 −9
Original line number Diff line number Diff line
@@ -21,15 +21,10 @@

#include <cutils/log.h>

#ifdef CORKSCREW_HAVE_LIBIBERTY
// Defined in libiberty.a
extern char *cplus_demangle(const char *mangled, int options);
#endif
extern char *__cxa_demangle (const char *mangled, char *buf, size_t *len,
                             int *status);

char* demangle_symbol_name(const char* name) {
#ifdef CORKSCREW_HAVE_LIBIBERTY
    return name ? cplus_demangle(name, 0) : NULL;
#else
    return NULL;
#endif
    // __cxa_demangle handles NULL by returning NULL
    return __cxa_demangle(name, 0, 0, 0);
}