| 1 |
/* Definitions of target machine for GNU compiler, for ARM with a.out |
| 2 |
Copyright (C) 1995-2025 Free Software Foundation, Inc. |
| 3 |
Contributed by Richard Earnshaw ([email protected]). |
| 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 and |
| 22 |
a copy of the GCC Runtime Library Exception along with this program; |
| 23 |
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 24 |
<http://www.gnu.org/licenses/>. */ |
| 25 |
|
| 26 |
#ifndef ASM_APP_ON |
| 27 |
#define ASM_APP_ON "" |
| 28 |
#endif |
| 29 |
#ifndef ASM_APP_OFF |
| 30 |
#define ASM_APP_OFF "" |
| 31 |
#endif |
| 32 |
|
| 33 |
/* Switch to the text or data segment. */ |
| 34 |
#define TEXT_SECTION_ASM_OP "\t.text" |
| 35 |
#define DATA_SECTION_ASM_OP "\t.data" |
| 36 |
#define BSS_SECTION_ASM_OP "\t.bss" |
| 37 |
|
| 38 |
/* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed, |
| 39 |
make sure that this change is reflected in the function |
| 40 |
coff_arm_is_local_label_name() in bfd/coff-arm.c. */ |
| 41 |
#ifndef REGISTER_PREFIX |
| 42 |
#define REGISTER_PREFIX "" |
| 43 |
#endif |
| 44 |
|
| 45 |
#ifndef USER_LABEL_PREFIX |
| 46 |
#define USER_LABEL_PREFIX "_" |
| 47 |
#endif |
| 48 |
|
| 49 |
#ifndef LOCAL_LABEL_PREFIX |
| 50 |
#define LOCAL_LABEL_PREFIX "" |
| 51 |
#endif |
| 52 |
|
| 53 |
/* The assembler's names for the registers. Note that the ?xx registers are |
| 54 |
there so that VFPv3/NEON registers D16-D31 have the same spacing as D0-D15 |
| 55 |
(each of which is overlaid on two S registers), although there are no |
| 56 |
actual single-precision registers which correspond to D16-D31. New register |
| 57 |
p0 is added which is used for MVE predicated cases. */ |
| 58 |
|
| 59 |
#ifndef REGISTER_NAMES |
| 60 |
#define REGISTER_NAMES \ |
| 61 |
{ \ |
| 62 |
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ |
| 63 |
"r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc", \ |
| 64 |
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ |
| 65 |
"s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \ |
| 66 |
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \ |
| 67 |
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \ |
| 68 |
"d16", "?16", "d17", "?17", "d18", "?18", "d19", "?19", \ |
| 69 |
"d20", "?20", "d21", "?21", "d22", "?22", "d23", "?23", \ |
| 70 |
"d24", "?24", "d25", "?25", "d26", "?26", "d27", "?27", \ |
| 71 |
"d28", "?28", "d29", "?29", "d30", "?30", "d31", "?31", \ |
| 72 |
"wr0", "wr1", "wr2", "wr3", \ |
| 73 |
"wr4", "wr5", "wr6", "wr7", \ |
| 74 |
"wr8", "wr9", "wr10", "wr11", \ |
| 75 |
"wr12", "wr13", "wr14", "wr15", \ |
| 76 |
"wcgr0", "wcgr1", "wcgr2", "wcgr3", \ |
| 77 |
"cc", "vfpcc", "sfp", "afp", "apsrq", "apsrge", "p0", \ |
| 78 |
"ra_auth_code" \ |
| 79 |
} |
| 80 |
#endif |
| 81 |
|
| 82 |
#ifndef ADDITIONAL_REGISTER_NAMES |
| 83 |
#define ADDITIONAL_REGISTER_NAMES \ |
| 84 |
{ \ |
| 85 |
{"a1", 0}, \ |
| 86 |
{"a2", 1}, \ |
| 87 |
{"a3", 2}, \ |
| 88 |
{"a4", 3}, \ |
| 89 |
{"v1", 4}, \ |
| 90 |
{"v2", 5}, \ |
| 91 |
{"v3", 6}, \ |
| 92 |
{"v4", 7}, \ |
| 93 |
{"v5", 8}, \ |
| 94 |
{"v6", 9}, \ |
| 95 |
{"rfp", 9}, /* Historical. */ \ |
| 96 |
{"sb", 9}, /* Historical. */ \ |
| 97 |
{"v7", 10}, \ |
| 98 |
{"sl", 10}, /* Historical. */ \ |
| 99 |
{"r11", 11}, /* fp */ \ |
| 100 |
{"r12", 12}, /* ip */ \ |
| 101 |
{"r13", 13}, /* sp */ \ |
| 102 |
{"r14", 14}, /* lr */ \ |
| 103 |
{"r15", 15} /* pc */ \ |
| 104 |
} |
| 105 |
#endif |
| 106 |
|
| 107 |
#ifndef OVERLAPPING_REGISTER_NAMES |
| 108 |
#define OVERLAPPING_REGISTER_NAMES \ |
| 109 |
{ \ |
| 110 |
{"d0", FIRST_VFP_REGNUM + 0, 2}, \ |
| 111 |
{"d1", FIRST_VFP_REGNUM + 2, 2}, \ |
| 112 |
{"d2", FIRST_VFP_REGNUM + 4, 2}, \ |
| 113 |
{"d3", FIRST_VFP_REGNUM + 6, 2}, \ |
| 114 |
{"d4", FIRST_VFP_REGNUM + 8, 2}, \ |
| 115 |
{"d5", FIRST_VFP_REGNUM + 10, 2}, \ |
| 116 |
{"d6", FIRST_VFP_REGNUM + 12, 2}, \ |
| 117 |
{"d7", FIRST_VFP_REGNUM + 14, 2}, \ |
| 118 |
{"d8", FIRST_VFP_REGNUM + 16, 2}, \ |
| 119 |
{"d9", FIRST_VFP_REGNUM + 18, 2}, \ |
| 120 |
{"d10", FIRST_VFP_REGNUM + 20, 2}, \ |
| 121 |
{"d11", FIRST_VFP_REGNUM + 22, 2}, \ |
| 122 |
{"d12", FIRST_VFP_REGNUM + 24, 2}, \ |
| 123 |
{"d13", FIRST_VFP_REGNUM + 26, 2}, \ |
| 124 |
{"d14", FIRST_VFP_REGNUM + 28, 2}, \ |
| 125 |
{"d15", FIRST_VFP_REGNUM + 30, 2}, \ |
| 126 |
{"q0", FIRST_VFP_REGNUM + 0, 4}, \ |
| 127 |
{"q1", FIRST_VFP_REGNUM + 4, 4}, \ |
| 128 |
{"q2", FIRST_VFP_REGNUM + 8, 4}, \ |
| 129 |
{"q3", FIRST_VFP_REGNUM + 12, 4}, \ |
| 130 |
{"q4", FIRST_VFP_REGNUM + 16, 4}, \ |
| 131 |
{"q5", FIRST_VFP_REGNUM + 20, 4}, \ |
| 132 |
{"q6", FIRST_VFP_REGNUM + 24, 4}, \ |
| 133 |
{"q7", FIRST_VFP_REGNUM + 28, 4}, \ |
| 134 |
{"q8", FIRST_VFP_REGNUM + 32, 4}, \ |
| 135 |
{"q9", FIRST_VFP_REGNUM + 36, 4}, \ |
| 136 |
{"q10", FIRST_VFP_REGNUM + 40, 4}, \ |
| 137 |
{"q11", FIRST_VFP_REGNUM + 44, 4}, \ |
| 138 |
{"q12", FIRST_VFP_REGNUM + 48, 4}, \ |
| 139 |
{"q13", FIRST_VFP_REGNUM + 52, 4}, \ |
| 140 |
{"q14", FIRST_VFP_REGNUM + 56, 4}, \ |
| 141 |
{"q15", FIRST_VFP_REGNUM + 60, 4} \ |
| 142 |
} |
| 143 |
#endif |
| 144 |
|
| 145 |
#ifndef NO_DOLLAR_IN_LABEL |
| 146 |
#define NO_DOLLAR_IN_LABEL 1 |
| 147 |
#endif |
| 148 |
|
| 149 |
/* Output a function label definition. */ |
| 150 |
#ifndef ASM_DECLARE_FUNCTION_NAME |
| 151 |
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ |
| 152 |
do \ |
| 153 |
{ \ |
| 154 |
ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \ |
| 155 |
ASM_OUTPUT_FUNCTION_LABEL (STREAM, NAME, DECL); \ |
| 156 |
} \ |
| 157 |
while (0) |
| 158 |
#endif |
| 159 |
|
| 160 |
/* Globalizing directive for a label. */ |
| 161 |
#define GLOBAL_ASM_OP "\t.global\t" |
| 162 |
|
| 163 |
/* Make an internal label into a string. */ |
| 164 |
#ifndef ASM_GENERATE_INTERNAL_LABEL |
| 165 |
#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ |
| 166 |
sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM)) |
| 167 |
#endif |
| 168 |
|
| 169 |
/* Output an element of a dispatch table. */ |
| 170 |
#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ |
| 171 |
do \ |
| 172 |
{ \ |
| 173 |
gcc_assert (!TARGET_THUMB2); \ |
| 174 |
asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE); \ |
| 175 |
} \ |
| 176 |
while (0) |
| 177 |
|
| 178 |
|
| 179 |
/* Thumb-2 always uses addr_diff_elf so that the Table Branch instructions |
| 180 |
can be used. For non-pic code where the offsets do not suitable for |
| 181 |
TBB/TBH the elements are output as absolute labels. */ |
| 182 |
#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ |
| 183 |
do \ |
| 184 |
{ \ |
| 185 |
if (TARGET_ARM) \ |
| 186 |
{ \ |
| 187 |
switch (GET_MODE (body)) \ |
| 188 |
{ \ |
| 189 |
case E_QImode: \ |
| 190 |
asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LLrtx%d-4)/4\n", \ |
| 191 |
VALUE, REL); \ |
| 192 |
break; \ |
| 193 |
case E_HImode: \ |
| 194 |
asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LLrtx%d-4)/4\n", \ |
| 195 |
VALUE, REL); \ |
| 196 |
break; \ |
| 197 |
case E_SImode: \ |
| 198 |
if (flag_pic) \ |
| 199 |
asm_fprintf (STREAM, "\t.word\t%LL%d-%LLrtx%d-4\n", \ |
| 200 |
VALUE, REL); \ |
| 201 |
else \ |
| 202 |
asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE); \ |
| 203 |
break; \ |
| 204 |
default: \ |
| 205 |
gcc_unreachable (); \ |
| 206 |
} \ |
| 207 |
} \ |
| 208 |
else if (TARGET_THUMB1) \ |
| 209 |
{ \ |
| 210 |
if (flag_pic || optimize_size) \ |
| 211 |
{ \ |
| 212 |
switch (GET_MODE(body)) \ |
| 213 |
{ \ |
| 214 |
case E_QImode: \ |
| 215 |
asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \ |
| 216 |
VALUE, REL); \ |
| 217 |
break; \ |
| 218 |
case E_HImode: /* TBH */ \ |
| 219 |
asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \ |
| 220 |
VALUE, REL); \ |
| 221 |
break; \ |
| 222 |
case E_SImode: \ |
| 223 |
asm_fprintf (STREAM, "\t.word\t%LL%d-%LL%d\n", \ |
| 224 |
VALUE, REL); \ |
| 225 |
break; \ |
| 226 |
default: \ |
| 227 |
gcc_unreachable(); \ |
| 228 |
} \ |
| 229 |
} \ |
| 230 |
else \ |
| 231 |
asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \ |
| 232 |
} \ |
| 233 |
else /* Thumb-2 */ \ |
| 234 |
{ \ |
| 235 |
switch (GET_MODE(body)) \ |
| 236 |
{ \ |
| 237 |
case E_QImode: /* TBB */ \ |
| 238 |
asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \ |
| 239 |
VALUE, REL); \ |
| 240 |
break; \ |
| 241 |
case E_HImode: /* TBH */ \ |
| 242 |
asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \ |
| 243 |
VALUE, REL); \ |
| 244 |
break; \ |
| 245 |
case E_SImode: \ |
| 246 |
if (flag_pic) \ |
| 247 |
asm_fprintf (STREAM, "\t.word\t%LL%d+1-%LL%d\n", VALUE, REL); \ |
| 248 |
else \ |
| 249 |
asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \ |
| 250 |
break; \ |
| 251 |
default: \ |
| 252 |
gcc_unreachable(); \ |
| 253 |
} \ |
| 254 |
} \ |
| 255 |
} \ |
| 256 |
while (0) |
| 257 |
|
| 258 |
|
| 259 |
#undef ASM_OUTPUT_ASCII |
| 260 |
#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ |
| 261 |
output_ascii_pseudo_op (STREAM, (const unsigned char *) (PTR), LEN) |
| 262 |
|
| 263 |
/* Output a gap. In fact we fill it with nulls. */ |
| 264 |
#undef ASM_OUTPUT_SKIP |
| 265 |
#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ |
| 266 |
fprintf (STREAM, "\t.space\t%d\n", (int) (NBYTES)) |
| 267 |
|
| 268 |
/* Align output to a power of two. Horrible /bin/as. */ |
| 269 |
#ifndef ASM_OUTPUT_ALIGN |
| 270 |
#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ |
| 271 |
do \ |
| 272 |
{ \ |
| 273 |
int amount = 1 << (POWER); \ |
| 274 |
\ |
| 275 |
if (amount == 2) \ |
| 276 |
fprintf (STREAM, "\t.even\n"); \ |
| 277 |
else if (amount != 1) \ |
| 278 |
fprintf (STREAM, "\t.align\t%d\n", amount - 4); \ |
| 279 |
} \ |
| 280 |
while (0) |
| 281 |
#endif |
| 282 |
|
| 283 |
/* Output a common block. */ |
| 284 |
#ifndef ASM_OUTPUT_COMMON |
| 285 |
#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ |
| 286 |
do \ |
| 287 |
{ \ |
| 288 |
fprintf (STREAM, "\t.comm\t"); \ |
| 289 |
assemble_name (STREAM, NAME); \ |
| 290 |
asm_fprintf (STREAM, ", %d\t%@ %d\n", \ |
| 291 |
(int)(ROUNDED), (int)(SIZE)); \ |
| 292 |
} \ |
| 293 |
while (0) |
| 294 |
#endif |
| 295 |
|
| 296 |
/* Output a local common block. /bin/as can't do this, so hack a |
| 297 |
`.space' into the bss segment. Note that this is *bad* practice, |
| 298 |
which is guaranteed NOT to work since it doesn't define STATIC |
| 299 |
COMMON space but merely STATIC BSS space. */ |
| 300 |
#ifndef ASM_OUTPUT_ALIGNED_LOCAL |
| 301 |
#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \ |
| 302 |
do \ |
| 303 |
{ \ |
| 304 |
switch_to_section (bss_section); \ |
| 305 |
ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \ |
| 306 |
ASM_OUTPUT_LABEL (STREAM, NAME); \ |
| 307 |
fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \ |
| 308 |
} \ |
| 309 |
while (0) |
| 310 |
#endif |
| 311 |
|
| 312 |
/* Output a zero-initialized block. */ |
| 313 |
#ifndef ASM_OUTPUT_ALIGNED_BSS |
| 314 |
#define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \ |
| 315 |
asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN) |
| 316 |
#endif |
| 317 |
|
| 318 |
#ifndef ASM_COMMENT_START |
| 319 |
#define ASM_COMMENT_START "@" |
| 320 |
#endif |
| 321 |
|
| 322 |
/* This works for GAS and some other assemblers. */ |
| 323 |
#define SET_ASM_OP "\t.set\t" |