2012-08-06 11:35:29

by Tatulea, Dragos

[permalink] [raw]
Subject: [PATCH] x86: set fpmath to 387 to avoid gcc warnings

From: Dragos Tatulea <[email protected]>

If gcc has a different default fpmath set (e.g. sse),
many unuseful warnings will be spewed when compiling on an
architecture that doesn't support it.

An example would be Google's Android 4.1 x86 toochain which
is compiled with -mfpmath=sse.

This can affect out of tree modules that compile with
-Werror (ex: systemtap stp scripts).

Signed-off-by: Dragos Tatulea <[email protected]>
---
arch/x86/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index b1c611e..f4fefb8 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -130,6 +130,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
# prevent gcc from generating any FP code by mistake
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
+KBUILD_CFLAGS += $(call cc-option,-mfpmath=387,)

KBUILD_CFLAGS += $(mflags-y)
KBUILD_AFLAGS += $(mflags-y)
--
1.7.9.5


2012-08-06 18:30:54

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] x86: set fpmath to 387 to avoid gcc warnings

On 08/06/2012 04:36 AM, [email protected] wrote:
> From: Dragos Tatulea <[email protected]>
>
> If gcc has a different default fpmath set (e.g. sse),
> many unuseful warnings will be spewed when compiling on an
> architecture that doesn't support it.
>
> An example would be Google's Android 4.1 x86 toochain which
> is compiled with -mfpmath=sse.
>
> This can affect out of tree modules that compile with
> -Werror (ex: systemtap stp scripts).
>
> Signed-off-by: Dragos Tatulea <[email protected]>
> ---
> arch/x86/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index b1c611e..f4fefb8 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -130,6 +130,7 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
> # prevent gcc from generating any FP code by mistake
> KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
> KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
> +KBUILD_CFLAGS += $(call cc-option,-mfpmath=387,)
>
> KBUILD_CFLAGS += $(mflags-y)
> KBUILD_AFLAGS += $(mflags-y)
>

I guess we should do -msoft-float as well to try to get an error if FP
instructions are generated at all...

-hpa