--- /dev/null
+From c00e284dd2baa5ecdb0c9586044399cd7cacce3e Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Mon, 8 Aug 2016 12:31:40 +0200
+Subject: [PATCH] compiler.m4: do not remove -g flag
+
+A sed expression such as 's/-g//' not only removes the -g
+debugging-related flag, but also turns more specific flags such as
+-mfloat-gprs=double into -mfloatprs=double, which is no longer a valid
+flag.
+
+However, it turns out that removing -g is not necessary: having -g0
+after -g negates the -g, and having -ggdb after -g is enough to produce
+debugging information for GDB.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ compiler.m4 | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/compiler.m4 b/compiler.m4
+index 3a23406..621372c 100644
+--- a/compiler.m4
++++ b/compiler.m4
+@@ -378,15 +378,9 @@ else
+ gcc)
+ if test x"$aixldbug" != x; then
+ #disable debug info
+- if echo $CFLAGS | grep -- "-g" >/dev/null; then
+- CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'`"
+- fi
+ CFLAGS="$CFLAGS${CFLAGS:+ }-g0"
+ else
+ #use -ggdb also when not debugging
+- if echo $CFLAGS | grep -- "-g" >/dev/null; then
+- CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'`"
+- fi
+ CFLAGS="$CFLAGS${CFLAGS:+ }-ggdb"
+ fi
+ ;;
+--
+2.7.4
+