summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>1999-03-22 23:04:13 +0000
committerwtc%netscape.com <devnull@localhost>1999-03-22 23:04:13 +0000
commit83a33887fdfbc8eaec07c57dc0b4c920408ec827 (patch)
treeaaae243622c434094a057c900460532abdf00494
parent134b812cd0408ee7e3da0605be02c6772f522665 (diff)
downloadnspr-hg-83a33887fdfbc8eaec07c57dc0b4c920408ec827.tar.gz
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.
-rw-r--r--config/BSD_OS.mk22
-rw-r--r--pr/include/md/_bsdi.cfg56
-rw-r--r--pr/include/md/_bsdi.h15
3 files changed, 84 insertions, 9 deletions
diff --git a/config/BSD_OS.mk b/config/BSD_OS.mk
index 02156a8f..87710cc5 100644
--- a/config/BSD_OS.mk
+++ b/config/BSD_OS.mk
@@ -16,12 +16,12 @@
#
#
-# 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
@@ -38,7 +38,16 @@ 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
@@ -50,8 +59,6 @@ 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)
@@ -59,9 +66,10 @@ 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
diff --git a/pr/include/md/_bsdi.cfg b/pr/include/md/_bsdi.cfg
index 8edf411c..4e1f3927 100644
--- a/pr/include/md/_bsdi.cfg
+++ b/pr/include/md/_bsdi.cfg
@@ -27,6 +27,8 @@
#define BSDI
#endif
+#if defined(__i386__)
+
#define IS_LITTLE_ENDIAN 1
#undef IS_BIG_ENDIAN
#define HAVE_LONG_LONG
@@ -73,6 +75,60 @@
#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
diff --git a/pr/include/md/_bsdi.h b/pr/include/md/_bsdi.h
index 9679f298..fc234297 100644
--- a/pr/include/md/_bsdi.h
+++ b/pr/include/md/_bsdi.h
@@ -25,7 +25,13 @@
#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
@@ -39,6 +45,8 @@
#define USE_SETJMP
+#ifndef _PR_PTHREADS
+
#include <setjmp.h>
#if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
@@ -156,13 +164,16 @@ struct _MDCPU {
#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)