tree-optimization/115602 - SLP CSE results in cycles
[official-gcc.git] / gcc / config / sparc / netbsd-elf.h
blob2cf85dd709694719edea536813fa93ac023eed0d
1 /* Definitions of target machine for GCC, for ELF on NetBSD/sparc
2 and NetBSD/sparc64.
3 Copyright (C) 2002-2024 Free Software Foundation, Inc.
4 Contributed by Matthew Green (mrg@eterna.com.au).
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #define TARGET_OS_CPP_BUILTINS() \
23 do \
24 { \
25 NETBSD_OS_CPP_BUILTINS_ELF(); \
26 if (TARGET_ARCH64) \
27 { \
28 builtin_define ("__sparc64__"); \
29 builtin_define ("__sparc_v9__"); \
30 builtin_define ("__sparcv9"); \
31 } \
32 else \
33 builtin_define ("__sparc"); \
34 builtin_define ("__sparc__"); \
35 } \
36 while (0)
38 /* CPP defines used by all NetBSD targets. */
39 #undef CPP_SUBTARGET_SPEC
40 #define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
42 /* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */
43 #undef SIZE_TYPE
44 #define SIZE_TYPE "long unsigned int"
46 #undef PTRDIFF_TYPE
47 #define PTRDIFF_TYPE "long int"
49 #undef LOCAL_LABEL_PREFIX
50 #define LOCAL_LABEL_PREFIX "."
52 /* This is how to store into the string LABEL
53 the symbol_ref name of an internal numbered label where
54 PREFIX is the class of label and NUM is the number within the class.
55 This is suitable for output with `assemble_name'. */
57 #undef ASM_GENERATE_INTERNAL_LABEL
58 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
59 sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
61 #undef USER_LABEL_PREFIX
62 #define USER_LABEL_PREFIX ""
64 #undef ASM_SPEC
65 #define ASM_SPEC "%{" FPIE_OR_FPIC_SPEC ":-K PIC} \
66 %(asm_cpu) %(asm_arch) %(asm_relax)"
68 #undef STDC_0_IN_SYSTEM_HEADERS
70 #define HAVE_ENABLE_EXECUTE_STACK
72 /* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
73 description, allowing one to build 32-bit or 64-bit applications
74 on either. We define the sparc & sparc64 versions of things,
75 occasionally a neutral version (should be the same as "netbsd-elf.h")
76 and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
77 we choose the correct version. */
79 /* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
80 definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
81 not have a default place to find these libraries.. */
83 /* TARGET_CPU_DEFAULT is set in Makefile.in. We test for 64-bit default
84 platform here. */
86 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
87 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
88 /* A 64 bit v9 compiler with stack-bias,
89 in a Medium/Low code model environment. */
91 #undef TARGET_DEFAULT
92 #define TARGET_DEFAULT \
93 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
94 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
96 #undef SPARC_DEFAULT_CMODEL
97 #define SPARC_DEFAULT_CMODEL CM_MEDANY
99 #endif
101 /* CC1_SPEC for NetBSD/sparc. */
102 #define CC1_SPEC32 \
103 "%{m32:%{m64:%emay not use both -m32 and -m64}} \
104 %{m64: \
105 -mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
106 %{!mcpu*:%{!mv8plus:-mcpu=ultrasparc}} \
107 %{!mno-vis:%{!mcpu=v9:-mvis}} \
108 %{p:-mcmodel=medlow} \
109 %{pg:-mcmodel=medlow}}"
111 #define CC1_SPEC64 \
112 "%{m32:%{m64:%emay not use both -m32 and -m64}} \
113 %{m32: \
114 -mptr32 -mno-stack-bias \
115 %{!mlong-double-128:-mlong-double-64} \
116 %{!mcpu*:%{!mv8plus:-mcpu=cypress}}} \
117 %{!m32: \
118 %{p:-mcmodel=medlow} \
119 %{pg:-mcmodel=medlow}}"
121 /* Make sure we use the right output format. Pick a default and then
122 make sure -m32/-m64 switch to the right one. */
124 #define LINK_ARCH32_SPEC "-m elf32_sparc"
126 #define LINK_ARCH64_SPEC "-m elf64_sparc"
128 #define LINK_ARCH_SPEC \
129 "%{m32:%(link_arch32)} \
130 %{m64:%(link_arch64)} \
131 %{!m32:%{!m64:%(link_arch_default)}}"
133 #undef LINK_SPEC
134 #define LINK_SPEC \
135 "%(link_arch) \
136 %{!mno-relax:%{!r:-relax}} \
137 %(netbsd_link_spec)"
139 #define NETBSD_ENTRY_POINT "__start"
141 #if DEFAULT_ARCH32_P
142 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
143 #else
144 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
145 #endif
147 /* What extra spec entries do we need? */
148 #undef SUBTARGET_EXTRA_SPECS
149 #define SUBTARGET_EXTRA_SPECS \
150 { "link_arch32", LINK_ARCH32_SPEC }, \
151 { "link_arch64", LINK_ARCH64_SPEC }, \
152 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
153 { "link_arch", LINK_ARCH_SPEC }, \
154 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
155 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
156 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
159 /* Build a compiler that supports -m32 and -m64? */
161 #ifdef SPARC_BI_ARCH
163 #undef LONG_DOUBLE_TYPE_SIZE
164 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
166 #undef CC1_SPEC
167 #if DEFAULT_ARCH32_P
168 #define CC1_SPEC CC1_SPEC32
169 #else
170 #define CC1_SPEC CC1_SPEC64
171 #endif
173 #if DEFAULT_ARCH32_P
174 #define MULTILIB_DEFAULTS { "m32" }
175 #else
176 #define MULTILIB_DEFAULTS { "m64" }
177 #endif
179 #else /* SPARC_BI_ARCH */
181 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
182 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
184 #undef LONG_DOUBLE_TYPE_SIZE
185 #define LONG_DOUBLE_TYPE_SIZE 128
187 #undef CC1_SPEC
188 #define CC1_SPEC CC1_SPEC64
190 #else /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
191 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
193 /* A 32-bit only compiler. NetBSD don't support 128 bit `long double'
194 for 32-bit code, unlike Solaris. */
196 #undef LONG_DOUBLE_TYPE_SIZE
197 #define LONG_DOUBLE_TYPE_SIZE 64
199 #undef CC1_SPEC
200 #define CC1_SPEC CC1_SPEC32
202 #endif /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
203 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
205 #endif /* SPARC_BI_ARCH */
207 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
208 #undef CTORS_SECTION_ASM_OP
209 #undef DTORS_SECTION_ASM_OP