]>
Commit | Line | Data |
---|---|---|
956d6950 JL |
1 | /* Definitions for Motorola 68k running Linux-based GNU systems with |
2 | ELF format. | |
6441eb6d | 3 | Copyright (C) 1995-2025 Free Software Foundation, Inc. |
8291155f | 4 | |
7ec022b2 | 5 | This file is part of GCC. |
8291155f | 6 | |
7ec022b2 | 7 | GCC is free software; you can redistribute it and/or modify |
8291155f | 8 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 9 | the Free Software Foundation; either version 3, or (at your option) |
8291155f RK |
10 | any later version. |
11 | ||
7ec022b2 | 12 | GCC is distributed in the hope that it will be useful, |
8291155f RK |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
8291155f | 20 | |
57809813 | 21 | /* Add %(asm_cpu_spec) to a generic definition of ASM_SPEC. */ |
0c004537 | 22 | #undef ASM_SPEC |
c75d884b | 23 | #define ASM_SPEC "%(asm_cpu_spec) %(asm_pcrel_spec)" |
0c004537 | 24 | |
bd7993c8 RZ |
25 | #undef PREFERRED_STACK_BOUNDARY |
26 | #define PREFERRED_STACK_BOUNDARY 32 | |
27 | ||
270eeaa5 RK |
28 | /* for 68k machines this only needs to be TRUE for the 68000 */ |
29 | ||
3b4b85c9 | 30 | #undef STRICT_ALIGNMENT |
270eeaa5 | 31 | #define STRICT_ALIGNMENT 0 |
1c445f03 NS |
32 | #undef M68K_HONOR_TARGET_STRICT_ALIGNMENT |
33 | #define M68K_HONOR_TARGET_STRICT_ALIGNMENT 0 | |
270eeaa5 | 34 | |
8291155f RK |
35 | /* Here are four prefixes that are used by asm_fprintf to |
36 | facilitate customization for alternate assembler syntaxes. | |
37 | Machines with no likelihood of an alternate syntax need not | |
38 | define these and need not use asm_fprintf. */ | |
39 | ||
40 | /* The prefix for register names. Note that REGISTER_NAMES | |
41 | is supposed to include this prefix. Also note that this is NOT an | |
42 | fprintf format string, it is a literal string */ | |
43 | ||
44 | #undef REGISTER_PREFIX | |
45 | #define REGISTER_PREFIX "%" | |
46 | ||
47 | /* The prefix for local (compiler generated) labels. | |
7a1929e1 | 48 | These labels will not appear in the symbol table. */ |
8291155f RK |
49 | |
50 | #undef LOCAL_LABEL_PREFIX | |
51 | #define LOCAL_LABEL_PREFIX "." | |
52 | ||
7a1929e1 | 53 | /* The prefix to add to user-visible assembler symbols. */ |
8291155f RK |
54 | |
55 | #undef USER_LABEL_PREFIX | |
56 | #define USER_LABEL_PREFIX "" | |
57 | ||
0a22948f RK |
58 | #define ASM_COMMENT_START "|" |
59 | ||
a7fbe404 | 60 | /* Target OS builtins. */ |
107fd1c1 | 61 | #define TARGET_OS_CPP_BUILTINS() GNU_USER_TARGET_OS_CPP_BUILTINS() |
4e2e315f | 62 | |
8291155f | 63 | #undef CPP_SPEC |
59fbf3cb | 64 | #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" |
8291155f | 65 | |
956d6950 | 66 | /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support |
8291155f RK |
67 | for the special GCC options -static and -shared, which allow us to |
68 | link things in one of these three modes by applying the appropriate | |
83c2a9ef | 69 | combinations of options at link-time. |
8291155f RK |
70 | |
71 | When the -shared link option is used a final link is not being | |
72 | done. */ | |
73 | ||
7bd85ce0 JM |
74 | #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" |
75 | ||
838fd641 SN |
76 | #undef MUSL_DYNAMIC_LINKER |
77 | #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-m68k.so.1" | |
78 | ||
85dbf7e2 | 79 | #undef LINK_SPEC |
e91bc805 RK |
80 | #define LINK_SPEC "-m m68kelf %{shared} \ |
81 | %{!shared: \ | |
89d9619d | 82 | %{!static: \ |
e91bc805 | 83 | %{rdynamic:-export-dynamic} \ |
107fd1c1 | 84 | -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \ |
e91bc805 | 85 | %{static}}" |
8291155f RK |
86 | |
87 | /* For compatibility with linux/a.out */ | |
88 | ||
89 | #undef PCC_BITFIELD_TYPE_MATTERS | |
90 | ||
91 | /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to | |
92 | keep switch tables in the text section. */ | |
50332a4f | 93 | |
8291155f RK |
94 | #define JUMP_TABLES_IN_TEXT_SECTION 1 |
95 | ||
96 | /* Use the default action for outputting the case label. */ | |
97 | #undef ASM_OUTPUT_CASE_LABEL | |
c1c1d123 AS |
98 | #define ASM_RETURN_CASE_JUMP \ |
99 | do { \ | |
9425fb04 | 100 | if (TARGET_COLDFIRE) \ |
c1c1d123 AS |
101 | { \ |
102 | if (ADDRESS_REG_P (operands[0])) \ | |
103 | return "jmp %%pc@(2,%0:l)"; \ | |
c24900be | 104 | else if (TARGET_LONG_JUMP_TABLE_OFFSETS) \ |
eea25179 | 105 | return "jmp %%pc@(%l1,%0:l)"; \ |
c1c1d123 AS |
106 | else \ |
107 | return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \ | |
108 | } \ | |
c24900be | 109 | else if (TARGET_LONG_JUMP_TABLE_OFFSETS) \ |
eea25179 | 110 | return "jmp %%pc@(%l1,%0:l)"; \ |
c1c1d123 AS |
111 | else \ |
112 | return "jmp %%pc@(2,%0:w)"; \ | |
9fb9ea4a | 113 | } while (0) |
8291155f RK |
114 | |
115 | /* This is how to output an assembler line that says to advance the | |
116 | location counter to a multiple of 2**LOG bytes. */ | |
117 | ||
118 | #undef ASM_OUTPUT_ALIGN | |
119 | #define ASM_OUTPUT_ALIGN(FILE,LOG) \ | |
120 | if ((LOG) > 0) \ | |
016c8440 | 121 | fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); |
8291155f | 122 | |
bdf3e90e RK |
123 | /* If defined, a C expression whose value is a string containing the |
124 | assembler operation to identify the following data as uninitialized global | |
125 | data. */ | |
126 | ||
6e7b07a7 | 127 | #define BSS_SECTION_ASM_OP "\t.section\t.bss" |
bdf3e90e RK |
128 | |
129 | /* A C statement (sans semicolon) to output to the stdio stream | |
09ea387b | 130 | FILE the assembler definition of uninitialized global DECL named |
bdf3e90e RK |
131 | NAME whose size is SIZE bytes and alignment is ALIGN bytes. |
132 | Try to use asm_output_aligned_bss to implement this macro. */ | |
133 | ||
09ea387b DE |
134 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
135 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
bdf3e90e | 136 | |
8291155f RK |
137 | /* Output assembler code to FILE to increment profiler label # LABELNO |
138 | for profiling a function entry. */ | |
90f5494c | 139 | #define NO_PROFILE_COUNTERS 1 |
8291155f RK |
140 | #undef FUNCTION_PROFILER |
141 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
142 | { \ | |
8291155f RK |
143 | if (flag_pic) \ |
144 | fprintf (FILE, "\tbsr.l _mcount@PLTPC\n"); \ | |
145 | else \ | |
146 | fprintf (FILE, "\tjbsr _mcount\n"); \ | |
147 | } | |
148 | ||
8291155f RK |
149 | /* 1 if N is a possible register number for a function value. For |
150 | m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral, | |
151 | pointer, or floating types, respectively. Reject fp0 if not using | |
152 | a 68881 coprocessor. */ | |
153 | ||
154 | #undef FUNCTION_VALUE_REGNO_P | |
155 | #define FUNCTION_VALUE_REGNO_P(N) \ | |
3bfe36dc | 156 | ((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG)) |
8291155f RK |
157 | |
158 | /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for | |
159 | more than one register. */ | |
160 | ||
161 | #undef NEEDS_UNTYPED_CALL | |
162 | #define NEEDS_UNTYPED_CALL 1 | |
163 | ||
164 | /* Define how to generate (in the callee) the output value of a | |
165 | function and how to find (in the caller) the value returned by a | |
166 | function. VALTYPE is the data type of the value (as a tree). If | |
167 | the precise function being called is known, FUNC is its | |
168 | FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the | |
7a1929e1 | 169 | result in d0, a0, or fp0 as appropriate. */ |
3b4b85c9 | 170 | |
8291155f RK |
171 | #undef FUNCTION_VALUE |
172 | #define FUNCTION_VALUE(VALTYPE, FUNC) \ | |
dcc21c4c | 173 | m68k_function_value (VALTYPE, FUNC) |
8291155f | 174 | |
8291155f RK |
175 | /* Define how to find the value returned by a library function |
176 | assuming the value has mode MODE. | |
177 | For m68k/SVR4 look for integer values in d0, pointer values in d0 | |
178 | (returned in both d0 and a0), and floating values in fp0. */ | |
179 | ||
180 | #undef LIBCALL_VALUE | |
181 | #define LIBCALL_VALUE(MODE) \ | |
dcc21c4c | 182 | m68k_libcall_value (MODE) |
8291155f | 183 | |
8291155f | 184 | /* For m68k SVR4, structures are returned using the reentrant |
7a1929e1 | 185 | technique. */ |
8291155f RK |
186 | #undef PCC_STATIC_STRUCT_RETURN |
187 | #define DEFAULT_PCC_STRUCT_RETURN 0 | |
d649cc96 | 188 | |
31fa03e5 | 189 | /* Finalize the trampoline by flushing the insn cache. */ |
f12d26af | 190 | |
31fa03e5 RK |
191 | #undef FINALIZE_TRAMPOLINE |
192 | #define FINALIZE_TRAMPOLINE(TRAMP) \ | |
c05ece92 AO |
193 | maybe_emit_call_builtin___clear_cache ((TRAMP), \ |
194 | plus_constant (Pmode, \ | |
195 | (TRAMP), \ | |
196 | TRAMPOLINE_SIZE)) | |
f12d26af | 197 | |
31fa03e5 RK |
198 | /* Clear the instruction cache from `beg' to `end'. This makes an |
199 | inline system call to SYS_cacheflush. The arguments are as | |
200 | follows: | |
201 | ||
202 | cacheflush (addr, scope, cache, len) | |
203 | ||
204 | addr - the start address for the flush | |
205 | scope - the scope of the flush (see the cpush insn) | |
206 | cache - which cache to flush (see the cpush insn) | |
207 | len - a factor relating to the number of flushes to perform: | |
3b4b85c9 | 208 | len/16 lines, or len/4096 pages. */ |
31fa03e5 RK |
209 | |
210 | #define CLEAR_INSN_CACHE(BEG, END) \ | |
211 | { \ | |
212 | register unsigned long _beg __asm ("%d1") = (unsigned long) (BEG); \ | |
213 | unsigned long _end = (unsigned long) (END); \ | |
214 | register unsigned long _len __asm ("%d4") = (_end - _beg + 32); \ | |
215 | __asm __volatile \ | |
3b4b85c9 BI |
216 | ("move%.l #123, %/d0\n\t" /* system call nr */ \ |
217 | "move%.l #1, %/d2\n\t" /* clear lines */ \ | |
218 | "move%.l #3, %/d3\n\t" /* insn+data caches */ \ | |
219 | "trap #0" \ | |
31fa03e5 RK |
220 | : /* no outputs */ \ |
221 | : "d" (_beg), "d" (_len) \ | |
222 | : "%d0", "%d2", "%d3"); \ | |
f12d26af | 223 | } |
3edc56a9 | 224 | |
a5fe455b | 225 | #define TARGET_ASM_FILE_END file_end_indicate_exec_stack |
19a95697 | 226 | |
ca60bd93 ML |
227 | #undef DEBUGGER_REGNO |
228 | #define DEBUGGER_REGNO(REGNO) (REGNO) | |
cd077e79 JM |
229 | |
230 | #undef SIZE_TYPE | |
231 | #define SIZE_TYPE "unsigned int" | |
232 | ||
233 | #undef PTRDIFF_TYPE | |
234 | #define PTRDIFF_TYPE "int" | |
235 | ||
236 | #undef WCHAR_TYPE | |
237 | #define WCHAR_TYPE "long int" | |
238 | ||
239 | #undef WCHAR_TYPE_SIZE | |
240 | #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
8b281334 RH |
241 | |
242 | /* Install the __sync libcalls. */ | |
243 | #undef TARGET_INIT_LIBFUNCS | |
244 | #define TARGET_INIT_LIBFUNCS m68k_init_sync_libfuncs |