freebsd.h revision 239272
1/* Definitions for StrongARM running FreeBSD using the ELF format
2   Copyright (C) 2001, 2004 Free Software Foundation, Inc.
3   Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
4
5   This file is part of GCC.
6
7   GCC is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published
9   by the Free Software Foundation; either version 2, or (at your
10   option) any later version.
11
12   GCC is distributed in the hope that it will be useful, but WITHOUT
13   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15   License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with GCC; see the file COPYING.  If not, write to
19   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20   Boston, MA 02110-1301, USA.  */
21
22#undef  SUBTARGET_CPP_SPEC
23#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
24
25#undef  SUBTARGET_EXTRA_SPECS
26#define SUBTARGET_EXTRA_SPECS \
27  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
28  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
29  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
30
31#undef SUBTARGET_EXTRA_ASM_SPEC
32#define SUBTARGET_EXTRA_ASM_SPEC	\
33  "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
34
35/* Default to full FPA if -mhard-float is specified. */
36#undef SUBTARGET_ASM_FLOAT_SPEC
37#define SUBTARGET_ASM_FLOAT_SPEC		\
38  "%{mhard-float:-mfpu=fpa}			\
39   %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}}	\
40   %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}"
41
42#undef	LINK_SPEC
43#define LINK_SPEC "							\
44  %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
45  %{v:-V}								\
46  %{assert*} %{R*} %{rpath*} %{defsym*}					\
47  %{shared:-Bshareable %{h*} %{soname*}}				\
48  %{!shared:								\
49    %{!static:								\
50      %{rdynamic:-export-dynamic}					\
51      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
52    %{static:-Bstatic}}							\
53  %{!static:--hash-style=both --enable-new-dtags}			\
54  %{symbolic:-Bsymbolic}						\
55  -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
56
57/************************[  Target stuff  ]***********************************/
58
59
60#ifndef TARGET_ENDIAN_DEFAULT
61#define TARGET_ENDIAN_DEFAULT 0
62#endif
63
64/* Default it to use ATPCS with soft-VFP.  */
65#undef TARGET_DEFAULT
66#define TARGET_DEFAULT			\
67  (MASK_APCS_FRAME			\
68   | TARGET_ENDIAN_DEFAULT)
69
70#undef ARM_DEFAULT_ABI
71#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
72
73/* Define the actual types of some ANSI-mandated types.
74   Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
75   c-common.c, and config/<arch>/<arch>.h.  */
76
77/* arm.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
78
79#undef  SIZE_TYPE
80#define SIZE_TYPE	"unsigned int"
81
82#undef  PTRDIFF_TYPE
83#define PTRDIFF_TYPE	"int"
84
85/* We use the GCC defaults here.  */
86#undef WCHAR_TYPE
87
88#if defined(FREEBSD_ARCH_armv6)
89#undef  SUBTARGET_CPU_DEFAULT
90#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_arm1176jzs
91#undef FBSD_TARGET_CPU_CPP_BUILTINS
92#define FBSD_TARGET_CPU_CPP_BUILTINS()		\
93  do {						\
94    builtin_define ("__FreeBSD_ARCH_armv6__");	\
95  } while (0)
96#undef  TARGET_VERSION
97#define TARGET_VERSION fprintf (stderr, " (FreeBSD/armv6 ELF)");
98#else
99#undef  SUBTARGET_CPU_DEFAULT
100#define SUBTARGET_CPU_DEFAULT	TARGET_CPU_strongarm
101#undef  TARGET_VERSION
102#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
103#endif
104
105/* FreeBSD does its profiling differently to the Acorn compiler. We
106   don't need a word following the mcount call; and to skip it
107   requires either an assembly stub or use of fomit-frame-pointer when
108   compiling the profiling functions.  Since we break Acorn CC
109   compatibility below a little more won't hurt.  */
110
111#undef ARM_FUNCTION_PROFILER
112#define ARM_FUNCTION_PROFILER(STREAM,LABELNO)		\
113{							\
114  asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");		\
115  asm_fprintf (STREAM, "\tbl\t__mcount%s\n",		\
116	       (TARGET_ARM && NEED_PLT_RELOC)		\
117	       ? "(PLT)" : "");				\
118}
119
120/* Clear the instruction cache from `BEG' to `END'.  This makes a
121   call to the ARM_SYNC_ICACHE architecture specific syscall.  */
122#define CLEAR_INSN_CACHE(BEG, END)					\
123do									\
124  {									\
125    extern int sysarch(int number, void *args);				\
126    struct								\
127      {									\
128	unsigned int addr;						\
129	int          len;						\
130      } s;								\
131    s.addr = (unsigned int)(BEG);					\
132    s.len = (END) - (BEG);						\
133    (void) sysarch (0, &s);						\
134  }									\
135while (0)
136
137#undef FPUTYPE_DEFAULT
138#define FPUTYPE_DEFAULT FPUTYPE_VFP
139