From b86193d2fa1c66580d92509bb8853e698e21ac15 Mon Sep 17 00:00:00 2001 From: Juan Gomez Date: Wed, 26 Nov 2014 15:23:00 -0800 Subject: [PATCH] Bug 1056337 - Work around toolchain issues with arm gcc 4.8 and opus. r=rillian The androidabi-4.8 toolchain we'd liek to use for B2G ICS builds cannot compile this section of the opus source. Force-disable optimizations for the offending code in order to avoid the ICE. --- media/libopus/celt/rate.c | 11 +++++++++- media/libopus/gcc-4.8-ICE.patch | 39 +++++++++++++++++++++++++++++++++ media/libopus/update.sh | 2 +- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 media/libopus/gcc-4.8-ICE.patch diff --git a/media/libopus/celt/rate.c b/media/libopus/celt/rate.c index e13d839d63b..1055e63d60d 100644 --- a/media/libopus/celt/rate.c +++ b/media/libopus/celt/rate.c @@ -523,6 +523,12 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, return codedBands; } +#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \ + __GNUC__ == 4 && __GNUC_MINOR__ == 8 +#warning "OPUS library causes an internal compiler error for gcc-4.8 based toolchain in arm" +#pragma GCC push_options +#pragma GCC optimize ("O0") +#endif int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo, opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth) { @@ -635,4 +641,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets RESTORE_STACK; return codedBands; } - +#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \ + __GNUC__ == 4 && __GNUC_MINOR__ == 8 +#pragma GCC pop_options +#endif diff --git a/media/libopus/gcc-4.8-ICE.patch b/media/libopus/gcc-4.8-ICE.patch new file mode 100644 index 00000000000..92a74e325f7 --- /dev/null +++ b/media/libopus/gcc-4.8-ICE.patch @@ -0,0 +1,39 @@ +From 609166a46f6a22ae2d0a0ab7c64415c779c65f37 Mon Sep 17 00:00:00 2001 +From: Juan Gomez +Date: Wed, 26 Nov 2014 23:57:49 +0100 +Subject: [PATCH] Bug 1056337 - Upgrade toolchain used for B2G ICS builds * + Patch for gcc ICE in OPUS library (arm) + +--- + media/libopus/celt/rate.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/media/libopus/celt/rate.c b/media/libopus/celt/rate.c +index e13d839..1055e63 100644 +--- a/media/libopus/celt/rate.c ++++ b/media/libopus/celt/rate.c +@@ -523,6 +523,12 @@ static OPUS_INLINE int interp_bits2pulses(const CELTMode *m, int start, int end, + return codedBands; + } + ++#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \ ++ __GNUC__ == 4 && __GNUC_MINOR__ == 8 ++#warning "OPUS library causes an internal compiler error for gcc-4.8 based toolchain in arm" ++#pragma GCC push_options ++#pragma GCC optimize ("O0") ++#endif + int compute_allocation(const CELTMode *m, int start, int end, const int *offsets, const int *cap, int alloc_trim, int *intensity, int *dual_stereo, + opus_int32 total, opus_int32 *balance, int *pulses, int *ebits, int *fine_priority, int C, int LM, ec_ctx *ec, int encode, int prev, int signalBandwidth) + { +@@ -635,4 +641,7 @@ int compute_allocation(const CELTMode *m, int start, int end, const int *offsets + RESTORE_STACK; + return codedBands; + } +- ++#if !defined(__clang__) && defined(__GNUC__) && defined(__arm__) && \ ++ __GNUC__ == 4 && __GNUC_MINOR__ == 8 ++#pragma GCC pop_options ++#endif +-- +2.1.0 + diff --git a/media/libopus/update.sh b/media/libopus/update.sh index f1d1cf715d7..8676b1b80cd 100755 --- a/media/libopus/update.sh +++ b/media/libopus/update.sh @@ -74,4 +74,4 @@ sed -e "s/DEFINES\['OPUS_VERSION'\][ \t]*=[ \t]*'\".*\"'/DEFINES['OPUS_VERSION'] python gen-sources.py $1 # apply outstanding local patches -# ... no patches to apply ... +patch -p3 < ./gcc-4.8-ICE.patch