diff options
Diffstat (limited to 'meta/recipes-support/libunwind')
14 files changed, 248 insertions, 434 deletions
diff --git a/meta/recipes-support/libunwind/libunwind.inc b/meta/recipes-support/libunwind/libunwind.inc deleted file mode 100644 index 36851d07ed..0000000000 --- a/meta/recipes-support/libunwind/libunwind.inc +++ /dev/null @@ -1,21 +0,0 @@ -SUMMARY = "Library for obtaining the call-chain of a program" -DESCRIPTION = "a portable and efficient C programming interface (API) to determine the call-chain of a program" -HOMEPAGE = "http://www.nongnu.org/libunwind" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://COPYING;beginline=3;md5=3fced11d6df719b47505837a51c16ae5" -DEPENDS += "libatomic-ops" - -inherit autotools multilib_header - -PACKAGECONFIG ??= "" -PACKAGECONFIG[lzma] = "--enable-minidebuginfo,--disable-minidebuginfo,xz" -PACKAGECONFIG[latexdocs] = "--enable-documentation, --disable-documentation, latex2man-native" - -EXTRA_OECONF_arm = "--enable-debug-frame" -EXTRA_OECONF_aarch64 = "--enable-debug-frame" - -do_install_append () { - oe_multilib_header libunwind.h -} - -BBCLASSEXTEND = "native" diff --git a/meta/recipes-support/libunwind/libunwind/0001-Fix-build-on-mips-musl.patch b/meta/recipes-support/libunwind/libunwind/0001-Fix-build-on-mips-musl.patch deleted file mode 100644 index 8bcc252bad..0000000000 --- a/meta/recipes-support/libunwind/libunwind/0001-Fix-build-on-mips-musl.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e623c7703945a5eb6c9a30586ec5e23b2f7396f6 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 23 Mar 2016 06:08:59 +0000 -Subject: [PATCH] Fix build on mips/musl - -Do not include endian.h on musl it includes -further headers which can not be compiled in __ASSEMBLER__ - mode - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - src/coredump/_UCD_internal.h | 34 ++++++++++++++++++++++++++++++++++ - src/mips/getcontext.S | 3 +-- - 2 files changed, 35 insertions(+), 2 deletions(-) - -Index: git/src/coredump/_UCD_internal.h -=================================================================== ---- git.orig/src/coredump/_UCD_internal.h -+++ git/src/coredump/_UCD_internal.h -@@ -44,6 +44,41 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE - - #include "libunwind_i.h" - -+#ifndef __GLIBC__ -+#include <sys/reg.h> -+ -+#define EF_REG0 6 -+#define EF_REG1 7 -+#define EF_REG2 8 -+#define EF_REG3 9 -+#define EF_REG4 10 -+#define EF_REG5 11 -+#define EF_REG6 12 -+#define EF_REG7 13 -+#define EF_REG8 14 -+#define EF_REG9 15 -+#define EF_REG10 16 -+#define EF_REG11 17 -+#define EF_REG12 18 -+#define EF_REG13 19 -+#define EF_REG14 20 -+#define EF_REG15 21 -+#define EF_REG16 22 -+#define EF_REG17 23 -+#define EF_REG18 24 -+#define EF_REG19 25 -+#define EF_REG20 26 -+#define EF_REG21 27 -+#define EF_REG22 28 -+#define EF_REG23 29 -+#define EF_REG24 30 -+#define EF_REG25 31 -+#define EF_REG28 34 -+#define EF_REG29 35 -+#define EF_REG30 36 -+#define EF_REG31 37 -+#endif -+ - - #if SIZEOF_OFF_T == 4 - typedef uint32_t uoff_t; -Index: git/src/mips/getcontext.S -=================================================================== ---- git.orig/src/mips/getcontext.S -+++ git/src/mips/getcontext.S -@@ -24,12 +24,11 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - #include "offsets.h" --#include <endian.h> - - .text - - #if _MIPS_SIM == _ABIO32 --# if __BYTE_ORDER == __BIG_ENDIAN -+# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - # define OFFSET 4 - # else - # define OFFSET 0 diff --git a/meta/recipes-support/libunwind/libunwind/0001-add-knobs-to-disable-enable-tests.patch b/meta/recipes-support/libunwind/libunwind/0001-add-knobs-to-disable-enable-tests.patch deleted file mode 100644 index 673a5bb995..0000000000 --- a/meta/recipes-support/libunwind/libunwind/0001-add-knobs-to-disable-enable-tests.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 459e471fcc33d300f7bbcdaf3e0dc338d9dc15b9 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sat, 30 Apr 2016 16:56:34 +0000 -Subject: [PATCH] add knobs to disable/enable tests - -Some tests do not compile on musl libc -in general its good to have such a knob -since not all builds may want to enable -tests - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 6 +++++- - configure.ac | 12 ++++++++++-- - 2 files changed, 15 insertions(+), 3 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 6a3ed9e..0c29b3e 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -42,7 +42,11 @@ endif - - nodist_include_HEADERS = include/libunwind-common.h - --SUBDIRS = src tests -+SUBDIRS = src -+ -+if CONFIG_TESTS -+SUBDIRS += tests -+endif - - if CONFIG_DOCS - SUBDIRS += doc -diff --git a/configure.ac b/configure.ac -index 85d78f8..d362387 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -129,6 +129,10 @@ AC_ARG_ENABLE(documentation, - AS_HELP_STRING([--disable-documentation],[Disable generating the man pages]),, - [enable_documentation=yes]) - -+AC_ARG_ENABLE(tests, -+ AS_HELP_STRING([--disable-tests],[Disable building tests]),, -+ [enable_tests=yes]) -+ - AC_MSG_CHECKING([if we should build libunwind-setjmp]) - AC_MSG_RESULT([$enable_setjmp]) - -@@ -395,9 +399,13 @@ AM_CONDITIONAL([CONFIG_DOCS], [test x$enable_documentation = xyes]) - if test "x$enable_documentation" = "xyes"; then - AC_CONFIG_FILES(doc/Makefile doc/common.tex) - fi -+AM_CONDITIONAL([CONFIG_TESTS], [test x$enable_tests = xyes]) -+if test "x$enable_tests" = "xyes"; then -+ AC_CONFIG_FILES(tests/Makefile tests/check-namespace.sh) -+fi -+ - --AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile tests/check-namespace.sh -- include/libunwind-common.h -+AC_CONFIG_FILES(Makefile src/Makefile include/libunwind-common.h - include/libunwind.h include/tdep/libunwind_i.h) - AC_CONFIG_FILES(src/unwind/libunwind.pc src/coredump/libunwind-coredump.pc - src/ptrace/libunwind-ptrace.pc src/setjmp/libunwind-setjmp.pc --- -1.8.3.1 - diff --git a/meta/recipes-support/libunwind/libunwind/0001-backtrace-Use-only-with-glibc-and-uclibc.patch b/meta/recipes-support/libunwind/libunwind/0001-backtrace-Use-only-with-glibc-and-uclibc.patch deleted file mode 100644 index 9aed419a12..0000000000 --- a/meta/recipes-support/libunwind/libunwind/0001-backtrace-Use-only-with-glibc-and-uclibc.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 04437142399662b576bd55a85485c6dcc14d0812 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 31 Dec 2015 06:44:07 +0000 -Subject: [PATCH] backtrace: Use only with glibc and uclibc - -backtrace API is glibc specific not linux specific -so make it behave so. - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - tests/test-coredump-unwind.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c -index 5254708..8767b42 100644 ---- a/tests/test-coredump-unwind.c -+++ b/tests/test-coredump-unwind.c -@@ -57,7 +57,9 @@ - #include <grp.h> - - /* For SIGSEGV handler code */ -+#ifdef __GLIBC__ - #include <execinfo.h> -+#endif - #include <sys/ucontext.h> - - #include <libunwind-coredump.h> -@@ -238,11 +240,11 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext) - ip); - - { -+#ifdef __GLIBC__ - /* glibc extension */ - void *array[50]; - int size; - size = backtrace(array, 50); --#ifdef __linux__ - backtrace_symbols_fd(array, size, 2); - #endif - } --- -2.6.4 - diff --git a/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch b/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch new file mode 100644 index 0000000000..5840c2b4f6 --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind/0001-src-Gtrace-remove-unguarded-print-calls.patch @@ -0,0 +1,52 @@ +From 9b27fa9bcd5cadd4c841c42710f41a090377e531 Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@arm.com> +Date: Fri, 24 Mar 2023 16:18:44 +0000 +Subject: [PATCH] src/Gtrace: remove unguarded print() calls + +There is a use of printf() without #include stdio.h in src/arm/Gtrace.c, +which results in a compiler error if clang 16 is used: + +src/arm/Gtrace.c:529:7: error: call to undeclared library function +'printf' with type 'int (const char *, ...)'; ISO C99 and later do not +support implicit function declarations [-Wimplicit-function-declaration] + +Replace the printf("XXX") with a Dprintf, so it doesn't pull stdio in +unless in a debug build, and reword the message to be clearer. + +Also there is another printf("XXX") inside a FreeBSD-specific block in +the UNW_ARM_FRAME_SIGRETURN case, replace this with a #error as the code +needs to be implemented. + +Fixes #482. + +Upstream-Status: Backport [9b27fa9bcd5cadd4c841c42710f41a090377e531] +Signed-off-by: Ross Burton <ross.burton@arm.com> +--- + src/arm/Gtrace.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/arm/Gtrace.c b/src/arm/Gtrace.c +index 51fc281d..9e0f25af 100644 +--- a/src/arm/Gtrace.c ++++ b/src/arm/Gtrace.c +@@ -514,7 +514,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) + if (likely(ret >= 0)) + ACCESS_MEM_FAST(ret, c->validate, d, cfa + LINUX_SC_LR_OFF, lr); + #elif defined(__FreeBSD__) +- printf("XXX\n"); ++ #error implement UNW_ARM_FRAME_SIGRETURN on FreeBSD + #endif + + /* Resume stack at signal restoration point. The stack is not +@@ -526,7 +526,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) + break; + + case UNW_ARM_FRAME_SYSCALL: +- printf("XXX1\n"); ++ Dprintf ("%s: implement me\n", __FUNCTION__); + break; + + default: +-- +2.34.1 + diff --git a/meta/recipes-support/libunwind/libunwind/0001-x86-Stub-out-x86_local_resume.patch b/meta/recipes-support/libunwind/libunwind/0001-x86-Stub-out-x86_local_resume.patch deleted file mode 100644 index 371013aaaa..0000000000 --- a/meta/recipes-support/libunwind/libunwind/0001-x86-Stub-out-x86_local_resume.patch +++ /dev/null @@ -1,54 +0,0 @@ -From f5df01655a4b76d4fe415747de581d94ac593e6a Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 22 Mar 2016 16:19:29 +0000 -Subject: [PATCH] x86: Stub out x86_local_resume() - -its purpose seems -to be unwinding across signal handler boundaries, which cannot happen -in correct programs anyway. Replacing the whole function with -something like *(volatile char *)0=0; (i.e. crash), gets a working -libunwind - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - src/x86/Gos-linux.c | 22 +--------------------- - 1 file changed, 1 insertion(+), 21 deletions(-) - -diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c -index 31f83ba..3aaa34e 100644 ---- a/src/x86/Gos-linux.c -+++ b/src/x86/Gos-linux.c -@@ -281,27 +281,7 @@ x86_r_uc_addr (ucontext_t *uc, int reg) - HIDDEN int - x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) - { -- struct cursor *c = (struct cursor *) cursor; -- ucontext_t *uc = c->uc; -- -- /* Ensure c->pi is up-to-date. On x86, it's relatively common to be -- missing DWARF unwind info. We don't want to fail in that case, -- because the frame-chain still would let us do a backtrace at -- least. */ -- dwarf_make_proc_info (&c->dwarf); -- -- if (unlikely (c->sigcontext_format != X86_SCF_NONE)) -- { -- struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; -- -- Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); -- sigreturn (sc); -- } -- else -- { -- Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); -- setcontext (uc); -- } -+ *(volatile char *)0=0; - return -UNW_EINVAL; - } - #endif --- -1.8.3.1 - diff --git a/meta/recipes-support/libunwind/libunwind/0001-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch b/meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch index ca0641f5ac..e58a71b741 100644 --- a/meta/recipes-support/libunwind/libunwind/0001-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch +++ b/meta/recipes-support/libunwind/libunwind/0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch @@ -1,7 +1,9 @@ -From e0eea53c77fce8537c58a072b684043507987bcc Mon Sep 17 00:00:00 2001 +From 24c751f9d21e892a9833e1b70a696b07872b0f7f Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 9 Jul 2016 01:07:53 +0000 -Subject: [PATCH] ppc32: Consider ucontext mismatches between glibc and musl +Subject: [PATCH] ppc32: Consider ucontext mismatches between glibc and + + musl This helps in porting libunwind onto musl based systems ptrace.h change is required again an error that surfaces @@ -18,17 +20,17 @@ In file included from /mnt/oe/openembedded-core/build/tmp-musl/sysroots/qemuppc/ struct pt_regs { ^~~~~~~ -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- src/ppc32/Ginit.c | 6 +- - src/ppc32/ucontext_i.h | 158 ++++++++++++++++++++++--------------------- + src/ppc32/ucontext_i.h | 158 ++++++++++++++++++----------------- src/ptrace/_UPT_reg_offset.c | 7 ++ 3 files changed, 92 insertions(+), 79 deletions(-) diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c -index f2e6e82..617aaa1 100644 +index 7b45455..f8d6886 100644 --- a/src/ppc32/Ginit.c +++ b/src/ppc32/Ginit.c @@ -48,12 +48,12 @@ uc_addr (ucontext_t *uc, int reg) @@ -226,7 +228,7 @@ index c6ba806..b79f15c 100644 #endif diff --git a/src/ptrace/_UPT_reg_offset.c b/src/ptrace/_UPT_reg_offset.c -index 68461a2..fcc43f7 100644 +index b7dd3b7..bfaf756 100644 --- a/src/ptrace/_UPT_reg_offset.c +++ b/src/ptrace/_UPT_reg_offset.c @@ -27,6 +27,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @@ -241,8 +243,5 @@ index 68461a2..fcc43f7 100644 +# undef pt_regs +#endif - #ifdef HAVE_ASM_PTRACE_OFFSETS_H - # include <asm/ptrace_offsets.h> --- -1.8.3.1 - + #ifdef HAVE_ASM_PTRACE_H + # include <asm/ptrace.h> diff --git a/meta/recipes-support/libunwind/libunwind/Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch b/meta/recipes-support/libunwind/libunwind/Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch deleted file mode 100644 index c8faca4724..0000000000 --- a/meta/recipes-support/libunwind/libunwind/Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 24484e80b3e329c9edee1995e102f8612eedb79c Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> -Date: Tue, 13 May 2014 23:32:27 +0200 -Subject: [PATCH] Add AO_REQUIRE_CAS to fix build on ARM < v6 - -ARM earlier than ARMv6, such as ARMv4 and ARMv5 do not provide -optimize atomic operations in libatomic_ops. Since libunwind is using -such operations, it should define AO_REQUIRE_CAS before including -<atomic_ops.h> so that libatomic_ops knows it should use emulated -atomic operations instead (even though they are obviously a lot more -expensive). - -Also, while real atomic operations are all inline functions and -therefore linking against libatomic_ops was not required, the emulated -atomic operations actually require linking against libatomic_ops, so -the commented AC_CHECK_LIB test in acinclude.m4 is uncommented to make -sure we link against libatomic_ops. - -Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> -Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> - -Upstream-Status: Pending -Taken from: -https://raw.githubusercontent.com/rdnetto/teapot-buildroot/master/package/libunwind/libunwind-02-Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch - ---- - acinclude.m4 | 8 +------- - include/libunwind_i.h | 1 + - 2 files changed, 2 insertions(+), 7 deletions(-) - -Index: libunwind-1.2.1/acinclude.m4 -=================================================================== ---- libunwind-1.2.1.orig/acinclude.m4 -+++ libunwind-1.2.1/acinclude.m4 -@@ -22,11 +22,5 @@ fi]) - AC_DEFUN([CHECK_ATOMIC_OPS], - [dnl Check whether the system has the atomic_ops package installed. - AC_CHECK_HEADERS(atomic_ops.h) --# --# Don't link against libatomic_ops for now. We don't want libunwind --# to depend on libatomic_ops.so. Fortunately, none of the platforms --# we care about so far need libatomic_ops.a (everything is done via --# inline macros). --# --# AC_CHECK_LIB(atomic_ops, main) -+ AC_CHECK_LIB(atomic_ops, main) - ]) -Index: libunwind-1.2.1/include/libunwind_i.h -=================================================================== ---- libunwind-1.2.1.orig/include/libunwind_i.h -+++ libunwind-1.2.1/include/libunwind_i.h -@@ -116,6 +116,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE - (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0) - - #ifdef HAVE_ATOMIC_OPS_H -+# define AO_REQUIRE_CAS - # include <atomic_ops.h> - static inline int - cmpxchg_ptr (void *addr, void *old, void *new) diff --git a/meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch b/meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch deleted file mode 100644 index 32516464cd..0000000000 --- a/meta/recipes-support/libunwind/libunwind/libunwind-1.1-x32.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 506bd37bd580d7382d7c58257dac4b1e502a887c Mon Sep 17 00:00:00 2001 -From: Christopher Larson <chris_larson@mentor.com> -Date: Tue, 13 Dec 2016 09:50:34 -0700 -Subject: [PATCH] Fix for X32 - -Apply patch to fix the X32 build from https://github.com/sjnewbury/x32. - -Upstream-Status: Pending -Signed-off-by: Christopher Larson <chris_larson@mentor.com> ---- - src/x86_64/Gos-linux.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/x86_64/Gos-linux.c b/src/x86_64/Gos-linux.c -index 9e1acfc..8169d5a 100644 ---- a/src/x86_64/Gos-linux.c -+++ b/src/x86_64/Gos-linux.c -@@ -143,8 +143,8 @@ x86_64_sigreturn (unw_cursor_t *cursor) - - Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", - (unsigned long long) c->dwarf.ip, sc); -- __asm__ __volatile__ ("mov %0, %%rsp;" -- "mov %1, %%rax;" -+ __asm__ __volatile__ ("mov %q0, %%rsp;" -+ "mov %q1, %%rax;" - "syscall" - :: "r"(sc), "i"(SYS_rt_sigreturn) - : "memory"); --- -2.8.0 - diff --git a/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch b/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch new file mode 100644 index 0000000000..8848780fd1 --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind/mips-byte-order.patch @@ -0,0 +1,35 @@ +From dbbf8110ed3fd2cbac20a8ec2ac769e13c67bab1 Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@arm.com> +Date: Tue, 16 Jan 2024 18:22:38 +0000 +Subject: [PATCH 2/2] byte order + +endian.h on musl/mips can't be included in __ASSEMBLER__ mode, +so use the __BYTE_ORDER__ symbol instead. + +Upstream-Status: Pending +Signed-off-by: Ross Burton <ross.burton@arm.com> +--- + src/mips/getcontext.S | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/mips/getcontext.S b/src/mips/getcontext.S +index d1dbd579..de9b6818 100644 +--- a/src/mips/getcontext.S ++++ b/src/mips/getcontext.S +@@ -24,12 +24,11 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + #include "offsets.h" +-#include <endian.h> + + .text + + #if _MIPS_SIM == _ABIO32 +-# if __BYTE_ORDER == __BIG_ENDIAN ++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + # define OFFSET 4 + # else + # define OFFSET 0 +-- +2.34.1 + diff --git a/meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch b/meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch new file mode 100644 index 0000000000..68adcd1d71 --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind/mips-coredump-register.patch @@ -0,0 +1,100 @@ +From 7750e2a29b084ee033acc82abab410035e220d3f Mon Sep 17 00:00:00 2001 +From: Ross Burton <ross.burton@arm.com> +Date: Tue, 16 Jan 2024 18:21:26 +0000 +Subject: [PATCH 1/2] coredump-mips-register + +glibc and musl have different names for the registers, add a +macro that generates the names appropriately. + +Upstream-Status: Pending +Signed-off-by: Ross Burton <ross.burton@arm.com> + +--- + src/coredump/_UCD_access_reg_linux.c | 69 ++++++++++++++++------------ + 1 file changed, 39 insertions(+), 30 deletions(-) + +diff --git a/src/coredump/_UCD_access_reg_linux.c b/src/coredump/_UCD_access_reg_linux.c +index 27eef123..beefdb47 100644 +--- a/src/coredump/_UCD_access_reg_linux.c ++++ b/src/coredump/_UCD_access_reg_linux.c +@@ -67,38 +67,47 @@ _UCD_access_reg (unw_addr_space_t as, + goto badreg; + #else + #if defined(UNW_TARGET_MIPS) ++ ++/* glibc and musl use different names */ ++#ifdef __GLIBC__ ++#define EF_REG(x) EF_REG ## x ++#else ++#include <sys/reg.h> ++#define EF_REG(x) EF_R ## x ++#endif ++ + static const uint8_t remap_regs[] = + { +- [UNW_MIPS_R0] = EF_REG0, +- [UNW_MIPS_R1] = EF_REG1, +- [UNW_MIPS_R2] = EF_REG2, +- [UNW_MIPS_R3] = EF_REG3, +- [UNW_MIPS_R4] = EF_REG4, +- [UNW_MIPS_R5] = EF_REG5, +- [UNW_MIPS_R6] = EF_REG6, +- [UNW_MIPS_R7] = EF_REG7, +- [UNW_MIPS_R8] = EF_REG8, +- [UNW_MIPS_R9] = EF_REG9, +- [UNW_MIPS_R10] = EF_REG10, +- [UNW_MIPS_R11] = EF_REG11, +- [UNW_MIPS_R12] = EF_REG12, +- [UNW_MIPS_R13] = EF_REG13, +- [UNW_MIPS_R14] = EF_REG14, +- [UNW_MIPS_R15] = EF_REG15, +- [UNW_MIPS_R16] = EF_REG16, +- [UNW_MIPS_R17] = EF_REG17, +- [UNW_MIPS_R18] = EF_REG18, +- [UNW_MIPS_R19] = EF_REG19, +- [UNW_MIPS_R20] = EF_REG20, +- [UNW_MIPS_R21] = EF_REG21, +- [UNW_MIPS_R22] = EF_REG22, +- [UNW_MIPS_R23] = EF_REG23, +- [UNW_MIPS_R24] = EF_REG24, +- [UNW_MIPS_R25] = EF_REG25, +- [UNW_MIPS_R28] = EF_REG28, +- [UNW_MIPS_R29] = EF_REG29, +- [UNW_MIPS_R30] = EF_REG30, +- [UNW_MIPS_R31] = EF_REG31, ++ [UNW_MIPS_R0] = EF_REG(0), ++ [UNW_MIPS_R1] = EF_REG(1), ++ [UNW_MIPS_R2] = EF_REG(2), ++ [UNW_MIPS_R3] = EF_REG(3), ++ [UNW_MIPS_R4] = EF_REG(4), ++ [UNW_MIPS_R5] = EF_REG(5), ++ [UNW_MIPS_R6] = EF_REG(6), ++ [UNW_MIPS_R7] = EF_REG(7), ++ [UNW_MIPS_R8] = EF_REG(8), ++ [UNW_MIPS_R9] = EF_REG(9), ++ [UNW_MIPS_R10] = EF_REG(10), ++ [UNW_MIPS_R11] = EF_REG(11), ++ [UNW_MIPS_R12] = EF_REG(12), ++ [UNW_MIPS_R13] = EF_REG(13), ++ [UNW_MIPS_R14] = EF_REG(14), ++ [UNW_MIPS_R15] = EF_REG(15), ++ [UNW_MIPS_R16] = EF_REG(16), ++ [UNW_MIPS_R17] = EF_REG(17), ++ [UNW_MIPS_R18] = EF_REG(18), ++ [UNW_MIPS_R19] = EF_REG(19), ++ [UNW_MIPS_R20] = EF_REG(20), ++ [UNW_MIPS_R21] = EF_REG(21), ++ [UNW_MIPS_R22] = EF_REG(22), ++ [UNW_MIPS_R23] = EF_REG(23), ++ [UNW_MIPS_R24] = EF_REG(24), ++ [UNW_MIPS_R25] = EF_REG(25), ++ [UNW_MIPS_R28] = EF_REG(28), ++ [UNW_MIPS_R29] = EF_REG(29), ++ [UNW_MIPS_R30] = EF_REG(30), ++ [UNW_MIPS_R31] = EF_REG(31), + [UNW_MIPS_PC] = EF_CP0_EPC, + }; + #elif defined(UNW_TARGET_X86) +-- +2.34.1 + diff --git a/meta/recipes-support/libunwind/libunwind/musl-header-conflict.patch b/meta/recipes-support/libunwind/libunwind/musl-header-conflict.patch deleted file mode 100644 index 79f63fd84e..0000000000 --- a/meta/recipes-support/libunwind/libunwind/musl-header-conflict.patch +++ /dev/null @@ -1,37 +0,0 @@ -If you: - -TCLIBC=musl bitbake unwind -TCLIBC=musl bitbake gcc-runtime -c cleansstate -TCLIBC=musl bitbake gcc-runtime - -you will see libstdc++ fail to build due to finding libunwind's header file. - -Khem: "When we build any of gcc components they expect to use internal version -and that works with glibc based gcc since the search headers first look into gcc -headers, however with musl the gcc headers are searched after the standard -headers ( which is by design the right thing )." - -This patch hacks around the issue by looking for a define used during gcc-runtime's -build and skipping to the internal header in that case. - -[YOCTO #10129] - -RP 2016/8/18 - -Upstream-Status: Inappropriate [really need to fix gcc] - -Index: git/include/unwind.h -=================================================================== ---- git.orig/include/unwind.h -+++ git/include/unwind.h -@@ -23,6 +23,10 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER L - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -+#ifdef _GLIBCXX_SHARED -+#include_next <unwind.h> -+#endif -+ - #ifndef _UNWIND_H - #define _UNWIND_H - diff --git a/meta/recipes-support/libunwind/libunwind_1.2.1.bb b/meta/recipes-support/libunwind/libunwind_1.2.1.bb deleted file mode 100644 index c9239b695e..0000000000 --- a/meta/recipes-support/libunwind/libunwind_1.2.1.bb +++ /dev/null @@ -1,25 +0,0 @@ -require libunwind.inc - -SRC_URI[md5sum] = "06ba9e60d92fd6f55cd9dadb084df19e" -SRC_URI[sha256sum] = "3f3ecb90e28cbe53fba7a4a27ccce7aad188d3210bb1964a923a731a27a75acb" - -SRC_URI = "http://download.savannah.nongnu.org/releases/libunwind/libunwind-${PV}.tar.gz \ - file://Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch \ - file://0001-backtrace-Use-only-with-glibc-and-uclibc.patch \ - file://0001-x86-Stub-out-x86_local_resume.patch \ - file://0001-Fix-build-on-mips-musl.patch \ - file://0001-add-knobs-to-disable-enable-tests.patch \ - file://0001-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \ - file://libunwind-1.1-x32.patch \ - " - -SRC_URI_append_libc-musl = " file://musl-header-conflict.patch" -EXTRA_OECONF_append_libc-musl = " --disable-documentation --disable-tests --enable-static" - -# http://errors.yoctoproject.org/Errors/Details/20487/ -ARM_INSTRUCTION_SET_armv4 = "arm" -ARM_INSTRUCTION_SET_armv5 = "arm" - -LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" - -SECURITY_LDFLAGS_append_libc-musl = " -lssp_nonshared" diff --git a/meta/recipes-support/libunwind/libunwind_1.6.2.bb b/meta/recipes-support/libunwind/libunwind_1.6.2.bb new file mode 100644 index 0000000000..c7b1604b61 --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind_1.6.2.bb @@ -0,0 +1,50 @@ +SUMMARY = "Library for obtaining the call-chain of a program" +DESCRIPTION = "a portable and efficient C programming interface (API) to determine the call-chain of a program" +HOMEPAGE = "http://www.nongnu.org/libunwind" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING;md5=2d80c8ed4062b8339b715f90fa68cc9f" +DEPENDS += "libatomic-ops" +DEPENDS:append:libc-musl = " libucontext" + +SRC_URI = "http://download.savannah.nongnu.org/releases/libunwind/libunwind-${PV}.tar.gz \ + file://mips-byte-order.patch \ + file://mips-coredump-register.patch \ + file://0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \ + file://0001-src-Gtrace-remove-unguarded-print-calls.patch \ + " + +SRC_URI[sha256sum] = "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976" + +inherit autotools multilib_header + +COMPATIBLE_HOST:riscv32 = "null" + +PACKAGECONFIG ??= "" +PACKAGECONFIG[lzma] = "--enable-minidebuginfo,--disable-minidebuginfo,xz" +PACKAGECONFIG[zlib] = "--enable-zlibdebuginfo,--disable-zlibdebuginfo,zlib" +PACKAGECONFIG[latexdocs] = "--enable-documentation, --disable-documentation, latex2man-native" + +EXTRA_OECONF = "--enable-static" + +# http://errors.yoctoproject.org/Errors/Details/20487/ +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" + +LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}" + +SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared" +CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'" + +do_install:append () { + oe_multilib_header libunwind.h +} + +BBCLASSEXTEND = "native" + +# http://errors.yoctoproject.org/Errors/Build/183144/ +# libunwind-1.6.2/include/tdep-aarch64/libunwind_i.h:123:47: error: passing argument 1 of '_ULaarch64_uc_addr' from incompatible pointer type [-Wincompatible-pointer-types] +# libunwind-1.6.2/src/aarch64/Ginit.c:348:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types] +# libunwind-1.6.2/src/aarch64/Ginit.c:377:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types] +# libunwind-1.6.2/src/aarch64/Ginit_local.c:51:9: error: assignment to 'ucontext_t *' from incompatible pointer type 'unw_context_t *' {aka 'unw_tdep_context_t *'} [-Wincompatible-pointer-types] +# libunwind-1.6.2/src/aarch64/Gresume.c:37:28: error: initialization of 'unw_tdep_context_t *' from incompatible pointer type 'ucontext_t *' [-Wincompatible-pointer-types] +CFLAGS += "-Wno-error=incompatible-pointer-types" |