Windows breakage -- again

Niklas Larsson metaniklas at gmail.com
Thu Jul 17 20:25:55 UTC 2014


Now I have an extremely simple patch that I have confirmed is working.

As it is in the autoconfig stuff, one needs to run:
autoreconf
make distclean
./boot
and so on....

As apparently everything has been built with i386 before, I'm curious about
if there's a performance increase when going i686. I'll have to measure
that, but not tonight.

Niklas


2014-07-17 22:05 GMT+02:00 Johan Tibell <johan.tibell at gmail.com>:

> Can someone see if adding
>
>   Cc-options: -march=i686
>
> To ghc-prim.cabal resolves the issue?
> On Jul 17, 2014 9:06 PM, "Simon Marlow" <marlowsd at gmail.com> wrote:
>
>> gcc has -march=native which uses the current CPU's architecture, but I
>> think it would be a really bad idea to turn that on by default, because it
>> would mean that we have to be really careful which machine we build the
>> distributions on.
>>
>> On my Linux box, gcc -v says it was configured with --with-arch-32=i686,
>> which means that -march=i686 is the default for 32-bit code.  We shouldn't
>> go any later than that IMO.
>>
>> Anyway, this is all beside the point, if we aren't able to run the code
>> generated by gcc (in whatever mode) then there's a bug somewhere.
>>
>> Cheers,
>> Simon
>>
>> On 17/07/2014 07:39, Johan Tibell wrote:
>>
>>> Alright, then which Make file do we need to fix to make sure GCC is
>>> called correctly? Also, I remember reading that some time during the
>>> 4.x GCC series GCC switched to auto-detecting the arch to be that of
>>> the machine being used. Could someone try to just switch GCC to a
>>> newer version and see if it automatically stops trying to use i386,
>>> leading to Simon's problem?
>>>
>>> On Thu, Jul 17, 2014 at 8:37 AM, Niklas Larsson <metaniklas at gmail.com>
>>> wrote:
>>>
>>>> It certainly shouldn't be built with i386, because that is generating
>>>> code
>>>> for a processor that lacks all these fancy atomic instructions. The
>>>> first of
>>>> them appears on the 486.
>>>>
>>>> i686 should be safe, it goes all the way back to Pentium Pro.
>>>>
>>>>
>>>> 2014-07-17 8:33 GMT+02:00 Johan Tibell <johan.tibell at gmail.com>:
>>>>
>>>>  A perhaps silly question, *should* ghc-prim be built with i386 or i686?
>>>>>
>>>>> On Thu, Jul 17, 2014 at 8:33 AM, Niklas Larsson <metaniklas at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> I just found exactly the same thing! Well, I used i686 instead.
>>>>>>
>>>>>> Sounds like it's worthwhile to see if this is limited to ghc-prim or
>>>>>> if
>>>>>> there's more stuff that's built with i386.
>>>>>>
>>>>>>
>>>>>> 2014-07-17 8:21 GMT+02:00 Páli Gábor János <pali.gabor at gmail.com>:
>>>>>>
>>>>>>  2014-07-17 0:51 GMT+02:00 Páli Gábor János <pali.gabor at gmail.com>:
>>>>>>>
>>>>>>>> 2014-07-17 0:47 GMT+02:00 Niklas Larsson <metaniklas at gmail.com>:
>>>>>>>>
>>>>>>>>> I hope they can just be done away with at the source, that is to
>>>>>>>>> make
>>>>>>>>> gcc
>>>>>>>>> generate the assembly primitives. GHC should already be built with
>>>>>>>>> i686, but
>>>>>>>>> does that reach ghc-prim?
>>>>>>>>>
>>>>>>>>
>>>>>>>> This depends on GCC -- if no -march=XXX is explicitly set, I guess
>>>>>>>> it
>>>>>>>> will take its default, which may vary platform by platform.
>>>>>>>>
>>>>>>>
>>>>>>> All right, I have finally got a Windows (x64) machine and installed
>>>>>>> the msys2 environment by the GHC wiki [1].  This has GCC 4.5.2 (as
>>>>>>> Niklas wrote earlier), where the default -march is i386.  You should
>>>>>>> see this line when trying to compile Johan's test program with the -v
>>>>>>> flag set:
>>>>>>>
>>>>>>> COLLECT_GCC_OPTIONS= ... '-v' '-mtune=i386' '-march=i386'
>>>>>>>
>>>>>>> With the -march=i586 flag explicitly set in the command line, no
>>>>>>> __sync_fetch_and_add_n() calls are generated.
>>>>>>>
>>>>>>> [1]
>>>>>>>
>>>>>>> https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/
>>>>>>> Windows/MSYS2
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140717/60e29a63/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Set-i686-as-the-minimum-architecture-on-32-bit-mingw.patch
Type: application/octet-stream
Size: 611 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140717/60e29a63/attachment.obj>


More information about the ghc-devs mailing list