delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/28/22:31:54

To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Gnu Make crashes
Date: Thu, 28 Jul 94 15:06:01 PDT
From: Jonathan Ryshpan <jon AT halsp DOT hitachi DOT com>

I wrote:

Jon> I have just installed djgpp on a Compaq/386/Deskpro.  Everything seems
Jon> to work fine, except that make crashes.

And continued to Eli Zaretskii:

Jon> Make runs OK under vanilla DOS.  Under the MKS tools it won't run, even
Jon> without networking, TSRs, drivers, etc.

Eli Zaretskii replied:

Eli> Aha!  This makes the MKS tools, or whatever they do to your system, the
Eli> prime suspect (this of course includes possible bugs in DJGPP which
Eli> cause a crash when presented with MKS environment).
Eli> ...
Eli> Finally, I include a copy of make.exe compiled with -g ...

Eli is correct.  Make can't run under the MKS tools.  The problem is in
main.c around line 505.  The MKS tools present the invocation arguments
to the program being run in the form "~<arg>" -- ie "make -f makefile"
will generate an environment starting:
	~go32
	~make
	~-f
	~makefile
	TMP=d:
	...
This is to get around the limit of 128 chars in DOS invocation lines.

Make contains the code in main.c:
  496	
  497	  /* Read in variables from the environment.  This must be done
  498	     before `MAKE' and `MAKEOVERRIDES' are figured out so their
  499	     definitions will not be ones from the environment.  */
  500	
  501	  for (i = 0; envp[i] != 0; ++i)
  502	    {
  503	      register char *ep = envp[i];
  504	      while (*ep != '=')
  505		++ep;

The while loop in lines 504-505 is searching for a '=' in "~go32"; there
is none, so it searches past the end of the environment area which is at
the end of the data area.  And make crashes on a segmentatin violation.

I may post a correction to make sometime.  Probably there should be a
general solution to this problem in a utility similar to getopts()
called (say) getenv.  In the meantime, I'll get by with the make similar
to the one that comes with the MKS tools (dmake).

Does anyone know why the other compilation tools -- gcc, as, ld, etc --
*don't* crash under the MKS tools.

Many Thanks:

Jonathan Ryshpan                <jon AT halsp DOT hitachi DOT com>

	===============> I write for myself ONLY. <===============

- Raw text -


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