Subject: Re: emacs in pkgsrc not building
To: Alistair Crooks <>
From: John F. Woods <>
List: current-users
Date: 10/16/1997 09:02:19
> 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?

The start label is correctly aligned, thanks to a ".align 2" in the code
(not that the x86 cares about instruction alignment).

What's INTERESTING though is that the binary isn't starting at the start
address (which is 0x1058).  It is starting at address 0x1020 -- in the middle
of the RCS string.  Which JUST HAPPENS to have the "instructions"
	0x1020: andb   $0x4e,%al
	0x1022: je     0x1067 <start+15>
so it jumps into the middle of the start function, does something stupid,
then faults on a 0 argv pointer.

The C command line which builds the temacs object is (approximately)

cc -nostdlib -Xlinker -L/usr/X11R6/lib -o temacs pre_crt0.o crt0.o {millions
of objects} -L/usr/X11R6/lib {X11 libraries} -ltermcap /usr/lib/libgcc.a -lm
-lc /usr/lib/libgcc.a

I tried building a new linker, which didn't help

	and which curdled my system BADLY because the install process
	corrupted /usr/libexec/!!!  strip coredumped trying to
	strip!  Recompiling strip (after recovering a working from my emergency backup root) made it work:  another of
	thos little gotchas lurking for people who upgrade piecemeal.

However, adding an explicit "-e start" to the cc command line generated a
viable temacs executable which went on to do the right thing.

The GNU sort of has an option to set the start address:

/* Specify address for ld to start loading at,
   if requested by configuration.  */

Unfortunately, it doesn't set it correctly, since we need "start" and not

Supposedly emacs-20.2.1 builds cleanly; I'll ask the person who built it if
they changed the load process appropriately...