[Freemint-list] m68k-atari-mint-gcc 7.1 status

Miro Kropáček miro.kropacek at gmail.com
Thu Aug 24 01:20:02 MSD 2017


Hi guys,

some of you may have noticed that I'm playing with gcc 7.1 on our platform.
The initial push was Thorsten's patch mentioned in EmuTOS mailing list,
then only minimal changes were needed to make everything work.
Currently my build
scripts
<https://github.com/mikrosk/m68k-atari-mint-build/tree/git_clone_gcc7> can
build complete binutils 2.28+gcc 7.1+mintlib environment, making possible
to build gemlib+cflib+freemint afterwards. Binutils have been already done
by Vincent, gcc is available here:
https://github.com/mikrosk/m68k-atari-mint-gcc/tree/gcc-7-mint.

This applies also to native binaries, i.e. I have a native gcc 7.1 for
m68k, m68020-60 and ColdFire. So far so good.

However there's at least one strong reason why I don't want to release it
and that's a really strange code generation bug for (m68k-atari-mint-)a.out
format.

The attached file compiles fine on m68k-atari-mint-gcc:

m68k-atari-mint-gcc -o test.o -m68020-60 -O3 -fomit-frame-pointer -Wall -c
test.c -save-temps

we can see there's a call to sin() and cos(), -ffast-math leads to even
better code, inlined fsin and fcos instructions.

However the same code and switches on m68k-atari-mint-gcc 7.1 lead to a
totally corrupted code, not using sin() and cos() but a call to cexp()
(yes, an exp() for complex numbers!).

First I thought "Damn, this must be a m68k generator bug" but Vincent has
taught me to use m68k-elf to verify such claims and voila -- works totally
fine!

There's only one hint: m68k-atari-mint-gcc 7.1 generates wrong code
(referencing cexp()) even in case of -ffast-math, i.e. there's no inline
code happening. What perhaps makes sense because the 68881 doesn't have an
instruction like that. So it's actually not so great hint. :)

I also tried https://bitbucket.org/ggnkua/bigbrownbuild/src -- not
happening there as well, so this must be somehow related to a.out, perhaps
more explicitly, related to a.aout removal from gcc? So our unfortunate
lonely patch breaks something?

Thorsten seems to be busy with other things so if anyone feels educated
enough to make a suggestion, I'm all ears.

-- 
MiKRO / Mystic Bytes
http://mikro.atari.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.atariforge.org/pipermail/freemint-list/attachments/20170824/8190ada3/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 1114 bytes
Desc: not available
Url : http://mail.atariforge.org/pipermail/freemint-list/attachments/20170824/8190ada3/attachment.bin 


More information about the Freemint-list mailing list