Subject: Re: emacs in pkgsrc not building
To: John F. Woods <>
From: Alistair Crooks <>
List: current-users
Date: 10/16/1997 02:37:37
> As I said before, I'm not able to get emacs running by building it from
> the newly-committed package stuff:
> 	./temacs -batch -l loadup dump
> 	*** Signal 11
> 	Stop.
> According to gdb, it is crashing in __start, and never gets into main().
> The stack is strange; it appears that there are three extra zero words
> between argc/argv/envp as passed to __start and the return address __start
> sees (0x1071).  Interestingly, ___ps_strings contained 0.
> One semi-obvious way for this to happen was for start to get called
> reentrantly, or so I thought; I then came up with a customized version of
> crt0.c which tests the value of ___ps_strings and does int3 (x86 software
> interrupt) if it is nonzero.  I build emacs with my local crt0.o, and then
> watch it happily compile lisp source into lisp binary ready for dumping.
> Huh?
> I then observe that my crt0.o is about 3300 bytes long; /usr/lib/crt0.o is
> 2817.  Looking VERY carefully at the c-runtime makefiles and my hand-typed
> compile line, I discover that I left off two flags:  -O and -DLIBC_SCCS.
> I recompile crt0.o with -O.  *It works fine.*  I recompile it with -DLIBC_SCCS.
> *** Signal 11.

Assuming that you're running i386 (duh), and from looking at traffic on
the port-sparc list, the start of /usr/src/lib/csu/i386/crt0.c says:

#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: crt0.c,v 1.27 1997/10/09 12:29:24 lukem Exp $");
#endif /* LIBC_SCCS and not lint */

and <sys/cdefs.h> has the lines:

#define __IDSTRING(name,string) \
        static const char name[] __attribute__((__unused__)) = string
#ifndef __RCSID
#define __RCSID(s) __IDSTRING(rcsid,s)

I think the recent change to add 'const' to the __IDSTRING means that gcc
puts the resulting string in the text section (if my reading of the
sparc stuff is correct), which means that the start label in crt0.c is
then moved by an amount determined by the size of the string. The sparc
port didn't have an alignment statement, IIRC, and so everything got a
little out of alignment. Is your start label correctly aligned?

This is the only explanation I can give for the fact that compiling with
LIB_SCCS defined gives a SIGSEGV, but without works.