freebsd.h revision 239272
1234353Sdim/* Definitions for StrongARM running FreeBSD using the ELF format
2193323Sed   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
3193323Sed   Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
4193323Sed
5193323Sed   This file is part of GCC.
6193323Sed
7193323Sed   GCC is free software; you can redistribute it and/or modify it
8193323Sed   under the terms of the GNU General Public License as published
9193323Sed   by the Free Software Foundation; either version 2, or (at your
10193323Sed   option) any later version.
11193323Sed
12193323Sed   GCC is distributed in the hope that it will be useful, but WITHOUT
13193323Sed   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14193323Sed   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15193323Sed   License for more details.
16249423Sdim
17193323Sed   You should have received a copy of the GNU General Public License
18193323Sed   along with GCC; see the file COPYING.  If not, write to
19249423Sdim   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20193323Sed   Boston, MA 02110-1301, USA.  */
21193323Sed
22249423Sdim#undef  SUBTARGET_CPP_SPEC
23193323Sed#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
24193323Sed
25193323Sed#undef  SUBTARGET_EXTRA_SPECS
26193323Sed#define SUBTARGET_EXTRA_SPECS \
27193323Sed  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
28249423Sdim  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
29198090Srdivacky  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
30198090Srdivacky
31198090Srdivacky#undef SUBTARGET_EXTRA_ASM_SPEC
32249423Sdim#define SUBTARGET_EXTRA_ASM_SPEC	\
33193323Sed  "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
34198090Srdivacky
35198090Srdivacky/* Default to full FPA if -mhard-float is specified. */
36193323Sed#undef SUBTARGET_ASM_FLOAT_SPEC
37193323Sed#define SUBTARGET_ASM_FLOAT_SPEC		\
38193323Sed  "%{mhard-float:-mfpu=fpa}			\
39193323Sed   %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}}	\
40193323Sed   %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}"
41193323Sed
42198090Srdivacky#undef	LINK_SPEC
43198892Srdivacky#define LINK_SPEC "							\
44193323Sed  %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
45243830Sdim  %{v:-V}								\
46193323Sed  %{assert*} %{R*} %{rpath*} %{defsym*}					\
47193323Sed  %{shared:-Bshareable %{h*} %{soname*}}				\
48205218Srdivacky  %{!shared:								\
49193323Sed    %{!static:								\
50193323Sed      %{rdynamic:-export-dynamic}					\
51193323Sed      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
52193323Sed    %{static:-Bstatic}}							\
53193323Sed  %{!static:--hash-style=both --enable-new-dtags}			\
54193323Sed  %{symbolic:-Bsymbolic}						\
55239462Sdim  -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
56263508Sdim
57263508Sdim/************************[  Target stuff  ]***********************************/
58193323Sed
59193323Sed
60193323Sed#ifndef TARGET_ENDIAN_DEFAULT
61193323Sed#define TARGET_ENDIAN_DEFAULT 0
62193323Sed#endif
63193323Sed
64193323Sed/* Default it to use ATPCS with soft-VFP.  */
65239462Sdim#undef TARGET_DEFAULT
66239462Sdim#define TARGET_DEFAULT			\
67239462Sdim  (MASK_APCS_FRAME			\
68239462Sdim   | TARGET_ENDIAN_DEFAULT)
69239462Sdim
70239462Sdim#undef ARM_DEFAULT_ABI
71239462Sdim#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
72239462Sdim
73239462Sdim/* Define the actual types of some ANSI-mandated types.
74239462Sdim   Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
75239462Sdim   c-common.c, and config/<arch>/<arch>.h.  */
76239462Sdim
77224145Sdim/* arm.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
78239462Sdim
79193323Sed#undef  SIZE_TYPE
80198090Srdivacky#define SIZE_TYPE	"unsigned int"
81193323Sed
82193323Sed#undef  PTRDIFF_TYPE
83193323Sed#define PTRDIFF_TYPE	"int"
84193323Sed
85193323Sed/* We use the GCC defaults here.  */
86193323Sed#undef WCHAR_TYPE
87207618Srdivacky
88193323Sed#if defined(FREEBSD_ARCH_armv6)
89199481Srdivacky#undef  SUBTARGET_CPU_DEFAULT
90193323Sed#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_arm1176jzs
91193323Sed#undef FBSD_TARGET_CPU_CPP_BUILTINS
92193323Sed#define FBSD_TARGET_CPU_CPP_BUILTINS()		\
93193323Sed  do {						\
94193323Sed    builtin_define ("__FreeBSD_ARCH_armv6__");	\
95193323Sed  } while (0)
96193323Sed#undef  TARGET_VERSION
97198090Srdivacky#define TARGET_VERSION fprintf (stderr, " (FreeBSD/armv6 ELF)");
98193323Sed#else
99193323Sed#undef  SUBTARGET_CPU_DEFAULT
100193323Sed#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_strongarm
101193323Sed#undef  TARGET_VERSION
102193323Sed#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
103193323Sed#endif
104193323Sed
105193323Sed/* FreeBSD does its profiling differently to the Acorn compiler. We
106193323Sed   don't need a word following the mcount call; and to skip it
107243830Sdim   requires either an assembly stub or use of fomit-frame-pointer when
108243830Sdim   compiling the profiling functions.  Since we break Acorn CC
109243830Sdim   compatibility below a little more won't hurt.  */
110243830Sdim
111243830Sdim#undef ARM_FUNCTION_PROFILER
112243830Sdim#define ARM_FUNCTION_PROFILER(STREAM,LABELNO)		\
113243830Sdim{							\
114243830Sdim  asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");		\
115193323Sed  asm_fprintf (STREAM, "\tbl\t__mcount%s\n",		\
116193323Sed	       (TARGET_ARM && NEED_PLT_RELOC)		\
117193323Sed	       ? "(PLT)" : "");				\
118193323Sed}
119198090Srdivacky
120193323Sed/* Clear the instruction cache from `BEG' to `END'.  This makes a
121193323Sed   call to the ARM_SYNC_ICACHE architecture specific syscall.  */
122249423Sdim#define CLEAR_INSN_CACHE(BEG, END)					\
123198090Srdivackydo									\
124198090Srdivacky  {									\
125193323Sed    extern int sysarch(int number, void *args);				\
126193323Sed    struct								\
127193323Sed      {									\
128193323Sed	unsigned int addr;						\
129193323Sed	int          len;						\
130205218Srdivacky      } s;								\
131205218Srdivacky    s.addr = (unsigned int)(BEG);					\
132239462Sdim    s.len = (END) - (BEG);						\
133193323Sed    (void) sysarch (0, &s);						\
134243830Sdim  }									\
135193323Sedwhile (0)
136193323Sed
137239462Sdim#undef FPUTYPE_DEFAULT
138193323Sed#define FPUTYPE_DEFAULT FPUTYPE_VFP
139243830Sdim