1 /* Definitions of target machine for GNU compiler, FreeBSD/arm version. 2 Copyright (C) 2002-2015 Free Software Foundation, Inc. 3 Contributed by Wasabi Systems, Inc. 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 3, 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 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. 20 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/>. */ 24 25 #undef SUBTARGET_CPP_SPEC 26 #define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC 27 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 } 33 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 %{fpic|fpie:-k} %{fPIC|fPIE:-k}" 38 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 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_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 73 74 #undef SUBTARGET_EXTRA_LINK_SPEC 75 #define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" 76 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) 85 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 94 95 #undef ARM_DEFAULT_ABI 96 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 100 101 #undef TARGET_DEFAULT 102 #define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) 103 104 /* We do not have any MULTILIB_OPTIONS specified, so there are no 105 MULTILIB_DEFAULTS. */ 106 #undef MULTILIB_DEFAULTS 107 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" 111 112 #undef WCHAR_TYPE_SIZE 113 #define WCHAR_TYPE_SIZE BITS_PER_WORD 114 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 122 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_OPTIONS \ 127 do { \ 128 if (unaligned_access) \ 129 unaligned_access = 0; \ 130 } while (0) 131 #endif 132 133 #undef MAX_SYNC_LIBFUNC_SIZE 134 #define MAX_SYNC_LIBFUNC_SIZE 4 /* UNITS_PER_WORD not defined yet. */ 135 136 /* FreeBSD does its profiling differently to the Acorn compiler. We 137 don't need a word following the mcount call; and to skip it 138 requires either an assembly stub or use of fomit-frame-pointer when 139 compiling the profiling functions. Since we break Acorn CC 140 compatibility below a little more won't hurt. */ 141 142 #undef ARM_FUNCTION_PROFILER 143 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \ 144 { \ 145 asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \ 146 asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \ 147 (TARGET_ARM && NEED_PLT_RELOC) \ 148 ? "(PLT)" : ""); \ 149 } 150 151 /* Clear the instruction cache from `BEG' to `END'. This makes a 152 call to the ARM_SYNC_ICACHE architecture specific syscall. */ 153 #define CLEAR_INSN_CACHE(BEG, END) \ 154 do \ 155 { \ 156 extern int sysarch (int number, void *args); \ 157 struct \ 158 { \ 159 unsigned int addr; \ 160 int len; \ 161 } s; \ 162 s.addr = (unsigned int) (BEG); \ 163 s.len = (END) - (BEG); \ 164 (void) sysarch (0, &s); \ 165 } \ 166 while (0) 167 168 /* This is how we tell the assembler that two symbols have the same value. */ 169 #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ 170 do \ 171 { \ 172 assemble_name (FILE, NAME1); \ 173 fputs (" = ", FILE); \ 174 assemble_name (FILE, NAME2); \ 175 fputc ('\n', FILE); \ 176 } \ 177 while (0) 178 179 /* Add .note.GNU-stack. */ 180 #undef NEED_INDICATE_EXEC_STACK 181 #define NEED_INDICATE_EXEC_STACK 1 182 183 #define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect) 184 185