Subject: emacs 19.22 with shared libraries
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Roland McGrath <roland@frob.com>
List: current-users
Date: 12/09/1993 06:04:00
With the following replacement for src/s/netbsd.h, I have successfully
built GNU Emacs 19.22 using the shared C library and shared X libraries.

For reasons beyond my comprehension, you need to extract brk.o and
cerror.o from /usr/lib/libc.a and link them into emacs statically.
Before I did this, emacs built and dumped fine, but the dumped emacs
bombed.  It seems that when the first shared library function called
in the dumped emacs is brk (to restore the break to the value at the
time of dumping), it executes bizarre and obviously bogus code and
gets a SEGV dereferencing address 7 rather quickly.  (By the way,
debugging this I happened to hang my system single-stepping into an
`lcall 7, 0' (with eax==17, i.e. brk) in gdb.  But I have an old
kernel; try it after syncing your disks.)


/* s/ file for netbsd system.  */

/* Get most of the stuff from bsd4.3 */
#include "bsd4-3.h"

#undef SYSTEM_TYPE
#define SYSTEM_TYPE "netbsd"

#undef KERNEL_FILE
#define KERNEL_FILE "/netbsd"

#undef LDAV_SYMBOL
#define LDAV_SYMBOL "_averunnable"

#define SIGNALS_VIA_CHARACTERS

#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)

#define A_TEXT_OFFSET(x) (sizeof (struct exec))
#define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))

#define HAVE_SETSID

#define LIBS_DEBUG
#define LIBS_SYSTEM -lutil

#define HAVE_GETLOADAVG

#define NEED_ERRNO

/* For mem-limits.h.  */
#define BSD4_2

/* Experiment */
#define BROKEN_START
#define TEXT_START ({ extern void start() asm ("start"); &start; })
#define START_FILES pre-crt0.o /usr/lib/crt0.o
#define UNEXEC	unexsunos4.o
#define RUN_TIME_REMAP
#define N_PAGSIZ(x) __LDPGSZ
#define N_BSSADDR(x) (N_ALIGN(x, N_DATADDR(x)+x.a_data))
#define N_TRELOFF(x) N_RELOFF(x)
#define LINKER ld -X -Bdynamic
#define OBJECTS_SYSTEM brk.o cerror.o /* XXX extract from libc.a */

------------------------------------------------------------------------------