[PATCH] Cygwin: Build cygwin-console-helper with correct compiler

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Jun 25 11:27:00 GMT 2019


On Jun 25 00:54, Mark Geisert wrote:
> ---
>  winsup/utils/Makefile.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
> index b64f457e7..cebf39572 100644
> --- a/winsup/utils/Makefile.in
> +++ b/winsup/utils/Makefile.in
> @@ -64,7 +64,7 @@ MINGW_BINS := ${addsuffix .exe,cygcheck cygwin-console-helper ldh strace}
>  # List all objects to be compiled in MinGW mode.  Any object not on this
>  # list will will be compiled in Cygwin mode implicitly, so there is no
>  # need for a CYGWIN_OBJS.
> -MINGW_OBJS := bloda.o cygcheck.o dump_setup.o ldh.o path.o strace.o
> +MINGW_OBJS := bloda.o cygcheck.o cygwin-console-helper.o dump_setup.o ldh.o path.o strace.o
>  MINGW_LDFLAGS:=-static
>  
>  CYGCHECK_OBJS:=cygcheck.o bloda.o path.o dump_setup.o
> -- 
> 2.21.0

Careful!  This leads to a warning when building on 64 bit:

  cygwin-console-helper.cc: In function 'int main(int, char**)':
  cygwin-console-helper.cc:8:48: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   HANDLE h = (HANDLE) strtoul (argv[1], &end, 0);
                                                ^
  cygwin-console-helper.cc:10:41: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   h = (HANDLE) strtoul (argv[2], &end, 0);
                                         ^

Note that strtoul returns an unsigned long.  Mingw compiles
for native Windows, which is LLP64 rather than LP64:

  mingw:sizeof(long) == 4
  cygwin:sizeof(long) == 8

This needs fixing as well (use strtoull).


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190625/ea61fde0/attachment.sig>


More information about the Cygwin-patches mailing list