summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2004-03-09 03:18:20 +0000
committerwchang0222%aol.com <devnull@localhost>2004-03-09 03:18:20 +0000
commit1e97693af2ce770f1f92efb40be501c271c20ed0 (patch)
tree5f27d0732c967b737005d56d38990c3f7326c900
parent1c235dd3736bc976bbd3d1e7b8348bcf18f0b332 (diff)
downloadnspr-hg-1e97693af2ce770f1f92efb40be501c271c20ed0.tar.gz
Bugzilla bug 232742: added Linux/amd64 support. The patch came from Gentoo
Linux's portage and was sent by Henrik Lynggaard Hansen <admin@mozillatranslator.org>. r=wtc. Modified Files: configure configure.in prprf.c _linux.cfg linux.h Added Files: os_Linux_x86_64.s Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rwxr-xr-xconfigure58
-rw-r--r--configure.in14
-rw-r--r--pr/include/md/_linux.cfg46
-rw-r--r--pr/include/md/_linux.h15
-rw-r--r--pr/src/io/prprf.c4
5 files changed, 108 insertions, 29 deletions
diff --git a/configure b/configure
index 06239676..d078222b 100755
--- a/configure
+++ b/configure
@@ -3736,6 +3736,9 @@ EOF
ia64)
PR_MD_ASFILES=os_Linux_ia64.s
;;
+ x86_64)
+ PR_MD_ASFILES=os_Linux_x86_64.s
+ ;;
m68k)
CFLAGS="$CFLAGS -m68020-60"
CXXFLAGS="$CXXFLAGS -m68020-60"
@@ -4206,17 +4209,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4210: checking for machine/builtins.h" >&5
+echo "configure:4213: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4215 "configure"
+#line 4218 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4483,9 +4486,14 @@ EOF
fi
_OPTIMIZE_FLAGS=-xO4
fi
- if test -n "$USE_64" && test -z "$GNU_CC"; then
- CC="$CC -xarch=v9"
- CXX="$CXX -xarch=v9"
+ if test -n "$USE_64"; then
+ if test -n "$GNU_CC"; then
+ CC="$CC -m64"
+ CXX="$CXX -m64"
+ else
+ CC="$CC -xarch=v9"
+ CXX="$CXX -xarch=v9"
+ fi
fi
if test "$OS_TEST" = "i86pc"; then
cat >> confdefs.h <<\EOF
@@ -4737,7 +4745,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4741: checking for dlopen in -ldl" >&5
+echo "configure:4749: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4745,7 +4753,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4749 "configure"
+#line 4757 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4756,7 +4764,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4773,17 +4781,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:4777: checking for dlfcn.h" >&5
+echo "configure:4785: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4782 "configure"
+#line 4790 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4816,13 +4824,13 @@ esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4820: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4828: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 4826 "configure"
+#line 4834 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -4840,7 +4848,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 4844 "configure"
+#line 4852 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -4864,12 +4872,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4868: checking for $ac_func" >&5
+echo "configure:4876: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4873 "configure"
+#line 4881 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4892,7 +4900,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4933,7 +4941,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:4937: checking for +Olit support" >&5
+echo "configure:4945: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4967,7 +4975,7 @@ esac
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:4971: checking for pthread_create in -lpthreads" >&5
+echo "configure:4979: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -4989,7 +4997,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:4993: checking for pthread_create in -lpthread" >&5
+echo "configure:5001: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5011,7 +5019,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5015: checking for pthread_create in -lc_r" >&5
+echo "configure:5023: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5033,7 +5041,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5037: checking for pthread_create in -lc" >&5
+echo "configure:5045: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5185,7 +5193,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5189: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5197: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5208,7 +5216,7 @@ echo "configure:5189: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5212: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5220: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
diff --git a/configure.in b/configure.in
index 85e9e0d4..7051a3fd 100644
--- a/configure.in
+++ b/configure.in
@@ -1222,6 +1222,9 @@ case "$target" in
ia64)
PR_MD_ASFILES=os_Linux_ia64.s
;;
+ x86_64)
+ PR_MD_ASFILES=os_Linux_x86_64.s
+ ;;
m68k)
CFLAGS="$CFLAGS -m68020-60"
CXXFLAGS="$CXXFLAGS -m68020-60"
@@ -1694,9 +1697,14 @@ mips-sony-newsos*)
fi
_OPTIMIZE_FLAGS=-xO4
fi
- if test -n "$USE_64" && test -z "$GNU_CC"; then
- CC="$CC -xarch=v9"
- CXX="$CXX -xarch=v9"
+ if test -n "$USE_64"; then
+ if test -n "$GNU_CC"; then
+ CC="$CC -m64"
+ CXX="$CXX -m64"
+ else
+ CC="$CC -xarch=v9"
+ CXX="$CXX -xarch=v9"
+ fi
fi
if test "$OS_TEST" = "i86pc"; then
AC_DEFINE(i386)
diff --git a/pr/include/md/_linux.cfg b/pr/include/md/_linux.cfg
index fb68d9d0..6a25d498 100644
--- a/pr/include/md/_linux.cfg
+++ b/pr/include/md/_linux.cfg
@@ -182,6 +182,52 @@
#define PR_BYTES_PER_WORD_LOG2 3
#define PR_BYTES_PER_DWORD_LOG2 3
+#elif defined(__x86_64__)
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_ENDIAN
+#define IS_64
+
+#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 8
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD 8
+#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 64
+#define PR_BITS_PER_FLOAT 32
+#define PR_BITS_PER_DOUBLE 64
+#define PR_BITS_PER_WORD 64
+
+#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 6
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2 6
+
+#define PR_ALIGN_OF_SHORT 2
+#define PR_ALIGN_OF_INT 4
+#define PR_ALIGN_OF_LONG 8
+#define PR_ALIGN_OF_INT64 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+#define PR_ALIGN_OF_WORD 8
+
+#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
#elif defined(__mc68000__)
#undef IS_LITTLE_ENDIAN
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
index a8c8b125..b18e1e6f 100644
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -49,6 +49,8 @@
#define _PR_SI_ARCHITECTURE "alpha"
#elif defined(__ia64__)
#define _PR_SI_ARCHITECTURE "ia64"
+#elif defined(__x86_64__)
+#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(__mc68000__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__sparc__)
@@ -109,6 +111,19 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET _PR_ia64_AtomicSet
#endif
+#if defined(__x86_64__)
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val);
+#define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement
+extern PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val);
+#define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement
+extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
+#define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd
+extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
+#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
+#endif
+
#define USE_SETJMP
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _PR_POLL_AVAILABLE
diff --git a/pr/src/io/prprf.c b/pr/src/io/prprf.c
index 1d3bd4c1..5f4de6f4 100644
--- a/pr/src/io/prprf.c
+++ b/pr/src/io/prprf.c
@@ -51,7 +51,9 @@
** Note: on some platforms va_list is defined as an array,
** and requires array notation.
*/
-#if (defined(LINUX) && defined(__powerpc__)) || \
+#if (defined(LINUX) && defined(__x86_64__))
+#define VARARGS_ASSIGN(foo, bar) __va_copy((foo), (bar))
+#elif (defined(LINUX) && defined(__powerpc__)) || \
(defined(LINUX) && defined(__s390__)) || \
(defined(LINUX) && defined(__s390x__)) || \
defined(WIN16) || defined(QNX) || \