From patchwork Fri Apr 25 11:23:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 61880 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8647CC369D5 for ; Fri, 25 Apr 2025 11:23:58 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4368.1745580235467699845 for ; Fri, 25 Apr 2025 04:23:55 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F53A106F for ; Fri, 25 Apr 2025 04:23:49 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6E0643F59E for ; Fri, 25 Apr 2025 04:23:54 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/3] libunwind: refresh ppc32/musl patch Date: Fri, 25 Apr 2025 12:23:48 +0100 Message-ID: <20250425112350.3626731-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 25 Apr 2025 11:23:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/215454 There was a precedence order problem in the patch so update to the latest version in the pull request. Signed-off-by: Ross Burton --- .../libunwind/0005-Handle-musl-on-PPC32.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch b/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch index 7cad7a5b756..63d3c85de49 100644 --- a/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch +++ b/meta/recipes-support/libunwind/libunwind/0005-Handle-musl-on-PPC32.patch @@ -30,9 +30,9 @@ index 9444cbb8..5e94ed8a 100644 +/* glibc and musl disagree over the layout of this struct */ +#ifdef __GLIBC__ -+#define _UC_MCONTEXT_REGS(x) x->uc_mcontext.uc_regs ++#define _UCONTEXT_UC_REGS(uc) uc->uc_mcontext.uc_regs +#else -+#define _UC_MCONTEXT_REGS(x) x->uc_regs ++#define _UCONTEXT_UC_REGS(uc) uc->uc_regs +#endif + static void * @@ -43,7 +43,7 @@ index 9444cbb8..5e94ed8a 100644 if ((unsigned) (reg - UNW_PPC32_R0) < 32) #if defined(__linux__) - addr = &uc->uc_mcontext.uc_regs->gregs[reg - UNW_PPC32_R0]; -+ addr = _UC_MCONTEXT_REGS(&uc)->gregs[reg - UNW_PPC32_R0]; ++ addr = &_UCONTEXT_UC_REGS(uc)->gregs[reg - UNW_PPC32_R0]; #elif defined(__FreeBSD__) addr = &uc->uc_mcontext.mc_gpr[reg - UNW_PPC32_R0]; #endif @@ -52,7 +52,7 @@ index 9444cbb8..5e94ed8a 100644 ((unsigned) (reg - UNW_PPC32_F0) >= 0) ) #if defined(__linux__) - addr = &uc->uc_mcontext.uc_regs->fpregs.fpregs[reg - UNW_PPC32_F0]; -+ addr = _UC_MCONTEXT_REGS(&uc)->fpregs.fpregs[reg - UNW_PPC32_F0]; ++ addr = &_UCONTEXT_UC_REGS(uc)->fpregs.fpregs[reg - UNW_PPC32_F0]; #elif defined(__FreeBSD__) addr = &uc->uc_mcontext.mc_fpreg[reg - UNW_PPC32_F0]; #endif @@ -61,7 +61,7 @@ index 9444cbb8..5e94ed8a 100644 } #if defined(__linux__) - addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx]; -+ addr = _UC_MCONTEXT_REGS(&uc)->gregs[gregs_idx]; ++ addr = &_UCONTEXT_UC_REGS(uc)->gregs[gregs_idx]; #elif defined(__FreeBSD__) addr = &uc->uc_mcontext.mc_gpr[gregs_idx]; #endif From patchwork Fri Apr 25 11:23:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 61881 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CE21C369D1 for ; Fri, 25 Apr 2025 11:23:58 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.4405.1745580235855761073 for ; Fri, 25 Apr 2025 04:23:56 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 15B851A2D for ; Fri, 25 Apr 2025 04:23:50 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 16D743F59E for ; Fri, 25 Apr 2025 04:23:54 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/3] libunwind: check if libatomic is needed at configure time Date: Fri, 25 Apr 2025 12:23:49 +0100 Message-ID: <20250425112350.3626731-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250425112350.3626731-1-ross.burton@arm.com> References: <20250425112350.3626731-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 25 Apr 2025 11:23:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/215455 Backport a patch submitted upstream to conditionally link explicitly to libatomic, so we don't need to that in the recipe. Signed-off-by: Ross Burton --- .../libunwind/libunwind/libatomic.patch | 38 +++++++++++++++++++ .../libunwind/libunwind_1.8.1.bb | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-support/libunwind/libunwind/libatomic.patch diff --git a/meta/recipes-support/libunwind/libunwind/libatomic.patch b/meta/recipes-support/libunwind/libunwind/libatomic.patch new file mode 100644 index 00000000000..f39e92f2eef --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind/libatomic.patch @@ -0,0 +1,38 @@ +From d6a0d8ce07c761e51b9dc7c5d16a9b06c3e93560 Mon Sep 17 00:00:00 2001 +From: Stephen Webb +Date: Mon, 18 Mar 2024 10:22:26 -0400 +Subject: [PATCH] configure.ac: detect if -latomic is required + +Some OS runtimes require libatomic be linked in separately to get +standard atomic operations to work. Try to detect that at configure +time. + +Upstream-Status: Submitted [https://github.com/libunwind/libunwind/pull/732/] +Signed-off-by: Ross Burton +--- + configure.ac | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 758a27d19..d0ef5f3d9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -94,6 +94,18 @@ dnl Checks for library functions. + AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \ + ttrace mincore pipe2 sigaltstack execvpe) + ++AC_MSG_CHECKING([if -latomic is required]) ++ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ++ #include ++ atomic_bool ab_ = 0; atomic_llong al_ = 0; ++ ]],[[ ++ atomic_load(&ab_); atomic_load(&al_); ++ ]])], ++ [use_libatomic=no], ++ [use_libatomic=yes]) ++AC_MSG_RESULT([$use_libatomic]) ++AS_IF([test "$use_libatomic" = "yes"],[LIBS="-latomic $LIBS"]) ++ + AC_MSG_CHECKING([if building with AltiVec]) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #ifndef __ALTIVEC__ diff --git a/meta/recipes-support/libunwind/libunwind_1.8.1.bb b/meta/recipes-support/libunwind/libunwind_1.8.1.bb index 1885da4d09f..38022569df2 100644 --- a/meta/recipes-support/libunwind/libunwind_1.8.1.bb +++ b/meta/recipes-support/libunwind/libunwind_1.8.1.bb @@ -12,6 +12,7 @@ SRC_URI = "https://github.com/libunwind/libunwind/releases/download/v${PV}/${BP} file://0003-Fixed-miscompilation-of-unw_getcontext-on-ARM.patch \ file://0004-Rework-inline-aarch64-as-for-setcontext.patch \ file://0005-Handle-musl-on-PPC32.patch \ + file://libatomic.patch \ " SRC_URI[sha256sum] = "ddf0e32dd5fafe5283198d37e4bf9decf7ba1770b6e7e006c33e6df79e6a6157" @@ -32,7 +33,6 @@ ARM_INSTRUCTION_SET:armv4 = "arm" ARM_INSTRUCTION_SET:armv5 = "arm" LDFLAGS += "-Wl,-z,relro,-z,now" -LDFLAGS:append:powerpc:libc-musl = " -latomic" SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared" CACHED_CONFIGUREVARS:append:libc-musl = " LDFLAGS='${LDFLAGS} -lucontext'" From patchwork Fri Apr 25 11:23:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 61882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 872CBC369D7 for ; Fri, 25 Apr 2025 11:23:58 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4369.1745580236413256016 for ; Fri, 25 Apr 2025 04:23:56 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BA977106F for ; Fri, 25 Apr 2025 04:23:50 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B32FB3F59E for ; Fri, 25 Apr 2025 04:23:55 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/3] libunwind: fix build when unused sections are garbage collected Date: Fri, 25 Apr 2025 12:23:50 +0100 Message-ID: <20250425112350.3626731-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250425112350.3626731-1-ross.burton@arm.com> References: <20250425112350.3626731-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 25 Apr 2025 11:23:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/215456 poky-tiny uses gcsections.inc to strip unused sections from the binaries. However, on qemuarm5/qemuarm64 with poky-tiny this appears to result in too much being removed and the link fails: ld: .libs/Gtest-trace: hidden symbol `__aarch64_cas8_acq_rel' in libgcc.a(cas_8_4.o) is referenced by DSO Work around this by disabling gcsections.inc. Signed-off-by: Ross Burton --- meta/recipes-support/libunwind/libunwind_1.8.1.bb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/recipes-support/libunwind/libunwind_1.8.1.bb b/meta/recipes-support/libunwind/libunwind_1.8.1.bb index 38022569df2..b22cb30646e 100644 --- a/meta/recipes-support/libunwind/libunwind_1.8.1.bb +++ b/meta/recipes-support/libunwind/libunwind_1.8.1.bb @@ -32,6 +32,10 @@ EXTRA_OECONF = "--enable-static" ARM_INSTRUCTION_SET:armv4 = "arm" ARM_INSTRUCTION_SET:armv5 = "arm" +# With qemuarm64 and poky-tiny: +# ld: .libs/Gtest-trace: hidden symbol `__aarch64_cas8_acq_rel' in libgcc.a(cas_8_4.o) is referenced by DSO +LDFLAGS_SECTION_REMOVAL = "" + LDFLAGS += "-Wl,-z,relro,-z,now" SECURITY_LDFLAGS:append:libc-musl = " -lssp_nonshared"