am 8a2282d1: Merge "Add on-device symbol demangle support."
* commit '8a2282d1dcafa15f8bd2e8df7c0fc4f1f79ea748':
Add on-device symbol demangle support.
diff --git a/Android.mk b/Android.mk
index 84d24f7..2a91487 100644
--- a/Android.mk
+++ b/Android.mk
@@ -94,8 +94,7 @@
LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -DNO_STRLCPY -std=gnu99
-# temporary until bfd.h is added
-LOCAL_CFLAGS += -DNO_DEMANGLE
+LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
LOCAL_CFLAGS += -DDWARF_SUPPORT
# various macros
@@ -130,8 +129,7 @@
LOCAL_CFLAGS := -DNO_NEWT_SUPPORT -DNO_LIBPERL -DNO_LIBPYTHON -std=gnu99
-# temporary until bfd.h is added
-LOCAL_CFLAGS += -DNO_DEMANGLE
+LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
LOCAL_CFLAGS += -DDWARF_SUPPORT
# various macros
@@ -188,7 +186,7 @@
LOCAL_SRC_FILES := $(perf_src_files)
-LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf
+LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf libgccdemangle
LOCAL_LDLIBS := -lpthread -ldl
@@ -209,8 +207,7 @@
# for __used
LOCAL_CFLAGS += -include $(LOCAL_PATH)/util/include/linux/compiler.h
-# temporary until bfd.h is added
-LOCAL_CFLAGS += -DNO_DEMANGLE
+LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
# unique
LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
@@ -240,7 +237,7 @@
bench/sched-pipe.c \
arch/arm/util/dwarf-regs.c
-LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf
+LOCAL_STATIC_LIBRARIES := libperf libdwfl libdw libebl libelf libgccdemangle
LOCAL_SHARED_LIBRARIES := libdl
@@ -256,8 +253,7 @@
# for various GNU extensions
LOCAL_CFLAGS += -include external/elfutils/bionic-fixup/AndroidFixup.h
-# temporary until bfd.h is added
-LOCAL_CFLAGS += -DNO_DEMANGLE
+LOCAL_CFLAGS += -DHAVE_ANDROID_DEMANGLE
# unique
LOCAL_CFLAGS += -DPERF_HTML_PATH='""'
diff --git a/util/symbol.h b/util/symbol.h
index 5ac01c1..266bb00 100644
--- a/util/symbol.h
+++ b/util/symbol.h
@@ -36,10 +36,23 @@
{
return NULL;
}
+/* ANDROID_CHANGE_BEGIN */
+#else
+#ifdef HAVE_ANDROID_DEMANGLE
+/* in external/gcc-demangle */
+extern char *__cxa_demangle (const char *, char *, size_t *, int *);
+
+static inline char *bfd_demangle(void __used *v, const char __used *c,
+ int __used i)
+{
+ return __cxa_demangle(c, NULL, NULL, NULL);
+}
+/* ANDROID_CHANGE_END */
#else
#include <bfd.h>
#endif
#endif
+#endif
int hex2u64(const char *ptr, u64 *val);
char *strxfrchar(char *s, char from, char to);