[comp.sys.atari.st] bug in gcc V1.34 crt0.s -- fix included

bammi@dsrgsun.ces.cwru.edu (Jwahar R. Bammi) (03/11/89)

Thanks to eric smith who reported the following serious bug in
gcc V1.34 startup file (crt0.s):

i had tried to include a redirection for stderr to console, so that
gcc applications would not need a wrapper shell to run in by doing
a 
	Fforce(2,(short)Fdup(1))
in crt0.s. This works fine, until you try to redirect stdout from
a shell (like gulam)
	a.out > foo
what happens is that stdout and stderr end up in foo (another exotic TOS
bug -- is this fixed in tos 1.4??)
Now if you try to run this program a second time:
	- i get error code -61
	- eric smith reported that some files got trashed
so depending on your setup, i suspect one of the two will happen.
Please apply the patch enclosed below that backs out these changes, and
recompile and install crt0.o in $GNULIB. Hopefully we will come up
with a better scheme for stderr soon:
--
*** crt0.s~	Fri Mar 10 16:00:34 1989
--- crt0.s	Fri Mar 10 16:01:00 1989
***************
*** 146,162 ****
  |	movw	d3, sp@-		| push argc
  	movel	d3,sp@-			| .. jrd
  
- 	movw	#1, sp@-		| set up stderr  ++jrb
- 	movw	#0x45,sp@-		| Fforce(2,(int)Fdup(1))
- 	trap	#1
- 	movw	d0,sp@-
- 	movw	#2,sp@-
- 	movw	#0x46,sp@-		| Fforce
- 	trap	#1
- 	lea	sp@(10),sp		| adjust stack
- 
- 	subl	a6, a6			| clear link reg - why I don't know
- 
  	| here we set up a trap handler for address errors - this is used in
  	| doing long branches and long bsrs (see comments in Leat()).
  
--- 146,151 ----
usenet: {decvax,sun}!cwjcc!dsrgsun!bammi	jwahar r. bammi
csnet:       bammi@dsrgsun.ces.CWRU.edu
arpa:        bammi@dsrgsun.ces.CWRU.edu
compuServe:  71515,155