1 /* Definitions of target machine for GNU compiler, FreeBSD/arm version. 2 Copyright (C) 2002-2020 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 %{" FPIE_OR_FPIC_SPEC ":-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 /* FreeBSD 10 does not support unaligned access for armv6 and up. 116 Unaligned access support was added in FreeBSD 11. */ 117 #if FBSD_MAJOR < 11 118 #define SUBTARGET_OVERRIDE_INTERNAL_OPTIONS \ 119 do { \ 120 if (opts_set->x_unaligned_access == 1) \ 121 warning (0, "target OS does not support unaligned accesses"); \ 122 if (opts->x_unaligned_access) \ 123 opts->x_unaligned_access = 0; \ 124 } while (0) 125 #endif 126 127 #undef MAX_SYNC_LIBFUNC_SIZE 128 #define MAX_SYNC_LIBFUNC_SIZE 4 /* UNITS_PER_WORD not defined yet. */ 129 130 /* FreeBSD does its profiling differently to the Acorn compiler. We 131 don't need a word following the mcount call; and to skip it 132 requires either an assembly stub or use of fomit-frame-pointer when 133 compiling the profiling functions. Since we break Acorn CC 134 compatibility below a little more won't hurt. */ 135 136 #undef ARM_FUNCTION_PROFILER 137 #define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \ 138 { \ 139 asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \ 140 asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \ 141 (TARGET_ARM && NEED_PLT_RELOC) \ 142 ? "(PLT)" : ""); \ 143 } 144 145 /* Clear the instruction cache from `BEG' to `END'. This makes a 146 call to the ARM_SYNC_ICACHE architecture specific syscall. */ 147 #define CLEAR_INSN_CACHE(BEG, END) \ 148 do \ 149 { \ 150 extern int sysarch (int number, void *args); \ 151 struct \ 152 { \ 153 unsigned int addr; \ 154 int len; \ 155 } s; \ 156 s.addr = (unsigned int) (BEG); \ 157 s.len = (END) - (BEG); \ 158 (void) sysarch (0, &s); \ 159 } \ 160 while (0) 161 162 /* This is how we tell the assembler that two symbols have the same value. */ 163 #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ 164 do \ 165 { \ 166 assemble_name (FILE, NAME1); \ 167 fputs (" = ", FILE); \ 168 assemble_name (FILE, NAME2); \ 169 fputc ('\n', FILE); \ 170 } \ 171 while (0) 172 173 /* Add .note.GNU-stack. */ 174 #undef NEED_INDICATE_EXEC_STACK 175 #define NEED_INDICATE_EXEC_STACK 1 176 177 #define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect) 178 179