delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/10/26/09:02:14

Date: Tue, 26 Oct 1999 15:42:07 +0300 (EET DST)
From: Esa A E Peuha <peuha AT cc DOT helsinki DOT fi>
To: djgpp-workers AT delorie DOT com
Subject: Small problem in crt0.S
Message-ID: <Pine.OSF.4.20.9910261513110.23920-100000@sirppi.helsinki.fi>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

When crt0.S allocates memory for the stubinfo structure, it doesn't check
whether the allocation failed (while this is not very likely, it's
possible, and I can send you a version of MWDPMI for which it does).  The
following patch is only meant to indicate the place of the problem, it 
doesn't solve it since the exit code references __stubinfo, and I'm not
sure how to fix that.  I was also wondering why the code at no_memory
(currently called only when stack can't be allocated) doesn't print an
error message.  BTW, MWDPMI is available at
http://www.helsinki.fi/~peuha/english/djgpp/mwdpmi00.zip ; please try it
and tell what you think.

Index: crt0.S
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/crt0/crt0.S,v
retrieving revision 1.4
diff -c -r1.4 crt0.S
*** crt0.S	1999/08/11 06:24:37	1.4
--- crt0.S	1999/10/25 12:51:11
***************
*** 238,243 ****
--- 238,245 ----
  	movl	STUBINFO_SIZE, %eax
  	pushl	%eax
  	call	___sbrk
+ 	cmpl	$-1, %eax
+ 	je	no_memory
  	movl	%eax, __stubinfo
  	movl	%eax, %edi
  	.byte 0x64 /* fs: */

-- 
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/

- Raw text -


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