[comp.emacs] crt0.c for Sun-4

jr@LF-SERVER-2.BBN.COM (John Robinson) (11/14/87)

I saw this on SunSpots and thought I'd post it here (has it already
gone by?  I forget.)

/jr
--------
Date:    2 Nov 87 20:49:02 GMT
From:    janssen@milano.UUCP
Subject: Re: GNU Emacs on the Sun-4

I've built gnu-emacs (18.46) for our new Sun-4, using crt0.c code
from eb@kent-state.UUCP (Eric Benson):

	asm(".seg \"text\"");
	asm(".global __start");
	asm("__start:");
	asm("mov	0, %fp");
	asm("ld	[%sp + 64], %o0");
	asm("add	%sp, 68, %o1");
	asm("sll	%o0, 2,	%o2");
	asm("add	%o2, 4,	%o2");
	asm("add	%o1, %o2, %o2");
	asm("sethi	%hi(_environ), %o3");
	asm("st	%o2, [%o3+%lo(_environ)]");
	asm("andn	%sp, 7,	%sp");
	asm("call	_main");
	asm("sub	%sp, 24, %sp");
	asm("call	_exit");
	asm("nop");
	asm("call	__exit");
	asm("nop");

It builds, and runs, but when find-file is called, crashes with a
segmentation violation.  I find that egetenv("HOME") returns a 0, rather
than a string, and the error occurs in strlen'ing the NULL.  I suspect
that _environ is not being set correctly.  Can you help?

Thanks for any tips.

Bill

Bill Janssen, MCC Software Technology Program
ARPA:  janssen@sw.mcc.com
UUCP:  {seismo,harvard,gatech,pyramid}!ut-sally!im4u!milano!janssen