| 1 |
/* Definitions of target machine for GNU compiler, FreeBSD/arm version. |
| 2 |
Copyright (C) 2002-2025 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 |
" FBSD_LINK_PG_NOTE " \ |
| 51 |
%{v:-V} \ |
| 52 |
%{assert*} %{R*} %{rpath*} %{defsym*} \ |
| 53 |
%{shared:-Bshareable %{h*} %{soname*}} \ |
| 54 |
%{!shared: \ |
| 55 |
%{!static: \ |
| 56 |
%{rdynamic:-export-dynamic} \ |
| 57 |
%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ |
| 58 |
%{static:-Bstatic}} \ |
| 59 |
%{!static:--hash-style=both --enable-new-dtags} \ |
| 60 |
%{symbolic:-Bsymbolic} \ |
| 61 |
-X %{mbig-endian:-EB} %{mlittle-endian:-EL}" |
| 62 |
|
| 63 |
/* TARGET_BIG_ENDIAN_DEFAULT is set in |
| 64 |
config.gcc for big endian configurations. */ |
| 65 |
#if TARGET_BIG_ENDIAN_DEFAULT |
| 66 |
#define TARGET_ENDIAN_DEFAULT MASK_BIG_END |
| 67 |
#define TARGET_ENDIAN_OPTION "mbig-endian" |
| 68 |
#define TARGET_LINKER_EMULATION "armelfb_fbsd" |
| 69 |
#else |
| 70 |
#define TARGET_ENDIAN_DEFAULT 0 |
| 71 |
#define TARGET_ENDIAN_OPTION "mlittle-endian" |
| 72 |
#define TARGET_LINKER_EMULATION "armelf_fbsd" |
| 73 |
#endif |
| 74 |
|
| 75 |
#undef SUBTARGET_EXTRA_LINK_SPEC |
| 76 |
#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p" |
| 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 |
|
| 87 |
/* We default to a soft-float ABI so that binaries can run on all |
| 88 |
target hardware. */ |
| 89 |
#undef TARGET_DEFAULT_FLOAT_ABI |
| 90 |
#ifdef TARGET_FREEBSD_ARM_HARD_FLOAT |
| 91 |
#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD |
| 92 |
#else |
| 93 |
#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT |
| 94 |
#endif |
| 95 |
|
| 96 |
#undef ARM_DEFAULT_ABI |
| 97 |
|
| 98 |
/* AACPS_LINUX has access to kernel atomic ops while we don't. |
| 99 |
But AACPS defaults to short_enums. */ |
| 100 |
#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX |
| 101 |
|
| 102 |
#undef TARGET_DEFAULT |
| 103 |
#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT) |
| 104 |
|
| 105 |
/* We do not have any MULTILIB_OPTIONS specified, so there are no |
| 106 |
MULTILIB_DEFAULTS. */ |
| 107 |
#undef MULTILIB_DEFAULTS |
| 108 |
|
| 109 |
/* Use the AAPCS type for wchar_t, override the one from config/freebsd.h. */ |
| 110 |
#undef WCHAR_TYPE |
| 111 |
#define WCHAR_TYPE "unsigned int" |
| 112 |
|
| 113 |
#undef WCHAR_TYPE_SIZE |
| 114 |
#define WCHAR_TYPE_SIZE BITS_PER_WORD |
| 115 |
|
| 116 |
/* FreeBSD 10 does not support unaligned access for armv6 and up. |
| 117 |
Unaligned access support was added in FreeBSD 11. */ |
| 118 |
#if FBSD_MAJOR < 11 |
| 119 |
#define SUBTARGET_OVERRIDE_INTERNAL_OPTIONS \ |
| 120 |
do { \ |
| 121 |
if (opts_set->x_unaligned_access == 1) \ |
| 122 |
warning (0, "target OS does not support unaligned accesses"); \ |
| 123 |
if (opts->x_unaligned_access) \ |
| 124 |
opts->x_unaligned_access = 0; \ |
| 125 |
} while (0) |
| 126 |
#endif |
| 127 |
|
| 128 |
#undef MAX_SYNC_LIBFUNC_SIZE |
| 129 |
#define MAX_SYNC_LIBFUNC_SIZE 4 /* UNITS_PER_WORD not defined yet. */ |
| 130 |
|
| 131 |
/* FreeBSD does its profiling differently to the Acorn compiler. We |
| 132 |
don't need a word following the mcount call; and to skip it |
| 133 |
requires either an assembly stub or use of fomit-frame-pointer when |
| 134 |
compiling the profiling functions. Since we break Acorn CC |
| 135 |
compatibility below a little more won't hurt. */ |
| 136 |
|
| 137 |
#undef ARM_FUNCTION_PROFILER |
| 138 |
#define ARM_FUNCTION_PROFILER(STREAM,LABELNO) \ |
| 139 |
{ \ |
| 140 |
asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n"); \ |
| 141 |
asm_fprintf (STREAM, "\tbl\t__mcount%s\n", \ |
| 142 |
(TARGET_ARM && NEED_PLT_RELOC) \ |
| 143 |
? "(PLT)" : ""); \ |
| 144 |
} |
| 145 |
|
| 146 |
/* Clear the instruction cache from `BEG' to `END'. This makes a |
| 147 |
call to the ARM_SYNC_ICACHE architecture specific syscall. */ |
| 148 |
#define CLEAR_INSN_CACHE(BEG, END) \ |
| 149 |
do \ |
| 150 |
{ \ |
| 151 |
extern int sysarch (int number, void *args); \ |
| 152 |
struct \ |
| 153 |
{ \ |
| 154 |
unsigned int addr; \ |
| 155 |
int len; \ |
| 156 |
} s; \ |
| 157 |
s.addr = (unsigned int) (BEG); \ |
| 158 |
s.len = (END) - (BEG); \ |
| 159 |
(void) sysarch (0, &s); \ |
| 160 |
} \ |
| 161 |
while (0) |
| 162 |
|
| 163 |
/* This is how we tell the assembler that two symbols have the same value. */ |
| 164 |
#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ |
| 165 |
do \ |
| 166 |
{ \ |
| 167 |
assemble_name (FILE, NAME1); \ |
| 168 |
fputs (" = ", FILE); \ |
| 169 |
assemble_name (FILE, NAME2); \ |
| 170 |
fputc ('\n', FILE); \ |
| 171 |
} \ |
| 172 |
while (0) |
| 173 |
|
| 174 |
/* Add .note.GNU-stack. */ |
| 175 |
#undef NEED_INDICATE_EXEC_STACK |
| 176 |
#define NEED_INDICATE_EXEC_STACK 1 |
| 177 |
|
| 178 |
#define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect) |
| 179 |
|