[Buildroot] [PATCH 1/2] package/jack2: Fix build on xtensa

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Mon May 23 20:30:33 UTC 2016


Hello,

On Mon, 23 May 2016 18:47:55 +0200, Bernd Kuhls wrote:
> Fixes
> http://autobuild.buildroot.net/results/1ee/1ee48356d8da5e0ebf3e5b61b02fed81704a01dd/
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
> ---
>  package/jack2/0003-Add-support-for-xtensa.patch | 34 +++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>  create mode 100644 package/jack2/0003-Add-support-for-xtensa.patch

So we've already added an exclusion for nios2, now xtensa and arc, and
the list was already long.

Isn't it time to find a better solution, like the below patch?

(Took me a while to cook, I had never used this waf thing until now...)

I've tested that it properly detects the absence of NGREG on Xtensa.
However, I have not tested on architectures where it exists, so I hope
I didn't do any typo.

Best regards,

Thomas

From 754205cfccc7b28732c2a952a14d1434b67eb074 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
Date: Mon, 23 May 2016 22:28:12 +0200
Subject: [PATCH] Add check for the NGREG macro

The NGREG macro is not available on all CPU architectures. Rather than
making a long list of exclusions longer and longer, add a waf check to
test for its functionality.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 dbus/sigsegv.c | 4 ++--
 wscript        | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
index df2c42c..35c5151 100644
--- a/dbus/sigsegv.c
+++ b/dbus/sigsegv.c
@@ -106,7 +106,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
     jack_error("info.si_errno = %d", info->si_errno);
     jack_error("info.si_code  = %d (%s)", info->si_code, si_code_str);
     jack_error("info.si_addr  = %p", info->si_addr);
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__)
+#if HAVE_NGREG
     for(i = 0; i < NGREG; i++)
         jack_error("reg[%02d]       = 0x" REGFORMAT, i, 
 #if defined(__powerpc64__)
@@ -119,7 +119,7 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
                 ucontext->uc_mcontext.gregs[i]
 #endif
                 );
-#endif /* alpha, ia64, kFreeBSD, arm, hppa */
+#endif /* NGREG */
 
 #if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
 # if defined(SIGSEGV_STACK_IA64)
diff --git a/wscript b/wscript
index 63ba3aa..a0838b0 100644
--- a/wscript
+++ b/wscript
@@ -168,6 +168,8 @@ def configure(conf):
 
     conf.check_cc(header_name='execinfo.h', define_name="HAVE_EXECINFO_H", mandatory=False)
     conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
+    conf.check_cc(fragment="#include <ucontext.h>\nint main() { return NGREG; }\n",
+                  define_name="HAVE_NGREG", mandatory=False)
 
     if conf.is_defined('HAVE_SAMPLERATE'):
         conf.env['LIB_SAMPLERATE'] = ['samplerate']
-- 
2.7.4



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list