xref: /openbsd/gnu/usr.bin/gcc/gcc/config/sparc/sol2.h (revision d89ec533)
1 /* Definitions of target machine for GNU compiler, for SPARC running Solaris 2
2    Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3    Free Software Foundation, Inc.
4    Contributed by Ron Guilmette (rfg@netcom.com).
5    Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
6 
7 This file is part of GNU CC.
8 
9 GNU CC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13 
14 GNU CC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with GNU CC; see the file COPYING.  If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA.  */
23 
24 /* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
25 
26 #undef CPP_PREDEFINES
27 #define CPP_PREDEFINES "-Dsparc"
28 
29 /* This is here rather than in sparc.h because it's not known what
30    other assemblers will accept.  */
31 
32 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9
33 #undef ASM_CPU_DEFAULT_SPEC
34 #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus"
35 #endif
36 
37 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
38 #undef ASM_CPU_DEFAULT_SPEC
39 #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
40 #endif
41 
42 #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
43 #undef ASM_CPU_DEFAULT_SPEC
44 #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
45 #endif
46 
47 #undef ASM_CPU_SPEC
48 #define ASM_CPU_SPEC "\
49 %{mcpu=v8plus:-xarch=v8plus} \
50 %{mcpu=v9:-xarch=v8plus} \
51 %{mcpu=ultrasparc:-xarch=v8plusa} \
52 %{mcpu=ultrasparc3:-xarch=v8plusb} \
53 %{!mcpu*:%(asm_cpu_default)} \
54 "
55 
56 #undef SUBTARGET_EXTRA_SPECS
57 #define SUBTARGET_EXTRA_SPECS \
58   { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
59   { "link_arch",	LINK_ARCH_SPEC }
60 
61 /* However it appears that Solaris 2.0 uses the same reg numbering as
62    the old BSD-style system did.  */
63 
64 /* Same as sparc.h */
65 #undef DBX_REGISTER_NUMBER
66 #define DBX_REGISTER_NUMBER(REGNO) \
67   (TARGET_FLAT && (REGNO) == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
68 
69 /* The Solaris 2 assembler uses .skip, not .zero, so put this back.  */
70 #undef ASM_OUTPUT_SKIP
71 #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
72   fprintf (FILE, "\t.skip %u\n", (SIZE))
73 
74 #undef  LOCAL_LABEL_PREFIX
75 #define LOCAL_LABEL_PREFIX  "."
76 
77 /* This is how to output a definition of an internal numbered label where
78    PREFIX is the class of label and NUM is the number within the class.  */
79 
80 #undef  ASM_OUTPUT_INTERNAL_LABEL
81 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)	\
82   fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
83 
84 /* This is how to output a reference to an internal numbered label where
85    PREFIX is the class of label and NUM is the number within the class.  */
86 
87 #undef  ASM_OUTPUT_INTERNAL_LABELREF
88 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM)	\
89   fprintf (FILE, ".L%s%d", PREFIX, NUM)
90 
91 /* This is how to store into the string LABEL
92    the symbol_ref name of an internal numbered label where
93    PREFIX is the class of label and NUM is the number within the class.
94    This is suitable for output with `assemble_name'.  */
95 
96 #undef  ASM_GENERATE_INTERNAL_LABEL
97 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
98   sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
99 
100 
101 
102 #undef  ENDFILE_SPEC
103 #define ENDFILE_SPEC \
104   "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
105    crtend.o%s crtn.o%s"
106 
107 /* Select a format to encode pointers in exception handling data.  CODE
108    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
109    true if the symbol may be affected by dynamic relocations.
110 
111    Some Solaris dynamic linkers don't handle unaligned section relative
112    relocs properly, so force them to be aligned.  */
113 #ifndef HAVE_AS_SPARC_UA_PCREL
114 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
115   ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
116 #endif
117 
118 /* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
119    Instead, it is enabled here, because it does work under Solaris.  */
120 /* Define for support of TFmode long double.
121    SPARC ABI says that long double is 4 words.  */
122 #define LONG_DOUBLE_TYPE_SIZE 128
123 
124 /* But indicate that it isn't supported by the hardware.  */
125 #define WIDEST_HARDWARE_FP_SIZE 64
126 
127 #define MULDI3_LIBCALL "__mul64"
128 #define DIVDI3_LIBCALL "__div64"
129 #define UDIVDI3_LIBCALL "__udiv64"
130 #define MODDI3_LIBCALL "__rem64"
131 #define UMODDI3_LIBCALL "__urem64"
132 
133 /* Solaris's _Qp_* library routine implementation clobbers the output
134    memory before the inputs are fully consumed.  */
135 
136 #undef TARGET_BUGGY_QP_LIB
137 #define TARGET_BUGGY_QP_LIB	1
138 
139 #undef INIT_SUBTARGET_OPTABS
140 #define INIT_SUBTARGET_OPTABS						\
141   fixsfdi_libfunc							\
142     = init_one_libfunc (TARGET_ARCH64 ? "__ftol" : "__ftoll");		\
143   fixunssfdi_libfunc							\
144     = init_one_libfunc (TARGET_ARCH64 ? "__ftoul" : "__ftoull");	\
145   fixdfdi_libfunc							\
146     = init_one_libfunc (TARGET_ARCH64 ? "__dtol" : "__dtoll");		\
147   fixunsdfdi_libfunc							\
148     = init_one_libfunc (TARGET_ARCH64 ? "__dtoul" : "__dtoull")
149 
150 /* Solaris allows 64 bit out and global registers in 32 bit mode.
151    sparc_override_options will disable V8+ if not generating V9 code.  */
152 #undef TARGET_DEFAULT
153 #define TARGET_DEFAULT (MASK_V8PLUS + MASK_FPU + MASK_LONG_DOUBLE_128)
154