If I try to compile/link and run a minimal "hello, world" program, it crashes due to an invalid instruction, a "cmove" instruction in the "opendir" routine within WSL. It appears that this WSL (which I had downloaded in Sept. 2013) was built with a gcc -march setting that's not compatible with some older Intel processors. The processor that I'm trying to use is Pentium with MMX. The "cmove" instruction only exists on Pentium Pro and later.
This same type of problem may also be present in some infrequently-used part of gcc itself. Doing a build of my libraries on this W98 system with the Pentium-MMX, it was able to compile the first 19 source files, but on the 20th file, gcc crashes with an invalid instruction. Repeated builds always crash at that same exact place. The version of gcc with this problem is 4.7.2.
The previous MinGW that I was using was downloaded in July 2012, and it works properly, both WSL and gcc. That previous version of gcc, working properly for me, is 4.7.0.
Last edit: Kevin Scott 2013-12-11
To clarify: there is no explicit -march setting applied, when building WSL; it simply adopts the default from the GCC used to build it. That's fine, when the builder uses GCC-4.4 or earlier, since the default is -march=i386, so the resultant WSL will be compatible with any x86 derived CPU.
Unfortunately, there was a change in philosophy for GCC-4.5 and later: the default -march has now become the configure target, which itself defaults to the CPU of the builder's machine. In reality, the solution here should be to distribute a GCC which is explicitly built for a more generic configure target, to ensure that it doesn't emit code which may not be compatible with some older CPUs which remain in common use, and to use this GCC for building all distributed libraries.
Further discussion may be found in these mailing list threads:
http://thread.gmane.org/gmane.comp.gnu.mingw.user/43431
http://thread.gmane.org/gmane.comp.gnu.mingw.user/43446
http://thread.gmane.org/gmane.comp.gnu.mingw.user/43453
http://thread.gmane.org/gmane.comp.gnu.mingw.user/43463
While investigating [#2108], I've created an experimental build of GCC-4.8.2, which you may like to try; (it was built
--with-arch=i586,--with-tune=generic). I've also provided a build of binutils-2.24, which should be similarly suitable for older processors.Related
Issues:
#2108