aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@pierdol.cobaltmicro.com>1998-09-09 02:43:28 +0000
committerDavid S. Miller <davem@gcc.gnu.org>1998-09-08 19:43:28 -0700
commitd559a4dbddeccc438d8656e33e41138ea8d4a3e1 (patch)
tree55ee129486eb2022aa165d69de10cdf5f921019b /gcc/config/sparc
parent67cb8900b033503cf7c7b00f636506e7a51c2e2c (diff)
downloadgcc-d559a4dbddeccc438d8656e33e41138ea8d4a3e1.zip
gcc-d559a4dbddeccc438d8656e33e41138ea8d4a3e1.tar.gz
gcc-d559a4dbddeccc438d8656e33e41138ea8d4a3e1.tar.bz2
Add preliminary native sparcv9 Solaris support.
* configure.in: Recognize sparv9-*-solaris2* * configure: rebuilt * config.sub: Recognize sparcv9 just like sparc64. * config/sparc/sol2-c1.asm config/sparc/sol2-ci.asm config/sparc/sol2-cn.asm: Macroize so it can be shared between 32-bit and 64-bit Solaris systems. * config/sparc/t-sol2: Assemble those with cpp. * config/sparc/sparc.h (TARGET_CPU_sparcv9): New alias for v9. (*TF*_LIBCALL): If ARCH64 use V9 names. * config/sparc/{xm-sysv4-64,sol2-sld-64}.h: New files. From-SVN: r22345
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r--gcc/config/sparc/sol2-c1.asm42
-rw-r--r--gcc/config/sparc/sol2-ci.asm8
-rw-r--r--gcc/config/sparc/sol2-cn.asm2
-rw-r--r--gcc/config/sparc/sol2-sld-64.h110
-rw-r--r--gcc/config/sparc/sparc.h40
-rw-r--r--gcc/config/sparc/t-sol210
-rw-r--r--gcc/config/sparc/xm-sysv4-64.h25
7 files changed, 203 insertions, 34 deletions
diff --git a/gcc/config/sparc/sol2-c1.asm b/gcc/config/sparc/sol2-c1.asm
index 618d698..894a8c3 100644
--- a/gcc/config/sparc/sol2-c1.asm
+++ b/gcc/config/sparc/sol2-c1.asm
@@ -1,4 +1,4 @@
-! crt1.s for solaris 2.0.
+! crt1.s for sparc & sparcv9 (SunOS 5)
! Copyright (C) 1992 Free Software Foundation, Inc.
! Written By David Vinayak Henkel-Wallace, June 1992
@@ -37,43 +37,67 @@
! in section 3 of the SVr4 ABI.
! This file is the first thing linked into any executable.
+#ifdef __sparcv9
+#define CPTRSIZE 8
+#define CPTRSHIFT 3
+#define STACK_BIAS 2047
+#define ldn ldx
+#define stn stx
+#define setn(s, scratch, dst) setx s, scratch, dst
+#else
+#define CPTRSIZE 4
+#define CPTRSHIFT 2
+#define STACK_BIAS 0
+#define ldn ld
+#define stn st
+#define setn(s, scratch, dst) set s, dst
+#endif
+
.section ".text"
.proc 022
.global _start
_start:
mov 0, %fp ! Mark bottom frame pointer
- ld [%sp + 64], %l0 ! argc
- add %sp, 68, %l1 ! argv
+ ldn [%sp + (16 * CPTRSIZE) + STACK_BIAS], %l0 ! argc
+ add %sp, (17 * CPTRSIZE) + STACK_BIAS, %l1 ! argv
! Leave some room for a call. Sun leaves 32 octets (to sit on
! a cache line?) so we do too.
+#ifdef __sparcv9
+ sub %sp, 48, %sp
+#else
sub %sp, 32, %sp
+#endif
! %g1 may contain a function to be registered w/atexit
orcc %g0, %g1, %g0
+#ifdef __sparcv9
+ be %xcc, .nope
+#else
be .nope
+#endif
mov %g1, %o0
call atexit
nop
.nope:
! Now make sure constructors and destructors are handled.
- set _fini, %o0
+ setn(_fini, %o1, %o0)
call atexit, 1
nop
call _init, 0
nop
- ! We ignore the auxiliary vector; there's no defined way to
+ ! We ignore the auxiliary vector; there is no defined way to
! access those data anyway. Instead, go straight to main:
mov %l0, %o0 ! argc
mov %l1, %o1 ! argv
! Skip argc words past argv, to env:
- sll %l0, 2, %o2
- add %o2, 4, %o2
+ sll %l0, CPTRSHIFT, %o2
+ add %o2, CPTRSIZE, %o2
add %l1, %o2, %o2 ! env
- set _environ, %o3
- st %o2, [%o3] ! *_environ
+ setn(_environ, %o4, %o3)
+ stn %o2, [%o3] ! *_environ
call main, 4
nop
call exit, 0
diff --git a/gcc/config/sparc/sol2-ci.asm b/gcc/config/sparc/sol2-ci.asm
index dd09a34..3dc793c 100644
--- a/gcc/config/sparc/sol2-ci.asm
+++ b/gcc/config/sparc/sol2-ci.asm
@@ -48,7 +48,11 @@
.type _init,#function
.align 4
_init:
+#ifdef __sparcv9
+ save %sp, -176, %sp
+#else
save %sp, -96, %sp
+#endif
.section ".fini"
@@ -57,4 +61,8 @@ _init:
.type _fini,#function
.align 4
_fini:
+#ifdef __sparcv9
+ save %sp, -176, %sp
+#else
save %sp, -96, %sp
+#endif
diff --git a/gcc/config/sparc/sol2-cn.asm b/gcc/config/sparc/sol2-cn.asm
index 3c5d508..49e070f 100644
--- a/gcc/config/sparc/sol2-cn.asm
+++ b/gcc/config/sparc/sol2-cn.asm
@@ -51,4 +51,4 @@
ret
restore
-! Th-th-th-that's all folks!
+! Th-th-th-that is all folks!
diff --git a/gcc/config/sparc/sol2-sld-64.h b/gcc/config/sparc/sol2-sld-64.h
new file mode 100644
index 0000000..17dd842
--- /dev/null
+++ b/gcc/config/sparc/sol2-sld-64.h
@@ -0,0 +1,110 @@
+/* Definitions of target machine for GNU compiler, for 64-bit SPARC
+ running Solaris 2 using the system linker. */
+
+#include "sparc/sol2.h"
+
+/* At least up through Solaris 2.6,
+ the system linker does not work with DWARF or DWARF2,
+ since it does not have working support for relocations
+ to unaligned data. */
+
+#define LINKER_DOES_NOT_WORK_WITH_DWARF2
+
+/* A 64 bit v9 compiler with stack-bias */
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+ (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
+
+/* ??? bi-architecture support will require changes to the linker
+ related specs, among perhaps other things (multilibs). */
+/* #define SPARC_BI_ARCH */
+
+/* The default code model. */
+#undef SPARC_DEFAULT_CMODEL
+#define SPARC_DEFAULT_CMODEL CM_MEDLOW
+
+#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 128
+
+#if TARGET_CPU_DEFAULT == TARGET_CPU_v9
+#undef CPP_CPU_DEFAULT_SPEC
+#define CPP_CPU_DEFAULT_SPEC "-D__sparcv9"
+#undef ASM_CPU_DEFAULT_SPEC
+#define ASM_CPU_DEFAULT_SPEC "-xarch=v9"
+#undef CPP_CPU_SPEC
+#define CPP_CPU_SPEC "\
+%{mcypress:} \
+%{msparclite:-D__sparclite__} \
+%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
+%{mv8:-D__sparcv8} \
+%{msupersparc:-D__supersparc__ -D__sparcv8} \
+%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
+%{mcpu=sparclite:-D__sparclite__} \
+%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
+%{mcpu=v8:-D__sparc_v8__} \
+%{mcpu=supersparc:-D__supersparc__ -D__sparcv8} \
+%{mcpu=v9:-D__sparcv9 -D_LP64} \
+%{mcpu=ultrasparc:-D__sparcv9 -D_LP64} \
+%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
+"
+#endif
+#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
+#undef CPP_CPU_DEFAULT_SPEC
+#define CPP_CPU_DEFAULT_SPEC "-D__sparcv9 -D_LP64"
+#undef ASM_CPU_DEFAULT_SPEC
+#define ASM_CPU_DEFAULT_SPEC "-xarch=v9a"
+#undef CPP_CPU_SPEC
+#define CPP_CPU_SPEC "\
+%{mcypress:} \
+%{msparclite:-D__sparclite__} \
+%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \
+%{mv8:-D__sparcv8} \
+%{msupersparc:-D__supersparc__ -D__sparcv8} \
+%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \
+%{mcpu=sparclite:-D__sparclite__} \
+%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \
+%{mcpu=v8:-D__sparc_v8__} \
+%{mcpu=supersparc:-D__supersparc__ -D__sparcv8} \
+%{mcpu=v9:-D__sparcv9 -D_LP64} \
+%{mcpu=ultrasparc:-D__sparcv9} \
+%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
+"
+#endif
+
+#undef ASM_CPU_SPEC
+#define ASM_CPU_SPEC "\
+%{mcpu=v8plus:-xarch=v8plus} \
+%{mcpu=ultrasparc:-xarch=v9a} \
+%{!mcpu*:%(asm_cpu_default)} \
+"
+
+/*
+ * This should be the same as in sol2-sld.h, except with "/sparcv9"
+ * appended to the paths and /usr/ccs/lib is no longer necessary
+ */
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{h*} %{v:-V} \
+ %{b} %{Wl,*:%*} \
+ %{static:-dn -Bstatic} \
+ %{shared:-G -dy %{!mimpure-text:-z text}} \
+ %{symbolic:-Bsymbolic -G -dy -z text} \
+ %{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \
+ %{G:-G} \
+ %{YP,*} \
+ %{R*} \
+ %{compat-bsd: \
+ %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
+ %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
+ %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \
+ -R /usr/ucblib} \
+ %{!compat-bsd: \
+ %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
+ %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \
+ %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \
+ %{Qy:} %{!Qn:-Qy}"
+
+#undef MD_STARTFILE_PREFIX
+#define MD_STARTFILE_PREFIX "/usr/ccs/lib/sparcv9/"
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 3891fd6..cffa476 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -105,6 +105,7 @@ extern enum cmodel sparc_cmodel;
#define TARGET_CPU_v8 3 /* generic v8 implementation */
#define TARGET_CPU_supersparc 4
#define TARGET_CPU_v9 5 /* generic v9 implementation */
+#define TARGET_CPU_sparcv9 5 /* alias */
#define TARGET_CPU_sparc64 5 /* alias */
#define TARGET_CPU_ultrasparc 6
@@ -2607,25 +2608,26 @@ extern struct rtx_def *legitimize_pic_address ();
#define MULSI3_LIBCALL "*.umul"
/* Define library calls for quad FP operations. These are all part of the
- SPARC ABI. */
-#define ADDTF3_LIBCALL "_Q_add"
-#define SUBTF3_LIBCALL "_Q_sub"
-#define NEGTF2_LIBCALL "_Q_neg"
-#define MULTF3_LIBCALL "_Q_mul"
-#define DIVTF3_LIBCALL "_Q_div"
-#define FLOATSITF2_LIBCALL "_Q_itoq"
-#define FIX_TRUNCTFSI2_LIBCALL "_Q_qtoi"
-#define FIXUNS_TRUNCTFSI2_LIBCALL "_Q_qtou"
-#define EXTENDSFTF2_LIBCALL "_Q_stoq"
-#define TRUNCTFSF2_LIBCALL "_Q_qtos"
-#define EXTENDDFTF2_LIBCALL "_Q_dtoq"
-#define TRUNCTFDF2_LIBCALL "_Q_qtod"
-#define EQTF2_LIBCALL "_Q_feq"
-#define NETF2_LIBCALL "_Q_fne"
-#define GTTF2_LIBCALL "_Q_fgt"
-#define GETF2_LIBCALL "_Q_fge"
-#define LTTF2_LIBCALL "_Q_flt"
-#define LETF2_LIBCALL "_Q_fle"
+ SPARC ABI.
+ ??? ARCH64 still does not work as the _Qp_* routines take pointers. */
+#define ADDTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_add" : "_Q_add")
+#define SUBTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_sub" : "_Q_sub")
+#define NEGTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_neg" : "_Q_neg")
+#define MULTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_mul" : "_Q_mul")
+#define DIVTF3_LIBCALL (TARGET_ARCH64 ? "_Qp_div" : "_Q_div")
+#define FLOATSITF2_LIBCALL (TARGET_ARCH64 ? "_Qp_itoq" : "_Q_itoq")
+#define FIX_TRUNCTFSI2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtoi" : "_Q_qtoi")
+#define FIXUNS_TRUNCTFSI2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtoui" : "_Q_qtou")
+#define EXTENDSFTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_stoq" : "_Q_stoq")
+#define TRUNCTFSF2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtos" : "_Q_qtos")
+#define EXTENDDFTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_dtoq" : "_Q_dtoq")
+#define TRUNCTFDF2_LIBCALL (TARGET_ARCH64 ? "_Qp_qtod" : "_Q_qtod")
+#define EQTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_feq" : "_Q_feq")
+#define NETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fne" : "_Q_fne")
+#define GTTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fgt" : "_Q_fgt")
+#define GETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fge" : "_Q_fge")
+#define LTTF2_LIBCALL (TARGET_ARCH64 ? "_Qp_flt" : "_Q_flt")
+#define LETF2_LIBCALL (TARGET_ARCH64 ? "_Qp_fle" : "_Q_fle")
/* We can define the TFmode sqrt optab only if TARGET_FPU. This is because
with soft-float, the SFmode and DFmode sqrt instructions will be absent,
diff --git a/gcc/config/sparc/t-sol2 b/gcc/config/sparc/t-sol2
index d41254a..817a032f 100644
--- a/gcc/config/sparc/t-sol2
+++ b/gcc/config/sparc/t-sol2
@@ -12,13 +12,13 @@ gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hd
# Assemble startup files.
crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crt1.o -x assembler $(srcdir)/config/sparc/sol2-c1.asm
+ $(GCC_FOR_TARGET) -c -o crt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm
crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm
+ $(GCC_FOR_TARGET) -c -o crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm
crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm
-gcrt1.o: $(srcdir)/config/sparc/sol2-g1.asm $(GCC_PASSES)
- $(GCC_FOR_TARGET) -c -o gcrt1.o -x assembler $(srcdir)/config/sparc/sol2-g1.asm
+ $(GCC_FOR_TARGET) -c -o crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm
+gcrt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) -c -DGCRT1 -o gcrt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm
# We need to use -fPIC when we are using gcc to compile the routines in
# crtstuff.c. This is only really needed when we are going to use gcc/g++
diff --git a/gcc/config/sparc/xm-sysv4-64.h b/gcc/config/sparc/xm-sysv4-64.h
new file mode 100644
index 0000000..aacc7db
--- /dev/null
+++ b/gcc/config/sparc/xm-sysv4-64.h
@@ -0,0 +1,25 @@
+/* Configuration for GCC for Sparc v9 running 64-bit native.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU CC; see the file COPYING. If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
+
+#include <sparc/xm-sysv4.h>
+
+/* This describes the machine the compiler is hosted on. */
+#undef HOST_BITS_PER_LONG
+#define HOST_BITS_PER_LONG 64