freebsd.h revision 245539
119872Swollman/* Definitions for StrongARM running FreeBSD using the ELF format
219872Swollman   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
319872Swollman   Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
419872Swollman
519872Swollman   This file is part of GCC.
619872Swollman
719872Swollman   GCC is free software; you can redistribute it and/or modify it
819872Swollman   under the terms of the GNU General Public License as published
919872Swollman   by the Free Software Foundation; either version 2, or (at your
1019872Swollman   option) any later version.
1119872Swollman
1219872Swollman   GCC is distributed in the hope that it will be useful, but WITHOUT
1319872Swollman   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1419872Swollman   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1519872Swollman   License for more details.
1619872Swollman
1719872Swollman   You should have received a copy of the GNU General Public License
1819872Swollman   along with GCC; see the file COPYING.  If not, write to
1919872Swollman   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
2019872Swollman   Boston, MA 02110-1301, USA.  */
2119872Swollman
2219872Swollman#undef  SUBTARGET_CPP_SPEC
2319872Swollman#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
2419872Swollman
2519872Swollman#undef  SUBTARGET_EXTRA_SPECS
2619872Swollman#define SUBTARGET_EXTRA_SPECS \
2719872Swollman  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
2819872Swollman  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
2919872Swollman  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
3019872Swollman
3119872Swollman#undef SUBTARGET_EXTRA_ASM_SPEC
3219872Swollman#ifdef TARGET_ARM_EABI
3319872Swollman#define SUBTARGET_EXTRA_ASM_SPEC	\
3419872Swollman  "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=4} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
3530763Scharnier#else
3630763Scharnier#define SUBTARGET_EXTRA_ASM_SPEC	\
3750479Speter  "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
3830763Scharnier#endif
3930763Scharnier
4019872Swollman/* Default to full FPA if -mhard-float is specified. */
4119872Swollman#undef SUBTARGET_ASM_FLOAT_SPEC
4219872Swollman#define SUBTARGET_ASM_FLOAT_SPEC		\
4319872Swollman  "%{mhard-float:-mfpu=fpa}			\
4419872Swollman   %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}}	\
4519872Swollman   %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}"
4619872Swollman
4719872Swollman#undef	LINK_SPEC
4819872Swollman#define LINK_SPEC "							\
4919872Swollman  %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
5019872Swollman  %{v:-V}								\
5119872Swollman  %{assert*} %{R*} %{rpath*} %{defsym*}					\
5219872Swollman  %{shared:-Bshareable %{h*} %{soname*}}				\
5319872Swollman  %{!shared:								\
5419872Swollman    %{!static:								\
5519872Swollman      %{rdynamic:-export-dynamic}					\
5619872Swollman      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
5719872Swollman    %{static:-Bstatic}}							\
5819872Swollman  %{!static:--hash-style=both --enable-new-dtags}			\
5919872Swollman  %{symbolic:-Bsymbolic}						\
6019872Swollman  -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
6119872Swollman
6219872Swollman/************************[  Target stuff  ]***********************************/
6319872Swollman
6419872Swollman
6519872Swollman#ifndef TARGET_ENDIAN_DEFAULT
6619872Swollman#define TARGET_ENDIAN_DEFAULT 0
6719872Swollman#endif
6819872Swollman
6919872Swollman#ifdef TARGET_ARM_EABI
7019872Swollman/* We default to a soft-float ABI so that binaries can run on all
7119872Swollman   target hardware.  */
7219872Swollman#undef TARGET_DEFAULT_FLOAT_ABI
7319872Swollman#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
7419872Swollman
7519872Swollman#undef ARM_DEFAULT_ABI
7619872Swollman#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
7719872Swollman
7819872Swollman#undef  TARGET_OS_CPP_BUILTINS
7919872Swollman#define TARGET_OS_CPP_BUILTINS() 		\
8019872Swollman  do						\
8119872Swollman    {						\
8219872Swollman      FBSD_TARGET_OS_CPP_BUILTINS();		\
8319872Swollman      TARGET_BPABI_CPP_BUILTINS();		\
8419872Swollman    }						\
8519872Swollman  while (false)
8619872Swollman#else
8719872Swollman/* Default it to use ATPCS with soft-VFP.  */
8819872Swollman#define TARGET_DEFAULT			\
8919872Swollman  (MASK_APCS_FRAME			\
9019872Swollman   | TARGET_ENDIAN_DEFAULT)
9119872Swollman
9219872Swollman#undef ARM_DEFAULT_ABI
9319872Swollman#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
9419872Swollman
9519872Swollman#undef FPUTYPE_DEFAULT
9619872Swollman#define FPUTYPE_DEFAULT FPUTYPE_VFP
9719872Swollman#endif
9819872Swollman
9919872Swollman/* Define the actual types of some ANSI-mandated types.
10019872Swollman   Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
10119872Swollman   c-common.c, and config/<arch>/<arch>.h.  */
10219872Swollman
10319872Swollman/* arm.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
10419872Swollman
10519872Swollman#undef  SIZE_TYPE
10619872Swollman#define SIZE_TYPE	"unsigned int"
10719872Swollman
10819872Swollman#undef  PTRDIFF_TYPE
10919872Swollman#define PTRDIFF_TYPE	"int"
11019872Swollman
11119872Swollman/* We use the GCC defaults here.  */
11219872Swollman#undef WCHAR_TYPE
11319872Swollman
11419872Swollman#if defined(FREEBSD_ARCH_armv6)
11519872Swollman#undef  SUBTARGET_CPU_DEFAULT
11619872Swollman#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_arm1176jzs
11719872Swollman#undef FBSD_TARGET_CPU_CPP_BUILTINS
11819872Swollman#define FBSD_TARGET_CPU_CPP_BUILTINS()		\
11919872Swollman  do {						\
12019872Swollman    builtin_define ("__FreeBSD_ARCH_armv6__");	\
12119872Swollman  } while (0)
12219872Swollman#undef  TARGET_VERSION
12319872Swollman#define TARGET_VERSION fprintf (stderr, " (FreeBSD/armv6 ELF)");
12419872Swollman#else
12519872Swollman#undef  SUBTARGET_CPU_DEFAULT
12619872Swollman#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_arm9
12719872Swollman#undef  TARGET_VERSION
12819872Swollman#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
12919872Swollman#endif
13019872Swollman
13119872Swollman/* FreeBSD does its profiling differently to the Acorn compiler. We
13219872Swollman   don't need a word following the mcount call; and to skip it
13319872Swollman   requires either an assembly stub or use of fomit-frame-pointer when
13419872Swollman   compiling the profiling functions.  Since we break Acorn CC
13519872Swollman   compatibility below a little more won't hurt.  */
13619872Swollman
13719872Swollman#undef ARM_FUNCTION_PROFILER
13819872Swollman#define ARM_FUNCTION_PROFILER(STREAM,LABELNO)		\
13919872Swollman{							\
14019872Swollman  asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");		\
14119872Swollman  asm_fprintf (STREAM, "\tbl\t__mcount%s\n",		\
14219872Swollman	       (TARGET_ARM && NEED_PLT_RELOC)		\
14319872Swollman	       ? "(PLT)" : "");				\
14419872Swollman}
14519872Swollman
14619872Swollman/* Clear the instruction cache from `BEG' to `END'.  This makes a
14719872Swollman   call to the ARM_SYNC_ICACHE architecture specific syscall.  */
14819872Swollman#define CLEAR_INSN_CACHE(BEG, END)					\
14919872Swollmando									\
15019872Swollman  {									\
15119872Swollman    extern int sysarch(int number, void *args);				\
15219872Swollman    struct								\
15319872Swollman      {									\
15419872Swollman	unsigned int addr;						\
15519872Swollman	int          len;						\
15619872Swollman      } s;								\
15719872Swollman    s.addr = (unsigned int)(BEG);					\
15819872Swollman    s.len = (END) - (BEG);						\
15919872Swollman    (void) sysarch (0, &s);						\
16019872Swollman  }									\
16119872Swollmanwhile (0)
16219872Swollman
16319872Swollman