delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/06/20:13:19

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <3A80A080.6D2333D@nc.rr.com>
Date: Tue, 06 Feb 2001 20:10:24 -0500
From: Greg Smith <gsmith AT nc DOT rr DOT com>
X-Mailer: Mozilla 4.76 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019