This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc linkage woes


In a previous life (I beleive this was about 5 days ago ;-) Corrina
superbly answered some basic questions I had.  We've moved on to a
new version of our software (http://www.conmicro.cx/hercules/) and
have encountered some weirdness on win32 under cygwin but not under
some other operating systems that may or may not begin with the
letter `l'.  OK, so this is basically hobbyist software and people
aren't dying and nobody's losing money.

There is [at least] one routine that has a local stack size over 4K.
In the previous version, the beginning of the routine looked like:

   routine entry
	push   %ebp
	mov    %esp,%ebp
	mov    $0x303c,%eax
	call   0x48af98 <_alloca>
	push   %edi
	push   %esi
	push   %ebx

   r1 = parm1[3] >> 4;
	mov    0x8(%ebp),%eax
	add    $0x3,%eax
	mov    (%eax),%dl
	shr    $0x4,%dl

Now the beginning of our routine is looking like:

   routine entry:
	mov    $0x303c,%eax
	call   0x59b66c <_alloca>
	push   %ebp
	push   %edi
	push   %esi
	push   %ebx
	mov    %eax,0x303c(%esp,1)
	mov    %edx,0x3038(%esp,1)
	mov    %ecx,0x3034(%esp,1)

   r1 = parm1[3] >> 4;
	mov    0x303c(%esp,1),%eax
	add    $0x3,%eax
	mov    (%eax),%dl
	shr    $0x4,%dl

Well %eax, which has parm1, gets trashed, and we get garbage in our
variable `r1'!!

We can bypass the problem by making our local stack size less than 4K
and malloc() the storage we need.

Hints ??  (Yes!! I know!! I'm considering contributing!! perhaps in the
pthreads area... is cygwin in RTP ?  just curious, 'cause I'm in the area)

Thanks, Greg

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]