toolchain-wrapper: do not use deprecated -mfused-madd

Submitted by Waldemar Brodkorb on Aug. 11, 2017, 5:28 a.m.

Details

Message ID 20170811052847.GA32348@waldemar-brodkorb.de
State New
Headers show

Commit Message

Waldemar Brodkorb Aug. 11, 2017, 5:28 a.m.
GCC deprecated -mfused-madd, -ffp-contract=off should
be used for Xburst workaround.
uClibc compilations will fail, because a gcc warning
is emitted while checking for TLS support in the compiler.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 toolchain/toolchain-wrapper.c  | 4 ++--
 toolchain/toolchain-wrapper.mk | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Thomas Petazzoni Aug. 11, 2017, 6:08 a.m.
Hello,

On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
> GCC deprecated -mfused-madd, -ffp-contract=off should
> be used for Xburst workaround.
> uClibc compilations will fail, because a gcc warning
> is emitted while checking for TLS support in the compiler.

In which gcc version was -ffp-contract=off added ? Can we use that
unconditionally, or is it only available in recent gcc versions ?

Best regards,

Thomas
Arnout Vandecappelle Aug. 11, 2017, 9:53 a.m.
On 11-08-17 08:08, Thomas Petazzoni wrote:
> Hello,
> 
> On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
>> GCC deprecated -mfused-madd, -ffp-contract=off should
>> be used for Xburst workaround.
>> uClibc compilations will fail, because a gcc warning
>> is emitted while checking for TLS support in the compiler.
> 
> In which gcc version was -ffp-contract=off added ? Can we use that
> unconditionally, or is it only available in recent gcc versions ?

 And remember that we support GCC down to 4.3 in external toolchains...

 Regards,
 Arnout
Waldemar Brodkorb Aug. 11, 2017, 5:32 p.m.
Hi,
Thomas Petazzoni wrote,

> Hello,
> 
> On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
> > GCC deprecated -mfused-madd, -ffp-contract=off should
> > be used for Xburst workaround.
> > uClibc compilations will fail, because a gcc warning
> > is emitted while checking for TLS support in the compiler.
> 
> In which gcc version was -ffp-contract=off added ? Can we use that
> unconditionally, or is it only available in recent gcc versions ?

It was added in commit b9be572eda05cd23bbabd6409387d2c7ac782715.

Not sure how to find when it was added in a release.
4.6.4 seems to have it:
https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Optimize-Options.html#index-ffp_002dcontract-691

I don't find it in earlier release docs.

best regards
 Waldemar
Waldemar Brodkorb Aug. 11, 2017, 6:11 p.m.
Hi Arnout,
Arnout Vandecappelle wrote,

> 
> 
> On 11-08-17 08:08, Thomas Petazzoni wrote:
> > Hello,
> > 
> > On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
> >> GCC deprecated -mfused-madd, -ffp-contract=off should
> >> be used for Xburst workaround.
> >> uClibc compilations will fail, because a gcc warning
> >> is emitted while checking for TLS support in the compiler.
> > 
> > In which gcc version was -ffp-contract=off added ? Can we use that
> > unconditionally, or is it only available in recent gcc versions ?
> 
>  And remember that we support GCC down to 4.3 in external toolchains...

The usage for -ffp-contract=off is limited for MIPS32 xburst and
I see only two external toolchains from 2016 for MIPS in
make menuconfig...

best regards
 Waldemar
Arnout Vandecappelle Aug. 11, 2017, 8:54 p.m.
On 11-08-17 20:11, Waldemar Brodkorb wrote:
> Hi Arnout,
> Arnout Vandecappelle wrote,
> 
>>
>>
>> On 11-08-17 08:08, Thomas Petazzoni wrote:
>>> Hello,
>>>
>>> On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
>>>> GCC deprecated -mfused-madd, -ffp-contract=off should
>>>> be used for Xburst workaround.
>>>> uClibc compilations will fail, because a gcc warning
>>>> is emitted while checking for TLS support in the compiler.
>>>
>>> In which gcc version was -ffp-contract=off added ? Can we use that
>>> unconditionally, or is it only available in recent gcc versions ?
>>
>>  And remember that we support GCC down to 4.3 in external toolchains...
> 
> The usage for -ffp-contract=off is limited for MIPS32 xburst and
> I see only two external toolchains from 2016 for MIPS in
> make menuconfig...

 There's also something called "Custom external toolchain", which could be
anything...

 Regards,
 Arnout
Arnout Vandecappelle Aug. 11, 2017, 9 p.m.
On 11-08-17 19:32, Waldemar Brodkorb wrote:
> Hi,
> Thomas Petazzoni wrote,
> 
>> Hello,
>>
>> On Fri, 11 Aug 2017 07:28:48 +0200, Waldemar Brodkorb wrote:
>>> GCC deprecated -mfused-madd, -ffp-contract=off should
>>> be used for Xburst workaround.
>>> uClibc compilations will fail, because a gcc warning
>>> is emitted while checking for TLS support in the compiler.
>>
>> In which gcc version was -ffp-contract=off added ? Can we use that
>> unconditionally, or is it only available in recent gcc versions ?
> 
> It was added in commit b9be572eda05cd23bbabd6409387d2c7ac782715.
> 
> Not sure how to find when it was added in a release.

$ git describe --contains b9be572eda05cd23bbabd6409387d2c7ac782715
gcc-4_6_0-release~2941

 So we should use something like:

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

 But actually, I'd much prefer this stuff to just be coded in
TOOLCHAIN_WRAPPER_OPTS. But that's a much bigger patch (series) so not for master.

 Regards,
 Arnout


> 4.6.4 seems to have it:
> https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Optimize-Options.html#index-ffp_002dcontract-691
> 
> I don't find it in earlier release docs.
> 
> best regards
>  Waldemar
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

Patch hide | download patch | download mbox

diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c
index dd77c11..44cdcf3 100644
--- a/toolchain/toolchain-wrapper.c
+++ b/toolchain/toolchain-wrapper.c
@@ -69,8 +69,8 @@  static char *predef_args[] = {
 #ifdef BR_OMIT_LOCK_PREFIX
 	"-Wa,-momit-lock-prefix=yes",
 #endif
-#ifdef BR_NO_FUSED_MADD
-	"-mno-fused-madd",
+#ifdef BR_FP_CONTRACT_OFF
+	"-ffp-contract=off",
 #endif
 #ifdef BR_BINFMT_FLAT
 	"-Wl,-elf2flt",
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 7f72a0c..ecf67a4 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -27,8 +27,9 @@  TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX
 endif
 
 # Avoid FPU bug on XBurst CPUs
+# -mfused-madd is deprecated, use -ffp-contract instead
 ifeq ($(BR2_mips_xburst),y)
-TOOLCHAIN_WRAPPER_ARGS += -DBR_NO_FUSED_MADD
+TOOLCHAIN_WRAPPER_ARGS += -DBR_FP_CONTRACT_OFF
 endif
 
 ifeq ($(BR2_CCACHE_USE_BASEDIR),y)