Subject: Emacs support for NetBSD/Alpha
To: None <port-alpha@NetBSD.ORG>
From: Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU>
List: port-alpha
Date: 05/09/1996 21:01:19
I just submitted the following as a bug against emacs-19.30...  With
the ECOFF header changes I committed today, and the following diffs,
Emacs 19.30 works great on NetBSD/Alpha, including unexec support.

Hopefully, the next release will compile out of the box.


chris

------- Forwarded Message

          9 May 96 20:51:37 EDT
Date: Thu, 9 May 1996 20:51:32 -0400 (EDT)
Message-Id: <199605100051.UAA01592@bunnahabhain.pdl.cs.cmu.edu>
To: bug-gnu-emacs@prep.ai.mit.edu
Subject: Emacs (19.30) doesn't include support for NetBSD/Alpha
cc: cgd+@cs.cmu.edu
From: cgd+@cs.cmu.edu

In GNU Emacs 19.30.2 (alpha-unknown-netbsd1.1B) of Mon May  6 1996 on bunnahabhain.pdl.cs.cmu.edu

Emacs 19.30 doesn't include support for NetBSD/Alpha.  I've written
the code to do it, and have included diffs below.  Since this message
was sent from emacs running on NetBSD/Alpha, i figure they work OK.  8-)



chris
=========================================================================
diff -rc emacs-19.30.orig/configure emacs-19.30/configure
*** emacs-19.30.orig/configure	Mon Nov 20 01:42:18 1995
- --- emacs-19.30/configure	Mon May  6 14:57:11 1996
***************
*** 709,714 ****
- --- 709,715 ----
    *-*-netbsd* )
      opsys=netbsd
      case "${canonical}" in
+       alpha-*-netbsd*)	machine=alpha ;;
        i[345]86-*-netbsd*) machine=intel386 ;;
        m68k-*-netbsd*)
  			# This is somewhat bogus.
***************
*** 748,753 ****
- --- 749,756 ----
    alpha-*-linux* )
      machine=alpha opsys=linux
    ;;
+ 
+   # NetBSD/Alpha is above, under NetBSD ports
  
    ## Altos 3068
    m68*-altos-sysv* )
Only in emacs-19.30: paths.h.1722
diff -rc emacs-19.30.orig/src/m/alpha.h emacs-19.30/src/m/alpha.h
*** emacs-19.30.orig/src/m/alpha.h	Tue Nov 21 11:55:03 1995
- --- emacs-19.30/src/m/alpha.h	Mon May  6 16:31:01 1996
***************
*** 183,193 ****
  #define LINUX_SBRK_BUG
  #endif
  
  /* The program to be used for unexec. */
  
  #define UNEXEC unexalpha.o
  
- - 
  #define PNTR_COMPARISON_TYPE unsigned long
  
  /* On the 64 bit architecture, we can use 60 bits for addresses */
- --- 183,196 ----
  #define LINUX_SBRK_BUG
  #endif
  
+ #ifdef __NetBSD__
+ #define ORDINARY_LINK
+ #endif
+ 
  /* The program to be used for unexec. */
  
  #define UNEXEC unexalpha.o
  
  #define PNTR_COMPARISON_TYPE unsigned long
  
  /* On the 64 bit architecture, we can use 60 bits for addresses */
***************
*** 215,221 ****
- --- 218,228 ----
  
  #ifndef NOT_C_CODE
  /* We need these because pointers are larger than the default ints.  */
+ #ifndef __NetBSD__
  #include <alloca.h>
+ #else
+ #include <stdlib.h>
+ #endif
  
  /* Hack alert!  For reasons unknown to mankind the string.h file insists
     on defining bcopy etc. as taking char pointers as arguments.  With
diff -rc emacs-19.30.orig/src/s/netbsd.h emacs-19.30/src/s/netbsd.h
*** emacs-19.30.orig/src/s/netbsd.h	Sat Sep  9 22:13:15 1995
- --- emacs-19.30/src/s/netbsd.h	Mon May  6 16:31:12 1996
***************
*** 3,8 ****
- --- 3,12 ----
  /* Get most of the stuff from bsd4.3 */
  #include "bsd4-3.h"
  
+ #ifdef __alpha__
+ #define NO_SHARED_LIBS
+ #endif
+ 
  /* For mem-limits.h.  */
  #define BSD4_2
  
diff -rc emacs-19.30.orig/src/unexalpha.c emacs-19.30/src/unexalpha.c
*** emacs-19.30.orig/src/unexalpha.c	Sat Nov 11 15:27:38 1995
- --- emacs-19.30/src/unexalpha.c	Thu May  9 19:24:21 1996
***************
*** 26,35 ****
- --- 26,72 ----
  #include <sys/mman.h>
  #include <stdio.h>
  #include <varargs.h>
+ #ifndef __NetBSD__
  #include <filehdr.h>
  #include <aouthdr.h>
  #include <scnhdr.h>
  #include <syms.h>
+ #else /* __NetBSD__ */
+ /*
+  * NetBSD/Alpha does not have 'normal' user-land ECOFF support because
+  * there's no desire to support ECOFF as the executable format in the
+  * long term.
+  */
+ #include <sys/exec_ecoff.h>
+ 
+ /* Structures, constants, etc., that NetBSD defines strangely. */
+ #define	filehdr		ecoff_filehdr
+ #define	aouthdr		ecoff_aouthdr
+ #define	scnhdr		ecoff_scnhdr
+ #define	HDRR		struct ecoff_symhdr
+ #define	pHDRR		HDRR *
+ #define	cbHDRR		sizeof(HDRR)
+ #define	ALPHAMAGIC	ECOFF_MAGIC_NETBSD_ALPHA
+ #define	ZMAGIC		ECOFF_ZMAGIC
+ 
+ /* Misc. constants that NetBSD doesn't define at all. */
+ #define	ALPHAUMAGIC	0617
+ #define	_MIPS_NSCNS_MAX	35
+ #define	STYP_TEXT	0x00000020
+ #define	STYP_DATA	0x00000040
+ #define	STYP_BSS	0x00000080
+ #define	STYP_RDATA	0x00000100
+ #define	STYP_SDATA	0x00000200
+ #define	STYP_SBSS	0x00000400
+ #define	STYP_INIT	0x80000000
+ #define	_TEXT		".text"
+ #define	_DATA		".data"
+ #define	_BSS		".bss"
+ #define	_INIT		".init"
+ #define	_RDATA		".rdata"
+ #define	_SDATA		".sdata"
+ #define	_SBSS		".sbss"
+ #endif /* __NetBSD__ */
  
  static void fatal_unexec ();
  static void mark_x ();

------- End of Forwarded Message