Merged NSPR patches for BSD/OS 4.0.1 + sparc, contributed by
authorwtc%netscape.com
Mon, 22 Mar 1999 23:04:13 +0000
changeset 501 756f68109a6cb32b79c4ab5d869d134c7b987a26
parent 500 b67594188e8e50780af37500e3d5050d6ed85d08
child 502 32f21fd2be4625ea0093a33443bb685e285cce70
push idunknown
push userunknown
push dateunknown
Merged NSPR patches for BSD/OS 4.0.1 + sparc, contributed by Kurt J. Lidl <lidl@eng.us.uu.net>. Modified files: BSD_OS.mk, _bsdi.cfg, _bsdi.h.
config/BSD_OS.mk
pr/include/md/_bsdi.cfg
pr/include/md/_bsdi.h
--- a/config/BSD_OS.mk
+++ b/config/BSD_OS.mk
@@ -11,59 +11,67 @@
 # 
 # The Initial Developer of this code under the NPL is Netscape
 # Communications Corporation.  Portions created by Netscape are
 # Copyright (C) 1998 Netscape Communications Corporation.  All Rights
 # Reserved.
 #
 
 #
-# Config stuff for BSDI Unix for x86.
+# Config stuff for BSD/OS Unix.
 #
 
 include $(MOD_DEPTH)/config/UNIX.mk
 
-ifeq (,$(filter-out 1.1 4.0,$(OS_RELEASE)))
+ifeq (,$(filter-out 1.1 4.0 4.0.1,$(OS_RELEASE)))
 CC		= gcc -Wall -Wno-format
 CCC		= g++
 else
 CC		= shlicc2
 CCC		= shlicc2
 endif
 RANLIB		= ranlib
 
 ifeq ($(USE_PTHREADS),1)
 IMPL_STRATEGY = _PTH
 DEFINES		+= -D_PR_NEED_PTHREAD_INIT
 else
 IMPL_STRATEGY = _EMU
 DEFINES		+= -D_PR_LOCAL_THREADS_ONLY
 endif
 
-OS_CFLAGS	= -DBSDI -DHAVE_STRERROR -D__386BSD__ -DNEED_BSDREGEX -Di386
+OS_CFLAGS	= $(DSO_CFLAGS) -DBSDI -DHAVE_STRERROR -DNEED_BSDREGEX
+
+ifeq (86,$(findstring 86,$(OS_TEST)))
+CPU_ARCH	= x86
+OS_CFLAGS	+= -D__386BSD__ -Di386
+endif
+ifeq (sparc,$(findstring sparc,$(OS_TEST)))
+CPU_ARCH	= sparc
+OS_CFLAGS	+= -D__sparc__ -Dsparc
+endif
 
 ifeq ($(OS_RELEASE),2.1)
 OS_CFLAGS	+= -D_PR_TIMESPEC_HAS_TS_SEC
 endif
 
 ifeq (,$(filter-out 1.1 2.1,$(OS_RELEASE)))
 OS_CFLAGS	+= -D_PR_BSDI_JMPBUF_IS_ARRAY
 else
 OS_CFLAGS	+= -D_PR_SELECT_CONST_TIMEVAL -D_PR_BSDI_JMPBUF_IS_STRUCT
 endif
 
-CPU_ARCH	= x86
-
 NOSUCHFILE	= /no-such-file
 
 ifeq ($(OS_RELEASE),1.1)
 OS_CFLAGS	+= -D_PR_STAT_HAS_ONLY_ST_ATIME -D_PR_NEED_H_ERRNO
 else
 OS_CFLAGS	+= -DHAVE_DLL -DUSE_DLFCN -D_PR_STAT_HAS_ST_ATIMESPEC
 OS_LIBS		= -ldl
-ifeq ($(OS_RELEASE),4.0)
+ifeq (,$(filter-out 4.0 4.0.1,$(OS_RELEASE)))
 MKSHLIB		= $(CC) $(DSO_LDOPTS)
-DSO_LDOPTS	= -shared
+DSO_CFLAGS	= -fPIC
+DSO_LDOPTS	= -shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)
 else
 MKSHLIB		= $(LD) $(DSO_LDOPTS)
 DSO_LDOPTS	= -r
 endif
 endif
--- a/pr/include/md/_bsdi.cfg
+++ b/pr/include/md/_bsdi.cfg
@@ -22,16 +22,18 @@
 #ifndef XP_UNIX
 #define XP_UNIX
 #endif
 
 #ifndef BSDI
 #define BSDI
 #endif
 
+#if defined(__i386__)
+
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
 #define PR_BYTES_PER_BYTE   1
 #define PR_BYTES_PER_SHORT  2
@@ -68,16 +70,70 @@
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 #define PR_ALIGN_OF_WORD    4
 
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
+#elif defined(__sparc__)
+
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN 1
+#define HAVE_LONG_LONG
+#define	HAVE_ALIGNED_DOUBLES
+#define	HAVE_ALIGNED_LONGLONGS
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    32
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   5
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   8
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  8
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
+#else
+
+#error "Unknown CPU architecture"
+
+#endif
+
 #ifndef NO_NSPR_10_SUPPORT
 
 #define BYTES_PER_BYTE		PR_BYTES_PER_BYTE
 #define BYTES_PER_SHORT 	PR_BYTES_PER_SHORT
 #define BYTES_PER_INT 		PR_BYTES_PER_INT
 #define BYTES_PER_INT64		PR_BYTES_PER_INT64
 #define BYTES_PER_LONG		PR_BYTES_PER_LONG
 #define BYTES_PER_FLOAT		PR_BYTES_PER_FLOAT
--- a/pr/include/md/_bsdi.h
+++ b/pr/include/md/_bsdi.h
@@ -20,30 +20,38 @@
 #define nspr_bsdi_defs_h___
 
 /*
  * Internal configuration macros
  */
 
 #define PR_LINKER_ARCH	"bsdi"
 #define _PR_SI_SYSNAME "BSDI"
+#if defined(__i386__)
 #define _PR_SI_ARCHITECTURE "x86"
+#elif defined(__sparc__)
+#define _PR_SI_ARCHITECTURE "sparc"
+#else
+#error "Unknown CPU architecture"
+#endif
 #define PR_DLL_SUFFIX		".so"
 
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #define HAVE_BSD_FLOCK
 #define NEED_TIME_R
 #define _PR_HAVE_SOCKADDR_LEN
 #define _PR_NO_LARGE_FILES
 
 #define USE_SETJMP
 
+#ifndef _PR_PTHREADS
+
 #include <setjmp.h>
 
 #if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
 #define _MD_GET_SP(_t)    (_t)->md.context[2] 
 #elif defined(_PR_BSDI_JMPBUF_IS_STRUCT)
 #define _MD_GET_SP(_t)    (_t)->md.context[0].jb_esp
 #else
 #error "Unknown BSDI jmp_buf type"
@@ -151,22 +159,25 @@ struct _MDCPU {
 #define _MD_NEW_LOCK(lock) PR_SUCCESS
 #define _MD_FREE_LOCK(lock)
 #define _MD_LOCK(lock)
 #define _MD_UNLOCK(lock)
 #define _MD_INIT_IO()
 #define _MD_IOQ_LOCK()
 #define _MD_IOQ_UNLOCK()
 
-#define _MD_EARLY_INIT          _MD_EarlyInit
-#define _MD_FINAL_INIT			_PR_UnixInit
 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
 #define _MD_INIT_THREAD         _MD_InitializeThread
 #define _MD_EXIT_THREAD(thread)
 #define _MD_CLEAN_THREAD(_thread)
 
+#endif /* ! _PR_PTHREADS */
+
+#define _MD_EARLY_INIT          _MD_EarlyInit
+#define _MD_FINAL_INIT			_PR_UnixInit
+
 #include <sys/syscall.h>
 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
 
 #define _MD_GET_INTERVAL                  _PR_UNIX_GetInterval
 #define _MD_INTERVAL_PER_SEC              _PR_UNIX_TicksPerSecond
 
 #endif /* nspr_bsdi_defs_h___ */