tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] cpu detection


From: Roy Tam
Subject: Re: [Tinycc-devel] [PATCH] cpu detection
Date: Tue, 6 Jan 2015 14:04:00 +0800

2015-01-06 14:01 GMT+08:00 Christian Jullien <address@hidden>:
> Even on Windows x64 using x64 cl version, long is 4 bytes! This is by design 
> to 'ease' porting from x86 to x64.

MS has a document about that.
http://msdn.microsoft.com/en-us/library/3b2e7499.aspx

>
> #include <stdio.h>
> int
> main()
> {
>         printf("%d\n", sizeof(long));
> }
>
> Using Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30723 for x64
> => 4
>
> size_t gives a better result
>
> #include <stdio.h>
> int
> main()
> {
>         printf("%d\n", sizeof(size_t));
> }
> => 8 with x64
> => 4 with x86
>
> Christian
>
> -----Original Message-----
> From: address@hidden [mailto:address@hidden On Behalf Of Sergey Korshunoff
> Sent: lundi 5 janvier 2015 20:08
> To: address@hidden
> Subject: Re: [Tinycc-devel] [PATCH] cpu detection
>
> Why? A main change of this patch is:
>    if (cpu=x86_64 && sizeof(long)==4)
>        set cpu=x86
> What wrong with this on Windows?
>
>
> 2015-01-05 20:08 GMT+03:00, Michael B. Smith <address@hidden>:
>> I'm pretty sure this breaks Windows support.
>>
>> -----Original Message-----
>> From: address@hidden
>> [mailto:address@hidden
>> rg] On Behalf Of Sergey Korshunoff
>> Sent: Monday, January 5, 2015 11:51 AM
>> To: Thomas Preud'homme
>> Cc: address@hidden
>> Subject: Re: [Tinycc-devel] [PATCH] cpu detection
>>
>> cpu detection v2
>> * don't setup a cpu before scanning for --cpu=
>> * if cpu="" then
>>      if ARCH != "" then cpu=$ARCH else cpu=`uname -m`
>> * if cpu="x86-64" and sizeof(long) = 4 then cpu="x86"
>>
>>
>> 2015-01-04 19:37 GMT+03:00, Sergey Korshunoff <address@hidden>:
>>> As suggested on another forum, there is a "setarch linux32" command
>>> for changing ARCH reported by "uname -m".
>>>
>>> 2015-01-04 2:45 GMT+03:00, Thomas Preud'homme <address@hidden>:
>>>> Le mardi 30 décembre 2014, 11:05:15 Sergey Korshunoff a écrit :
>>>>> Problem: configure in 32bit userspace running on 64bit kernel is
>>>>> trying to compile tcc for ARCH=x86_64. Expecting behavior: to
>>>>> configure a tcc for ARCH=x86
>>>>>
>>>>> This patch will allow to specify/configure a target cpu. Examples:
>>>>>       ARCH=x86 ./configure
>>>>>       ARCH=x86_64 ./configure
>>>>>
>>>>> If ARCH is not specified then try to detect a current cpu type by
>>>>> examining arch of the host_cc.
>>>>
>>>> The principle is nice but the code style looks different from the
>>>> rest and a
>>>>
>>>> bit complicated for what it is. Why using a subscript for instance?
>>>> Why not
>>>>
>>>> nesting if?
>>>>
>>>> Finally, you could instead of using readelf use a carefully crafted
>>>> conftest
>>>>
>>>> that would give you whether userspace is 32bit of 64bit. The
>>>> structure would
>>>>
>>>> then look like this:
>>>>
>>>> if ARCH is defined, then use it
>>>> else use uname
>>>>
>>>> if cpu is x86_64 and conftest gives 32bit, cpu=i386.
>>>>
>>>> What do you think?
>>>>
>>>> Best regards,
>>>>
>>>> Thomas
>>>>
>>>
>> _______________________________________________
>> Tinycc-devel mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>>
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]