From fbe33e07285c2915cc0d9b5ff427ec6683c8c385 Mon Sep 17 00:00:00 2001 From: Huan Zhang Date: Mon, 11 Jun 2012 23:17:19 +0200 Subject: [PATCH] Fix libmad compilation on MIPS with newer gcc. FS#12013 Since gcc 4.4 the MIPS port no longer recognizes the "h" asm constraint. It was necessary to remove this constraint in order to avoid generating unpredictable code sequences. We can achieve the same effect using 128-bit types. See also:GCC 4.4 release notes at http://gcc.gnu.org/gcc-4.4/ Change-Id: I713cdf57cde1a989ad960aa441ab1ccf51f1cdc6 --- lib/rbcodec/codecs/libmad/fixed.h | 11 +++++++++++ tools/configure | 3 +++ 2 files changed, 14 insertions(+) diff --git a/lib/rbcodec/codecs/libmad/fixed.h b/lib/rbcodec/codecs/libmad/fixed.h index 6015684644..1b4d29dad6 100644 --- a/lib/rbcodec/codecs/libmad/fixed.h +++ b/lib/rbcodec/codecs/libmad/fixed.h @@ -292,6 +292,15 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # elif defined(FPM_MIPS) +#if GCCNUM >= 404 +typedef unsigned int u64_di_t __attribute__ ((mode (DI))); +# define MAD_F_MLX(hi, lo, x, y) \ +do { \ + u64_di_t __ll = (u64_di_t) (x) * (y); \ + hi = __ll >> 32; \ + lo = __ll; \ +}while(0) +#else /* * This MIPS version is fast and accurate; the disposition of the least * significant bit depends on OPT_ACCURACY via mad_f_scale64(). @@ -322,6 +331,8 @@ mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) # define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo)) # endif +#endif /* GCCNUM */ + # if defined(OPT_SPEED) # define mad_f_scale64(hi, lo) \ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS))) diff --git a/tools/configure b/tools/configure index c008395d7c..7d860683cf 100755 --- a/tools/configure +++ b/tools/configure @@ -3840,6 +3840,9 @@ ${Darch_version} /* Define endianess for the target or simulator platform */ #define ${defendian} 1 +/* Define the GCC version used for the build */ +#define GCCNUM ${GCCNUM} + /* Define this if you build rockbox to support the logf logging and display */ ${use_logf} -- 2.11.4.GIT