Subject: emacs 19.22 with shared libraries
To: None <>
From: Roland McGrath <>
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"

#define SYSTEM_TYPE "netbsd"

#define KERNEL_FILE "/netbsd"

#define LDAV_SYMBOL "_averunnable"


#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 LIBS_DEBUG
#define LIBS_SYSTEM -lutil


#define NEED_ERRNO

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

/* Experiment */
#define TEXT_START ({ extern void start() asm ("start"); &start; })
#define START_FILES pre-crt0.o /usr/lib/crt0.o
#define UNEXEC	unexsunos4.o
#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 */