summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-04-28 02:14:51 -0500
committerWilliam Pitcock <nenolod@dereferenced.org>2011-04-28 02:16:20 -0500
commit22e8167842c2a28e0c5d400da55eb3a6da1462a3 (patch)
tree2883a730dcd0dbc5c60b45d3409aaad40239a915
parent480b609b697017fa190342849251204f6b9f635a (diff)
downloadaports-22e8167842c2a28e0c5d400da55eb3a6da1462a3.tar.bz2
aports-22e8167842c2a28e0c5d400da55eb3a6da1462a3.tar.xz
main/libc0.9.32: add libubacktrace support on all architectures (arm, powerpc, x86, x86_64).
fix #565
-rw-r--r--main/libc0.9.32/APKBUILD14
-rw-r--r--main/libc0.9.32/uclibc-generic-backtrace.patch262
-rw-r--r--main/libc0.9.32/uclibcconfig.arm1
-rw-r--r--main/libc0.9.32/uclibcconfig.powerpc1
-rw-r--r--main/libc0.9.32/uclibcconfig.x861
-rw-r--r--main/libc0.9.32/uclibcconfig.x86_641
6 files changed, 274 insertions, 6 deletions
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index 524f08aa2..928c71291 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -4,7 +4,7 @@ pkgname=libc$_abiver
_gitver=
pkgver=0.9.32_rc3
_ver=${pkgver/_/-}
-pkgrel=9
+pkgrel=10
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -31,6 +31,7 @@ source="http://uclibc.org/downloads/uClibc-${_ver}.tar.bz2
0001-resolv-fix-res_close-not-to-hang-with-ipv6.patch
0001-utils-ldd-Check-for-returned-pointer-from-strrchr-no.patch
0001-posix_fadvise64-fix-x86-implementation.patch
+ uclibc-generic-backtrace.patch
uclibcconfig.x86
uclibcconfig.x86_64
uclibcconfig.i486
@@ -135,9 +136,10 @@ b4fb68ad3d0e8331b1b40c30eb21dfdc 0002-stdlib-fix-arc4random-return-type-to-u_in
2ab8c375fe1cd406319b4c5ef538da2b 0001-resolv-fix-res_close-not-to-hang-with-ipv6.patch
12f6297249755d3996918485bbd6031d 0001-utils-ldd-Check-for-returned-pointer-from-strrchr-no.patch
100d026c2d7cf7fc5906229448c791d4 0001-posix_fadvise64-fix-x86-implementation.patch
-b878bcfe02bf7a886ca85620fb330f56 uclibcconfig.x86
-8048c16964e93d5971b8dff6726d5afa uclibcconfig.x86_64
-b878bcfe02bf7a886ca85620fb330f56 uclibcconfig.i486
-92d2b7918dbecf1b7a3542ba9d4f7162 uclibcconfig.arm
-cce29d6e7890b7d0bab2b67c809173a3 uclibcconfig.powerpc
+871956085df0bf90f4054e294a3770ce uclibc-generic-backtrace.patch
+35ef159d3c56ad67f520ab033e0f6930 uclibcconfig.x86
+a0b00fb82825f91671b76b1d8f979944 uclibcconfig.x86_64
+35ef159d3c56ad67f520ab033e0f6930 uclibcconfig.i486
+9c4708d6d5868c2a24f46959eb0be1c7 uclibcconfig.arm
+f37b8efb311aadf2084dbd25f8b09b07 uclibcconfig.powerpc
7bf1af84106de9e05160ed6d4853c54f sha512-crypt.patch"
diff --git a/main/libc0.9.32/uclibc-generic-backtrace.patch b/main/libc0.9.32/uclibc-generic-backtrace.patch
new file mode 100644
index 000000000..13281a949
--- /dev/null
+++ b/main/libc0.9.32/uclibc-generic-backtrace.patch
@@ -0,0 +1,262 @@
+From 7b5b79f09f0bffe1fccda00d4c5cdf7a7be45413 Mon Sep 17 00:00:00 2001
+From: Carmelo Amoroso <carmelo.amoroso@st.com>
+Date: Fri, 22 Apr 2011 10:55:43 +0000
+Subject: libubacktrace: generic implementation based dwarf
+
+Use the initial implementation for SH4 based on dwarf for all archs.
+Indeed there are not obvious reason for which it should not work in general.
+
+Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
+---
+diff --git a/libubacktrace/Makefile.in b/libubacktrace/Makefile.in
+index c1dd5d7..fac684e 100644
+--- a/libubacktrace/Makefile.in
++++ b/libubacktrace/Makefile.in
+@@ -18,29 +18,16 @@ libubacktrace_FULL_NAME := libubacktrace-$(VERSION).so
+
+ libubacktrace_DIR := $(top_srcdir)libubacktrace
+ libubacktrace_OUT := $(top_builddir)libubacktrace
+-libubacktrace_ARCH_DIR := $(libubacktrace_DIR)/sysdeps/$(TARGET_ARCH)
+-libubacktrace_ARCH_OUT := $(libubacktrace_OUT)/sysdeps/$(TARGET_ARCH)
+-
+--include $(libubacktrace_ARCH_DIR)/Makefile.arch
+
+ libubacktrace_SRC-y :=
+ libubacktrace_SRC-$(UCLIBC_HAS_BACKTRACE) := backtrace.c backtracesyms.c backtracesymsfd.c
+
+-CFLAGS-libubacktrace/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-libubacktrace)
+-
+-# remove generic sources, if arch specific version is present
+-ifneq ($(strip $(libubacktrace_ARCH_SRC-y)),)
+-libubacktrace_SRC-y := $(filter-out $(notdir $(libubacktrace_ARCH_SRC-y)),$(libubacktrace_SRC-y))
+-libubacktrace_ARCH_SRC := $(addprefix $(libubacktrace_ARCH_DIR)/,$(libubacktrace_ARCH_SRC-y))
+-libubacktrace_ARCH_OBJ := $(patsubst $(libubacktrace_ARCH_DIR)/%.c,$(libubacktrace_ARCH_OUT)/%.o,$(libubacktrace_ARCH_SRC))
+-endif
+-
++# -fexections is required for backtrace to work using dwarf2
++CFLAGS-backtrace.c := -fexceptions
+
+-libubacktrace_SRC := $(addprefix $(libubacktrace_DIR)/,$(libubacktrace_SRC-y))
+-libubacktrace_OBJ := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRC))
+
+-libubacktrace_SRCS := $(libubacktrace_SRC) $(libubacktrace_ARCH_SRC)
+-libubacktrace_OBJS := $(libubacktrace_OBJ) $(libubacktrace_ARCH_OBJ)
++libubacktrace_SRCS := $(addprefix $(libubacktrace_DIR)/,$(libubacktrace_SRC-y))
++libubacktrace_OBJS := $(patsubst $(libubacktrace_DIR)/%.c,$(libubacktrace_OUT)/%.o,$(libubacktrace_SRCS))
+
+ ifeq ($(DOPIC),y)
+ libubacktrace-a-y := $(libubacktrace_OBJS:.o=.os)
+diff --git a/libubacktrace/backtrace.c b/libubacktrace/backtrace.c
+index 8721800..18b91b1 100644
+--- a/libubacktrace/backtrace.c
++++ b/libubacktrace/backtrace.c
+@@ -4,16 +4,81 @@
+ * User application that wants to use backtrace needs to be
+ * compiled with -fexceptions option and -rdynamic to get full
+ * symbols printed.
+-
+- * Copyright (C) 2010 STMicroelectronics Ltd
++ *
++ * Copyright (C) 2009, 2010 STMicroelectronics Ltd.
++ *
++ * Author(s): Giuseppe Cavallaro <peppe.cavallaro@st.com>
++ * - Initial implementation for glibc
++ *
+ * Author(s): Carmelo Amoroso <carmelo.amoroso@st.com>
++ * - Reworked for uClibc
++ * - use dlsym/dlopen from libdl
++ * - rewrite initialisation to not use libc_once
++ * - make it available in static link too
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ */
+-#error "Arch specific implementation must be provided to properly work"
+-int backtrace (void **array, int size)
++
++#include <execinfo.h>
++#include <dlfcn.h>
++#include <stdlib.h>
++#include <unwind.h>
++#include <assert.h>
++#include <stdio.h>
++
++struct trace_arg
+ {
+- return -1;
++ void **array;
++ int cnt, size;
++};
++
++static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
++static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
++
++static void backtrace_init (void)
++{
++ void *handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
++
++ if (handle == NULL
++ || ((unwind_backtrace = dlsym (handle, "_Unwind_Backtrace")) == NULL)
++ || ((unwind_getip = dlsym (handle, "_Unwind_GetIP")) == NULL)) {
++ printf("libgcc_s.so.1 must be installed for backtrace to work\n");
++ abort();
++ }
+ }
+
++static _Unwind_Reason_Code
++backtrace_helper (struct _Unwind_Context *ctx, void *a)
++{
++ struct trace_arg *arg = a;
++
++ assert (unwind_getip != NULL);
++
++ /* We are first called with address in the __backtrace function. Skip it. */
++ if (arg->cnt != -1)
++ arg->array[arg->cnt] = (void *) unwind_getip (ctx);
++ if (++arg->cnt == arg->size)
++ return _URC_END_OF_STACK;
++ return _URC_NO_REASON;
++}
++
++/*
++ * Perform stack unwinding by using the _Unwind_Backtrace.
++ *
++ * User application that wants to use backtrace needs to be
++ * compiled with -fexceptions option and -rdynamic to get full
++ * symbols printed.
++ */
++int backtrace (void **array, int size)
++{
++ struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
++
++ if (unwind_backtrace == NULL)
++ backtrace_init();
++
++ if (size >= 1)
++ unwind_backtrace (backtrace_helper, &arg);
++
++ return arg.cnt != -1 ? arg.cnt : 0;
++}
+diff --git a/libubacktrace/sysdeps/sh/Makefile.arch b/libubacktrace/sysdeps/sh/Makefile.arch
+deleted file mode 100644
+index 9b0de38..0000000
+--- a/libubacktrace/sysdeps/sh/Makefile.arch
++++ b/dev/null
+@@ -1,12 +0,0 @@
+-# Makefile for uClibc (sh/libubacktrace)
+-#
+-# Copyright (C) 2010 STMicroelectronics Ltd
+-# Author: Carmelo Amoroso <carmelo.amoroso@st.com>
+-
+-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+-#
+-
+-libubacktrace_ARCH_SRC-y := backtrace.c
+-
+-# -fexections is required for backtrace to work using dwarf2
+-CFLAGS-backtrace.c := -fexceptions
+diff --git a/libubacktrace/sysdeps/sh/backtrace.c b/libubacktrace/sysdeps/sh/backtrace.c
+deleted file mode 100644
+index 18b91b1..0000000
+--- a/libubacktrace/sysdeps/sh/backtrace.c
++++ b/dev/null
+@@ -1,84 +0,0 @@
+-/*
+- * Perform stack unwinding by using the _Unwind_Backtrace.
+- *
+- * User application that wants to use backtrace needs to be
+- * compiled with -fexceptions option and -rdynamic to get full
+- * symbols printed.
+- *
+- * Copyright (C) 2009, 2010 STMicroelectronics Ltd.
+- *
+- * Author(s): Giuseppe Cavallaro <peppe.cavallaro@st.com>
+- * - Initial implementation for glibc
+- *
+- * Author(s): Carmelo Amoroso <carmelo.amoroso@st.com>
+- * - Reworked for uClibc
+- * - use dlsym/dlopen from libdl
+- * - rewrite initialisation to not use libc_once
+- * - make it available in static link too
+- *
+- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+- *
+- */
+-
+-#include <execinfo.h>
+-#include <dlfcn.h>
+-#include <stdlib.h>
+-#include <unwind.h>
+-#include <assert.h>
+-#include <stdio.h>
+-
+-struct trace_arg
+-{
+- void **array;
+- int cnt, size;
+-};
+-
+-static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
+-static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
+-
+-static void backtrace_init (void)
+-{
+- void *handle = dlopen ("libgcc_s.so.1", RTLD_LAZY);
+-
+- if (handle == NULL
+- || ((unwind_backtrace = dlsym (handle, "_Unwind_Backtrace")) == NULL)
+- || ((unwind_getip = dlsym (handle, "_Unwind_GetIP")) == NULL)) {
+- printf("libgcc_s.so.1 must be installed for backtrace to work\n");
+- abort();
+- }
+-}
+-
+-static _Unwind_Reason_Code
+-backtrace_helper (struct _Unwind_Context *ctx, void *a)
+-{
+- struct trace_arg *arg = a;
+-
+- assert (unwind_getip != NULL);
+-
+- /* We are first called with address in the __backtrace function. Skip it. */
+- if (arg->cnt != -1)
+- arg->array[arg->cnt] = (void *) unwind_getip (ctx);
+- if (++arg->cnt == arg->size)
+- return _URC_END_OF_STACK;
+- return _URC_NO_REASON;
+-}
+-
+-/*
+- * Perform stack unwinding by using the _Unwind_Backtrace.
+- *
+- * User application that wants to use backtrace needs to be
+- * compiled with -fexceptions option and -rdynamic to get full
+- * symbols printed.
+- */
+-int backtrace (void **array, int size)
+-{
+- struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
+-
+- if (unwind_backtrace == NULL)
+- backtrace_init();
+-
+- if (size >= 1)
+- unwind_backtrace (backtrace_helper, &arg);
+-
+- return arg.cnt != -1 ? arg.cnt : 0;
+-}
+--
+cgit v0.8.2.1
+
+Fix up config file reference.
+--- uClibc-0.9.32-rc3.orig/extra/Configs/Config.in
++++ uClibc-0.9.32-rc3/extra/Configs/Config.in
+@@ -2322,7 +2322,7 @@
+
+ config UCLIBC_HAS_BACKTRACE
+ bool "Add support for application self-debugging"
+- depends on HAVE_SHARED && TARGET_sh
++ depends on HAVE_SHARED
+ default n
+ help
+ Answer Y here to compile support for application self-debugging, by adding
diff --git a/main/libc0.9.32/uclibcconfig.arm b/main/libc0.9.32/uclibcconfig.arm
index 87f764e15..09897ab54 100644
--- a/main/libc0.9.32/uclibcconfig.arm
+++ b/main/libc0.9.32/uclibcconfig.arm
@@ -259,6 +259,7 @@ DOSTRIP=y
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+UCLIBC_HAS_BACKTRACE=y
WARNINGS="-Wall"
EXTRA_WARNINGS=y
# DOMULTI is not set
diff --git a/main/libc0.9.32/uclibcconfig.powerpc b/main/libc0.9.32/uclibcconfig.powerpc
index 3dc2cc48a..e0597ae5a 100644
--- a/main/libc0.9.32/uclibcconfig.powerpc
+++ b/main/libc0.9.32/uclibcconfig.powerpc
@@ -243,6 +243,7 @@ DOSTRIP=y
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+UCLIBC_HAS_BACKTRACE=y
WARNINGS="-Wall"
EXTRA_WARNINGS=y
# DOMULTI is not set
diff --git a/main/libc0.9.32/uclibcconfig.x86 b/main/libc0.9.32/uclibcconfig.x86
index 89e1a1254..510759e50 100644
--- a/main/libc0.9.32/uclibcconfig.x86
+++ b/main/libc0.9.32/uclibcconfig.x86
@@ -258,6 +258,7 @@ DOSTRIP=y
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+UCLIBC_HAS_BACKTRACE=y
WARNINGS="-Wall"
EXTRA_WARNINGS=y
# DOMULTI is not set
diff --git a/main/libc0.9.32/uclibcconfig.x86_64 b/main/libc0.9.32/uclibcconfig.x86_64
index 74ba226d4..e218fc0f5 100644
--- a/main/libc0.9.32/uclibcconfig.x86_64
+++ b/main/libc0.9.32/uclibcconfig.x86_64
@@ -240,6 +240,7 @@ DOSTRIP=y
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+UCLIBC_HAS_BACKTRACE=y
WARNINGS="-Wall"
EXTRA_WARNINGS=y
# DOMULTI is not set