Re: [RFC PATCH] cgcc: only define __CYGWIN32__ for -m32 builds

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

 



On Thu, Nov 28, 2019 at 05:45:06PM +0000, Ramsay Jones wrote:
> 
> Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> ---
> 
> Hi Luc,

Hi,

> This is marked RFC because it only improves the situation on 64-bit cygwin.
> Without access to a (up-to-date) 32-bit cygwin, I can't experiment to find
> a means to determine what platform I am on. I don't recall what the output
> of 'uname' is on 32-bit cygwin, but I have a hunch that you can't tell which
> is which from it's output. On 64-bit cygwin:
> 
>   $ uname -a
>   CYGWIN_NT-10.0 satellite 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64 Cygwin
>   $ uname -s
>   CYGWIN_NT-10.0
>   $ uname -o
>   Cygwin
>   $ 
> 
> [ie. I don't think 'uname -o' returns Cygwin32 or similar. :( ]

Indeed, I'm guess it doesn't. 

> So, I don't know.

I see several possibilities:
1)  just this patch, wich is OK for 64-bit platform/compiler
    where 32-bit needs to be forced with -m32
2)  simply not define __CYGWIN32__ at all based on the
    conviction that it's only __CYGWIN__ that should be tested
3a) in cgcc add 'm32=1' in the i386 part if $m64 is not set
3b) in cgcc add 'm64=1' in the x86_64 part if $m32 is not set
    and change this patch to test $m64 instead of testing $m32
4a) in sparse itself, add something like:
	if (arch_mach == MACH_X86_64 && arch_os == OS_CYGWIN)
		add_pre_buffer("#undef __CYGWIN32__");
    or:
	if (arch_m64 != LP32 && arch_os == OS_CYGWIN)
		add_pre_buffer("#undef __CYGWIN32__");
4b) do not define __CYGWIN32__ in cgcc and add something like:
	if (arch_mach == MACH_i386 && arch_os == OS_CYGWIN)
		add_pre_buffer("#define __CYG_WIN32__ 1");
    or:
	if (arch_m64 == LP32 && arch_os == OS_CYGWIN)
		add_pre_buffer("#define __CYGWIN32__ 1");

For the long term, I would prefer something like 4a) or 4b)
but currently it would only work for native builds.

So, I think that 3a) should be the best.

Best regards,
-- Luc



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux