]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/arm/freebsd.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / arm / freebsd.h
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 #ifdef TARGET_ARM_EABI
33 #define SUBTARGET_EXTRA_ASM_SPEC        \
34   "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=4} %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
35 #else
36 #define SUBTARGET_EXTRA_ASM_SPEC        \
37   "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
38 #endif
39
40 /* Default to full FPA if -mhard-float is specified. */
41 #undef SUBTARGET_ASM_FLOAT_SPEC
42 #define SUBTARGET_ASM_FLOAT_SPEC                \
43   "%{mhard-float:-mfpu=fpa}                     \
44    %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}}       \
45    %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}"
46
47 #undef  LINK_SPEC
48 #define LINK_SPEC "                                                     \
49   %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }            \
50   %{v:-V}                                                               \
51   %{assert*} %{R*} %{rpath*} %{defsym*}                                 \
52   %{shared:-Bshareable %{h*} %{soname*}}                                \
53   %{!shared:                                                            \
54     %{!static:                                                          \
55       %{rdynamic:-export-dynamic}                                       \
56       %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}       \
57     %{static:-Bstatic}}                                                 \
58   %{!static:--hash-style=both --enable-new-dtags}                       \
59   %{symbolic:-Bsymbolic}                                                \
60   -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
61
62 /************************[  Target stuff  ]***********************************/
63
64
65 #ifndef TARGET_ENDIAN_DEFAULT
66 #define TARGET_ENDIAN_DEFAULT 0
67 #endif
68
69 #ifdef TARGET_ARM_EABI
70 /* We default to a soft-float ABI so that binaries can run on all
71    target hardware.  */
72 #undef TARGET_DEFAULT_FLOAT_ABI
73 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
74
75 #undef ARM_DEFAULT_ABI
76 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
77
78 #undef  TARGET_OS_CPP_BUILTINS
79 #define TARGET_OS_CPP_BUILTINS()                \
80   do                                            \
81     {                                           \
82       FBSD_TARGET_OS_CPP_BUILTINS();            \
83       TARGET_BPABI_CPP_BUILTINS();              \
84     }                                           \
85   while (false)
86 #else
87 /* Default it to use ATPCS with soft-VFP.  */
88 #undef TARGET_DEFAULT
89 #define TARGET_DEFAULT                  \
90   (MASK_APCS_FRAME                      \
91    | TARGET_ENDIAN_DEFAULT)
92
93 #undef ARM_DEFAULT_ABI
94 #define ARM_DEFAULT_ABI ARM_ABI_ATPCS
95
96 #undef FPUTYPE_DEFAULT
97 #define FPUTYPE_DEFAULT FPUTYPE_VFP
98 #endif
99
100 /* Define the actual types of some ANSI-mandated types.
101    Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
102    c-common.c, and config/<arch>/<arch>.h.  */
103
104 /* arm.h gets this wrong for FreeBSD.  We use the GCC defaults instead.  */
105
106 #undef  SIZE_TYPE
107 #define SIZE_TYPE       "unsigned int"
108
109 #undef  PTRDIFF_TYPE
110 #define PTRDIFF_TYPE    "int"
111
112 /* We use the GCC defaults here.  */
113 #undef WCHAR_TYPE
114
115 #if defined(FREEBSD_ARCH_armv6)
116 #undef  SUBTARGET_CPU_DEFAULT
117 #define SUBTARGET_CPU_DEFAULT   TARGET_CPU_arm1176jzs
118 #undef FBSD_TARGET_CPU_CPP_BUILTINS
119 #define FBSD_TARGET_CPU_CPP_BUILTINS()          \
120   do {                                          \
121     builtin_define ("__FreeBSD_ARCH_armv6__");  \
122   } while (0)
123 #undef  TARGET_VERSION
124 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/armv6 ELF)");
125 #else
126 #undef  SUBTARGET_CPU_DEFAULT
127 #define SUBTARGET_CPU_DEFAULT   TARGET_CPU_arm9
128 #undef  TARGET_VERSION
129 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
130 #endif
131
132 /* FreeBSD does its profiling differently to the Acorn compiler. We
133    don't need a word following the mcount call; and to skip it
134    requires either an assembly stub or use of fomit-frame-pointer when
135    compiling the profiling functions.  Since we break Acorn CC
136    compatibility below a little more won't hurt.  */
137
138 #undef ARM_FUNCTION_PROFILER
139 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO)           \
140 {                                                       \
141   asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");          \
142   asm_fprintf (STREAM, "\tbl\t__mcount%s\n",            \
143                (TARGET_ARM && NEED_PLT_RELOC)           \
144                ? "(PLT)" : "");                         \
145 }
146
147 /* Clear the instruction cache from `BEG' to `END'.  This makes a
148    call to the ARM_SYNC_ICACHE architecture specific syscall.  */
149 #define CLEAR_INSN_CACHE(BEG, END)                                      \
150 do                                                                      \
151   {                                                                     \
152     extern int sysarch(int number, void *args);                         \
153     struct                                                              \
154       {                                                                 \
155         unsigned int addr;                                              \
156         int          len;                                               \
157       } s;                                                              \
158     s.addr = (unsigned int)(BEG);                                       \
159     s.len = (END) - (BEG);                                              \
160     (void) sysarch (0, &s);                                             \
161   }                                                                     \
162 while (0)
163