Web lists-archives.com

Re: 32 bit vs 64 bit Cygwin, followup

On Feb  4 09:16, Sam Habiel wrote:
> >That's not GCC fault.  You're running varargs, written for the standard
> >stack layout of the MSABI target from a function with a stack laid out
> >in SYSV ABI.  That can't work.
> I did some research to see how to write my own version of varargs (the
> code base is already instrumented to do different versions of varargs
> based on operating system). What I noticed though is that after
> disassembling code for win64 abi vs sysv abi, it seems like gcc/crt is
> attempting to do the right thing. There is different code for sysv vs
> win64 for va_start.
> sysv:
> 10        va_list vl;
> 11        va_start(vl,n);
>    0x00000001004010e4 <+100>:   movl   $0x8,-0xc8(%rbp)
>    0x00000001004010ee <+110>:   movl   $0x30,-0xc4(%rbp)
>    0x00000001004010f8 <+120>:   lea    0x10(%rbp),%rax
>    0x00000001004010fc <+124>:   mov    %rax,-0xc0(%rbp)
>    0x0000000100401103 <+131>:   lea    -0xb0(%rbp),%rax
>    0x000000010040110a <+138>:   mov    %rax,-0xb8(%rbp)
> win64:
> 10        va_list vl;
> 11        va_start(vl,n);
>    0x00000001004010a3 <+35>:    lea    0x18(%rbp),%rax
>    0x00000001004010a7 <+39>:    mov    %rax,-0x18(%rbp)
> So there may be a incomplete support for varargs for the sysv abi--but buggy.
> I attached the disassembly as well as the testing programs for your convenience.

There's nothing for me to do here.  You still have to make sure
to choose the right varargs version and if there's really a bug,
you really should report it to GCC.


Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature