This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] adds FreeBSD/sparc64 target
- From: "David O'Brien" <obrien at FreeBSD dot org>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 15 Dec 2001 13:28:32 -0800
- Subject: Re: [PATCH] adds FreeBSD/sparc64 target
- Organization: The NUXI BSD group
- References: <20011209230905.A17784@dragon.nuxi.com>
- Reply-to: obrien at FreeBSD dot org
Hi Richard,
I just saw the "Freeze timing and questions" email.
Would it be OK to commit this patch RSN so that it makes it into 3.1?
On Sun, Dec 09, 2001 at 11:09:05PM -0800, David O'Brien wrote:
> config/sparc/freebsd.h is still a little rough, but I would like to get
> it committed and tweak it as I get more experience on the platform.
>
>
> 2001-12-10 David O'Brien <obrien@FreeBSD.org>
>
> * config.gcc (sparc64-*-freebsd*): Add target.
> * config/sparc/freebsd.h: New file.
> * config/sparc/sparc.c: Give debugging info before aborting.
> * config/sparc/sparc.h (LIB_SPEC, LINK_SPEC): Don't define.
> * config/sparc/sunos4.h (LIB_SPEC, LINK_SPEC): Define.
> * config/sparc/sysv4.h (CPP_PREDEFINES): Undefine before defining.
>
>
>
> Index: config.gcc
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config.gcc,v
> retrieving revision 1.125
> diff -u -r1.125 config.gcc
> --- config.gcc 2001/12/06 17:34:55 1.125
> +++ config.gcc 2001/12/10 07:04:10
> @@ -3127,6 +3131,20 @@
> sparc64-*-elf*)
> tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sol2.h sparc/sp64-elf.h"
> extra_parts="crtbegin.o crtend.o"
> + ;;
> +sparc64-*-freebsd*|ultrasparc-*-freebsd*)
> + tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h"
> + xmake_file=none
> + case "x$with_cpu" in
> + x) with_cpu=ultrasparc ;;
> + *) echo "$with_cpu not supported for freebsd target"; exit 1 ;;
> + esac
> + # cross targeting sparc64-*-freeebsd* gets into an endless loop.
> + case "$build,$host" in
> + sparc64-*-freebsd*,sparc64-*-freebsd*) ;;
> + *) echo "*** defaulting to SJLJ exceptions ***" >&2
> + enable_sjlj_exceptions=yes ;;
> + esac
> ;;
> sparc64-*-linux*) # 64-bit Sparc's running GNU/Linux
> tmake_file="t-slibgcc-elf-ver t-linux sparc/t-linux64"
>
> Index: config/sparc/sparc.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/sparc/sparc.c,v
> retrieving revision 1.171
> diff -u -r1.171 sparc.c
> --- sparc.c 2001/12/09 20:13:16 1.171
> +++ sparc.c 2001/12/10 07:02:38
> @@ -1452,6 +1452,7 @@
> break;
>
> default:
> + internal_error("CM_ value is %d\n", sparc_cmodel);
> abort();
> }
> }
> Index: config/sparc/sparc.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/sparc/sparc.h,v
> retrieving revision 1.149
> diff -u -r1.149 sparc.h
> --- sparc.h 2001/12/06 11:49:42 1.149
> +++ sparc.h 2001/12/10 07:02:39
> @@ -329,14 +329,6 @@
> %| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \
> %(asm_cpu) %(asm_relax)"
>
> -#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
> -
> -/* Provide required defaults for linker -e and -d switches. */
> -
> -#define LINK_SPEC \
> - "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
> - %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
> -
> /* This macro defines names of additional specifications to put in the specs
> that can be used in various specifications like CC1_SPEC. Its definition
> is an initializer with a subgrouping for each command option.
> Index: config/sparc/sunos4.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/sparc/sunos4.h,v
> retrieving revision 1.10
> diff -u -r1.10 sunos4.h
> --- sunos4.h 2001/12/06 11:49:43 1.10
> +++ sunos4.h 2001/12/10 07:02:39
> @@ -23,6 +23,14 @@
> #undef CPP_PREDEFINES
> #define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd"
>
> +#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
> +
> +/* Provide required defaults for linker -e and -d switches. */
> +
> +#define LINK_SPEC \
> + "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
> + %{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
> +
> /* Use N_BINCL stabs. */
>
> #define DBX_USE_BINCL
> Index: config/sparc/sysv4.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/config/sparc/sysv4.h,v
> retrieving revision 1.22
> diff -u -r1.22 sysv4.h
> --- sysv4.h 2001/11/14 21:44:21 1.22
> +++ sysv4.h 2001/12/10 07:02:39
> @@ -51,6 +51,7 @@
> /* Provide a set of pre-definitions and pre-assertions appropriate for
> the Sparc running svr4. __svr4__ is our extension. */
>
> +#undef CPP_PREDEFINES
> #define CPP_PREDEFINES \
> "-Dsparc -Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
>
> --- /dev/null Sun Dec 9 23:00:00 2001
> +++ config/sparc/freebsd.h Sun Dec 9 23:02:55 2001
> @@ -0,0 +1,153 @@
> +/* Definitions for Sun Sparc64 running FreeBSD using the ELF format
> + Copyright (C) 2001 Free Software Foundation, Inc.
> + Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
> +
> +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, 675 Mass Ave, Cambridge, MA 02139, USA. */
> +
> +/* FreeBSD needs's the platform name (sparc64) defined. */
> +
> +#undef CPP_CPU64_DEFAULT_SPEC
> +#define CPP_CPU64_DEFAULT_SPEC "-D__sparc64__ -D__sparc_v9__"
> +
> +#undef CPP_PREDEFINES
> +#define CPP_PREDEFINES FBSD_CPP_PREDEFINES
> +
> +#define LINK_SPEC "-m elf64_sparc %(link_arch) \
> + %{!mno-relax:%{!r:-relax} \
> + %{p:%e`-p' not supported; use `-pg' and gprof(1)} \
> + %{Wl,*:%*} \
> + %{assert*} %{R*} %{rpath*} %{defsym*} \
> + %{shared:-Bshareable %{h*} %{soname*}} \
> + %{symbolic:-Bsymbolic} \
> + %{!shared: \
> + %{!static: \
> + %{rdynamic:-export-dynamic} \
> + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \
> + %{static:-Bstatic}}"
> +
> +
> +/************************[ Target stuff ]***********************************/
> +
> +/* Define the actual types of some ANSI-mandated types.
> + Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
> + c-common.c, and config/<arch>/<arch>.h. */
> +
> +/* Earlier headers may get this wrong for FreeBSD.
> + We use the GCC defaults instead. */
> +#undef WCHAR_TYPE
> +
> +#undef WCHAR_UNSIGNED
> +#define WCHAR_UNSIGNED 0
> +
> +#undef WCHAR_TYPE_SIZE
> +#define WCHAR_TYPE_SIZE 32
> +
> +/* Define for support of TFmode long double and REAL_ARITHMETIC.
> + Sparc ABI says that long double is 4 words. */
> +#undef LONG_DOUBLE_TYPE_SIZE
> +#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
> +
> +/* Constant which presents upper bound of the above value. */
> +#undef MAX_LONG_DOUBLE_TYPE_SIZE
> +#define MAX_LONG_DOUBLE_TYPE_SIZE 128
> +
> +/* Define this to set long double type size to use in libgcc2.c, which can
> + not depend on target_flags. */
> +#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
> +#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
> +#else
> +#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
> +#endif
> +
> +/* Definitions for 64-bit SPARC running systems with ELF. */
> +
> +#undef SUBTARGET_SWITCHES
> +#define SUBTARGET_SWITCHES \
> + {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
> + {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
> +
> +#undef TARGET_VERSION
> +#define TARGET_VERSION fprintf (stderr, " (FreeBSD/sparc64 ELF)");
> +
> +#define TARGET_ELF 1
> +
> +/* XXX */
> +/* A 64 bit v9 compiler with stack-bias,
> + in a Medium/mid code model environment. */
> +
> +#undef TARGET_DEFAULT
> +#define TARGET_DEFAULT \
> + (MASK_V9 + MASK_64BIT + MASK_PTR64 + MASK_VIS + MASK_FASTER_STRUCTS \
> + + MASK_STACK_BIAS + MASK_APP_REGS /* + MASK_EPILOGUE */ + MASK_FPU \
> + + MASK_LONG_DOUBLE_128 /* + MASK_HARD_QUAD */)
> +
> +/* The default code model. */
> +#undef SPARC_DEFAULT_CMODEL
> +#define SPARC_DEFAULT_CMODEL CM_MEDMID
> +
> +
> +/************************[ Assembler stuff ]********************************/
> +
> +/* XXX */
> +#if 0
> +#undef ASM_CPU_DEFAULT_SPEC
> +#define ASM_CPU_DEFAULT_SPEC "-Av9a"
> +#endif
> +
> +/* XXX2 */
> +/* This is how to output a definition of an internal numbered label where
> + PREFIX is the class of label and NUM is the number within the class. */
> +
> +#undef ASM_OUTPUT_INTERNAL_LABEL
> +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
> + fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
> +
> +/* XXX2 */
> +/* This is how to output a reference to an internal numbered label where
> + PREFIX is the class of label and NUM is the number within the class. */
> +
> +#undef ASM_OUTPUT_INTERNAL_LABELREF
> +#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
> + fprintf (FILE, ".L%s%d", PREFIX, NUM)
> +
> +/* XXX2 */
> +/* This is how to store into the string LABEL
> + the symbol_ref name of an internal numbered label where
> + PREFIX is the class of label and NUM is the number within the class.
> + This is suitable for output with `assemble_name'. */
> +
> +#undef ASM_GENERATE_INTERNAL_LABEL
> +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
> + sprintf (LABEL, "*.L%s%d", PREFIX, NUM)
> +
> +
> +/************************[ Debugger stuff ]*********************************/
> +
> +/* This is the char to use for continuation (in case we need to turn
> + continuation back on). */
> +
> +#undef DBX_CONTIN_CHAR
> +#define DBX_CONTIN_CHAR '?'
> +
> +/* DWARF bits. */
> +
> +/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
> + Obviously the Dwarf2 folks havn't tried to actually build systems
> + with their spec. On a 64-bit system, only 64-bit relocs become
> + RELATIVE relocations. */
> +
> +/* #define DWARF_OFFSET_SIZE PTR_SIZE */