* [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6
@ 2018-03-31 17:54 Thomas Petazzoni
2018-04-01 13:43 ` Ezequiel Garcia
2018-04-01 14:23 ` Thomas Petazzoni
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2018-03-31 17:54 UTC (permalink / raw)
To: buildroot
From: Waldemar Brodkorb <wbx@openadk.org>
Since gcc 4.6, GCC deprecated -mfused-madd, -ffp-contract=off should
be used for the Xburst workaround.
Tested with the MIPS Sourcery 2011.03 toolchain (based on gcc 4.5),
the toolchain wrapper uses -mno-fused-madd, as expected:
$ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
Toolchain wrapper executing:
'/home/thomas/toolchains/mips-2011.03/bin/mips-linux-gnu-gcc'
'--sysroot'
'/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
'-mabi=32'
'-msoft-float'
'-mno-fused-madd'
'-EL'
'-march=mips32r2'
'-o'
'toto'
'toto.c'
And with the MIPS Sourcery 2012.09 toolchain (based on gcc 4.7), the
toolchain wrapper uses -ffp-contract=off, as expected:
$ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
Toolchain wrapper executing:
'/home/thomas/toolchains/mips-2012.09/bin/mips-linux-gnu-gcc'
'--sysroot'
'/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
'-mabi=32'
'-msoft-float'
'-ffp-contract=off'
'-EL'
'-march=mips32r2'
'-o'
'toto'
'toto.c'
Fixes the ci20_defconfig build:
https://gitlab.com/buildroot.org/buildroot/-/jobs/60303132
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
[Thomas: rework to continue supporting pre-gcc-4.6 toolchains, extend
the commit log after doing more testing.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
toolchain/toolchain-wrapper.c | 3 +++
toolchain/toolchain-wrapper.mk | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index 2928ea42d0..c5eb813dd0 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -82,6 +82,9 @@ static char *predef_args[] = {
#ifdef BR_NO_FUSED_MADD
"-mno-fused-madd",
#endif
+#ifdef BR_FP_CONTRACT_OFF
+ "-ffp-contract=off",
+#endif
#ifdef BR_BINFMT_FLAT
"-Wl,-elf2flt",
#endif
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 7f72a0cade..6e95545ebf 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -28,8 +28,14 @@ endif
# Avoid FPU bug on XBurst CPUs
ifeq ($(BR2_mips_xburst),y)
+# Before gcc 4.6, -mno-fused-madd was needed, after -ffp-contract is
+# needed
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_6),y)
+TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
+else
TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
endif
+endif
ifeq ($(BR2_CCACHE_USE_BASEDIR),y)
TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"'
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6
2018-03-31 17:54 [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6 Thomas Petazzoni
@ 2018-04-01 13:43 ` Ezequiel Garcia
2018-04-01 14:23 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Ezequiel Garcia @ 2018-04-01 13:43 UTC (permalink / raw)
To: buildroot
On 31 March 2018 at 14:54, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> From: Waldemar Brodkorb <wbx@openadk.org>
>
> Since gcc 4.6, GCC deprecated -mfused-madd, -ffp-contract=off should
> be used for the Xburst workaround.
>
> Tested with the MIPS Sourcery 2011.03 toolchain (based on gcc 4.5),
> the toolchain wrapper uses -mno-fused-madd, as expected:
>
> $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
> Toolchain wrapper executing:
> '/home/thomas/toolchains/mips-2011.03/bin/mips-linux-gnu-gcc'
> '--sysroot'
> '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
> '-mabi=32'
> '-msoft-float'
> '-mno-fused-madd'
> '-EL'
> '-march=mips32r2'
> '-o'
> 'toto'
> 'toto.c'
>
> And with the MIPS Sourcery 2012.09 toolchain (based on gcc 4.7), the
> toolchain wrapper uses -ffp-contract=off, as expected:
>
> $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
> Toolchain wrapper executing:
> '/home/thomas/toolchains/mips-2012.09/bin/mips-linux-gnu-gcc'
> '--sysroot'
> '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
> '-mabi=32'
> '-msoft-float'
> '-ffp-contract=off'
> '-EL'
> '-march=mips32r2'
> '-o'
> 'toto'
> 'toto.c'
>
> Fixes the ci20_defconfig build:
>
> https://gitlab.com/buildroot.org/buildroot/-/jobs/60303132
>
Fixed that one, but U-Boot fails to build here. I'll submit a patch.
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> [Thomas: rework to continue supporting pre-gcc-4.6 toolchains, extend
> the commit log after doing more testing.]
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Thanks,
Eze
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6
2018-03-31 17:54 [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6 Thomas Petazzoni
2018-04-01 13:43 ` Ezequiel Garcia
@ 2018-04-01 14:23 ` Thomas Petazzoni
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2018-04-01 14:23 UTC (permalink / raw)
To: buildroot
Hello,
On Sat, 31 Mar 2018 19:54:20 +0200, Thomas Petazzoni wrote:
> From: Waldemar Brodkorb <wbx@openadk.org>
>
> Since gcc 4.6, GCC deprecated -mfused-madd, -ffp-contract=off should
> be used for the Xburst workaround.
>
> Tested with the MIPS Sourcery 2011.03 toolchain (based on gcc 4.5),
> the toolchain wrapper uses -mno-fused-madd, as expected:
>
> $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
> Toolchain wrapper executing:
> '/home/thomas/toolchains/mips-2011.03/bin/mips-linux-gnu-gcc'
> '--sysroot'
> '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
> '-mabi=32'
> '-msoft-float'
> '-mno-fused-madd'
> '-EL'
> '-march=mips32r2'
> '-o'
> 'toto'
> 'toto.c'
>
> And with the MIPS Sourcery 2012.09 toolchain (based on gcc 4.7), the
> toolchain wrapper uses -ffp-contract=off, as expected:
>
> $ BR2_DEBUG_WRAPPER=2 ./output/host/bin/mips-linux-gnu-gcc -o toto toto.c
> Toolchain wrapper executing:
> '/home/thomas/toolchains/mips-2012.09/bin/mips-linux-gnu-gcc'
> '--sysroot'
> '/home/thomas/projets/buildroot/output/host/mipsel-buildroot-linux-gnu/sysroot'
> '-mabi=32'
> '-msoft-float'
> '-ffp-contract=off'
> '-EL'
> '-march=mips32r2'
> '-o'
> 'toto'
> 'toto.c'
>
> Fixes the ci20_defconfig build:
>
> https://gitlab.com/buildroot.org/buildroot/-/jobs/60303132
>
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
> [Thomas: rework to continue supporting pre-gcc-4.6 toolchains, extend
> the commit log after doing more testing.]
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> toolchain/toolchain-wrapper.c | 3 +++
> toolchain/toolchain-wrapper.mk | 6 ++++++
> 2 files changed, 9 insertions(+)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-01 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-31 17:54 [Buildroot] [PATCH] toolchain-wrapper: use -ffp-contract=off on MIPS Xburst for gcc >= 4.6 Thomas Petazzoni
2018-04-01 13:43 ` Ezequiel Garcia
2018-04-01 14:23 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox