2016-07-07 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / config / arm / freebsd.h
blob0ade4e99be17ca5f752c034c1ca18ef33d5cb4bb
1 /* Definitions of target machine for GNU compiler, FreeBSD/arm version.
2 Copyright (C) 2002-2016 Free Software Foundation, Inc.
3 Contributed by Wasabi Systems, Inc.
5 This file is part of GCC.
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 3, or (at your
10 option) any later version.
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.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING3. If not see
23 <http://www.gnu.org/licenses/>. */
25 #undef SUBTARGET_CPP_SPEC
26 #define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
28 #undef SUBTARGET_EXTRA_SPECS
29 #define SUBTARGET_EXTRA_SPECS \
30 { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC }, \
31 { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
32 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
34 #undef SUBTARGET_EXTRA_ASM_SPEC
35 #define SUBTARGET_EXTRA_ASM_SPEC \
36 "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5} " TARGET_FIX_V4BX_SPEC " \
37 %{" FPIE_OR_FPIC_SPEC ":-k}"
39 #undef SUBTARGET_ASM_FLOAT_SPEC
40 #ifdef TARGET_FREEBSD_ARM_HARD_FLOAT
41 /* Default to full vfp if we build for arm*hf. */
42 #define SUBTARGET_ASM_FLOAT_SPEC "%{!mfpu=*:-mfpu=vfp}"
43 #else
44 #define SUBTARGET_ASM_FLOAT_SPEC "%{!mfpu=*:-mfpu=softvfp}"
45 #endif
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}"
62 /* TARGET_BIG_ENDIAN_DEFAULT is set in
63 config.gcc for big endian configurations. */
64 #if TARGET_BIG_ENDIAN_DEFAULT
65 #define TARGET_ENDIAN_DEFAULT MASK_BIG_END
66 #define TARGET_ENDIAN_OPTION "mbig-endian"
67 #define TARGET_LINKER_EMULATION "armelfb_fbsd"
68 #else
69 #define TARGET_ENDIAN_DEFAULT 0
70 #define TARGET_ENDIAN_OPTION "mlittle-endian"
71 #define TARGET_LINKER_EMULATION "armelf_fbsd"
72 #endif
74 #undef SUBTARGET_EXTRA_LINK_SPEC
75 #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
77 #undef TARGET_OS_CPP_BUILTINS
78 #define TARGET_OS_CPP_BUILTINS() \
79 do \
80 { \
81 FBSD_TARGET_OS_CPP_BUILTINS (); \
82 TARGET_BPABI_CPP_BUILTINS (); \
83 } \
84 while (false)
86 /* We default to a soft-float ABI so that binaries can run on all
87 target hardware. */
88 #undef TARGET_DEFAULT_FLOAT_ABI
89 #ifdef TARGET_FREEBSD_ARM_HARD_FLOAT
90 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
91 #else
92 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
93 #endif
95 #undef ARM_DEFAULT_ABI
97 /* AACPS_LINUX has access to kernel atomic ops while we don't.
98 But AACPS defaults to short_enums. */
99 #define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
101 #undef TARGET_DEFAULT
102 #define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
104 /* We do not have any MULTILIB_OPTIONS specified, so there are no
105 MULTILIB_DEFAULTS. */
106 #undef MULTILIB_DEFAULTS
108 /* Use the AAPCS type for wchar_t, override the one from config/freebsd.h. */
109 #undef WCHAR_TYPE
110 #define WCHAR_TYPE "unsigned int"
112 #undef WCHAR_TYPE_SIZE
113 #define WCHAR_TYPE_SIZE BITS_PER_WORD
115 #if defined (TARGET_FREEBSD_ARMv6)
116 #undef SUBTARGET_CPU_DEFAULT
117 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm1176jzs
118 #else
119 #undef SUBTARGET_CPU_DEFAULT
120 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9
121 #endif
123 /* FreeBSD 10 does not support unaligned access for armv6 and up.
124 Unaligned access support was added in FreeBSD 11. */
125 #if FBSD_MAJOR < 11
126 #define SUBTARGET_OVERRIDE_INTERNAL_OPTIONS \
127 do { \
128 if (opts_set->x_unaligned_access == 1) \
129 warning (0, "target OS does not support unaligned accesses"); \
130 if (opts->x_unaligned_access) \
131 opts->x_unaligned_access = 0; \
132 } while (0)
133 #endif
135 #undef MAX_SYNC_LIBFUNC_SIZE
136 #define MAX_SYNC_LIBFUNC_SIZE 4 /* UNITS_PER_WORD not defined yet. */
138 /* FreeBSD does its profiling differently to the Acorn compiler. We
139 don't need a word following the mcount call; and to skip it
140 requires either an assembly stub or use of fomit-frame-pointer when
141 compiling the profiling functions. Since we break Acorn CC
142 compatibility below a little more won't hurt. */
144 #undef ARM_FUNCTION_PROFILER
145 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \
147 asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \
148 asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \
149 (TARGET_ARM && NEED_PLT_RELOC) \
150 ? "(PLT)" : ""); \
153 /* Clear the instruction cache from `BEG' to `END'. This makes a
154 call to the ARM_SYNC_ICACHE architecture specific syscall. */
155 #define CLEAR_INSN_CACHE(BEG, END) \
156 do \
158 extern int sysarch (int number, void *args); \
159 struct \
161 unsigned int addr; \
162 int len; \
163 } s; \
164 s.addr = (unsigned int) (BEG); \
165 s.len = (END) - (BEG); \
166 (void) sysarch (0, &s); \
168 while (0)
170 /* This is how we tell the assembler that two symbols have the same value. */
171 #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
172 do \
174 assemble_name (FILE, NAME1); \
175 fputs (" = ", FILE); \
176 assemble_name (FILE, NAME2); \
177 fputc ('\n', FILE); \
179 while (0)
181 /* Add .note.GNU-stack. */
182 #undef NEED_INDICATE_EXEC_STACK
183 #define NEED_INDICATE_EXEC_STACK 1
185 #define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect)