sol2.h revision 1.1.1.1.4.2
1/* Definitions of target machine for GCC, for SPARC running Solaris 2
2   Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
3   2006, 2007, 2008, 2010 Free Software Foundation, Inc.
4   Contributed by Ron Guilmette (rfg@netcom.com).
5   Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 3, or (at your option)
12any later version.
13
14GCC is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING3.  If not see
21<http://www.gnu.org/licenses/>.  */
22
23/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
24
25/* This is here rather than in sparc.h because it's not known what
26   other assemblers will accept.  */
27
28#if TARGET_CPU_DEFAULT == TARGET_CPU_v9
29#undef ASM_CPU_DEFAULT_SPEC
30#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus"
31#endif
32
33#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
34#undef ASM_CPU_DEFAULT_SPEC
35#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa"
36#endif
37
38#if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
39#undef ASM_CPU_DEFAULT_SPEC
40#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
41#endif
42
43#if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
44#undef ASM_CPU_DEFAULT_SPEC
45#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
46#endif
47
48#if TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
49#undef ASM_CPU_DEFAULT_SPEC
50#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
51#endif
52
53#undef ASM_CPU_SPEC
54#define ASM_CPU_SPEC "\
55%{mcpu=v9:-xarch=v8plus} \
56%{mcpu=ultrasparc:-xarch=v8plusa} \
57%{mcpu=ultrasparc3:-xarch=v8plusb} \
58%{mcpu=niagara:-xarch=v8plusb} \
59%{mcpu=niagara2:-xarch=v8plusb} \
60%{!mcpu*:%(asm_cpu_default)} \
61"
62
63#undef SUBTARGET_EXTRA_SPECS
64#define SUBTARGET_EXTRA_SPECS \
65  { "startfile_arch",	STARTFILE_ARCH_SPEC },	\
66  { "link_arch",	LINK_ARCH_SPEC }
67
68/* However it appears that Solaris 2.0 uses the same reg numbering as
69   the old BSD-style system did.  */
70
71/* The Solaris 2 assembler uses .skip, not .zero, so put this back.  */
72#undef ASM_OUTPUT_SKIP
73#define ASM_OUTPUT_SKIP(FILE,SIZE)  \
74  fprintf (FILE, "\t.skip %u\n", (int)(SIZE))
75
76#undef  LOCAL_LABEL_PREFIX
77#define LOCAL_LABEL_PREFIX  "."
78
79/* This is how to store into the string LABEL
80   the symbol_ref name of an internal numbered label where
81   PREFIX is the class of label and NUM is the number within the class.
82   This is suitable for output with `assemble_name'.  */
83
84#undef  ASM_GENERATE_INTERNAL_LABEL
85#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)	\
86  sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM))
87
88/* The native TLS-enabled assembler requires the directive #tls_object
89   to be put on objects in TLS sections (as of v7.1).  This is not
90   required by the GNU assembler but supported on SPARC.  */
91#undef  ASM_DECLARE_OBJECT_NAME
92#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)		\
93  do								\
94    {								\
95      HOST_WIDE_INT size;					\
96								\
97      if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL))	\
98	ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_object");	\
99      else							\
100	ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object");	\
101								\
102      size_directive_output = 0;				\
103      if (!flag_inhibit_size_directive				\
104	  && (DECL) && DECL_SIZE (DECL))			\
105	{							\
106	  size_directive_output = 1;				\
107	  size = int_size_in_bytes (TREE_TYPE (DECL));		\
108	  ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size);		\
109	}							\
110								\
111      ASM_OUTPUT_LABEL (FILE, NAME);				\
112    }								\
113  while (0)
114
115/* The Solaris assembler cannot grok .stabd directives.  */
116#undef NO_DBX_BNSYM_ENSYM
117#define NO_DBX_BNSYM_ENSYM 1
118
119
120#undef  ENDFILE_SPEC
121#define ENDFILE_SPEC \
122  "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
123   crtend.o%s crtn.o%s"
124
125/* Select a format to encode pointers in exception handling data.  CODE
126   is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
127   true if the symbol may be affected by dynamic relocations.
128
129   Some Solaris dynamic linkers don't handle unaligned section relative
130   relocs properly, so force them to be aligned.  */
131#ifndef HAVE_AS_SPARC_UA_PCREL
132#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)		\
133  ((flag_pic || GLOBAL) ? DW_EH_PE_aligned : DW_EH_PE_absptr)
134#endif
135
136
137/* Define for support of TFmode long double.
138   SPARC ABI says that long double is 4 words.  */
139#define LONG_DOUBLE_TYPE_SIZE 128
140
141/* Solaris's _Qp_* library routine implementation clobbers the output
142   memory before the inputs are fully consumed.  */
143
144#undef TARGET_BUGGY_QP_LIB
145#define TARGET_BUGGY_QP_LIB	1
146
147#undef SUN_CONVERSION_LIBFUNCS
148#define SUN_CONVERSION_LIBFUNCS 1
149
150#undef DITF_CONVERSION_LIBFUNCS
151#define DITF_CONVERSION_LIBFUNCS 1
152
153#undef SUN_INTEGER_MULTIPLY_64
154#define SUN_INTEGER_MULTIPLY_64 1
155
156/* Solaris allows 64-bit out and global registers to be used in 32-bit mode.
157   sparc_override_options will disable V8+ if either not generating V9 code
158   or generating 64-bit code.  */
159#undef TARGET_DEFAULT
160#ifdef TARGET_64BIT_DEFAULT
161#define TARGET_DEFAULT \
162  (MASK_V9 + MASK_64BIT + MASK_PTR64 + MASK_STACK_BIAS + \
163   MASK_V8PLUS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
164#else
165#define TARGET_DEFAULT \
166  (MASK_V8PLUS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
167#endif
168
169/* Solaris-specific #pragmas are implemented on top of attributes.  Hook in
170   the bits from config/sol2.c.  */
171#define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
172#define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
173
174/* Register the Solaris-specific #pragma directives.  */
175#define REGISTER_TARGET_PRAGMAS() solaris_register_pragmas ()
176
177/* Output a simple call for .init/.fini.  */
178#define ASM_OUTPUT_CALL(FILE, FN)			        \
179  do								\
180    {								\
181      fprintf (FILE, "\tcall\t");				\
182      print_operand (FILE, XEXP (DECL_RTL (FN), 0), 0);	\
183      fprintf (FILE, "\n\tnop\n");				\
184    }								\
185  while (0)
186
187/* This is how to output an assembler line that says to advance
188   the location counter to a multiple of 2**LOG bytes using the
189   NOP instruction as padding.  */
190#define ASM_OUTPUT_ALIGN_WITH_NOP(FILE,LOG)   \
191  if ((LOG) != 0)                             \
192    fprintf (FILE, "\t.align %d,0x1000000\n", (1<<(LOG)))
193
194/* Use Solaris ELF section syntax.  */
195#undef TARGET_ASM_NAMED_SECTION
196#define TARGET_ASM_NAMED_SECTION sparc_solaris_elf_asm_named_section
197
198/* Solaris/SPARC as uses a non-standard .section/.pushsection syntax.
199   While gas supports it, too, we prefer the standard variant.  */
200#ifndef USE_GAS
201#undef PUSHSECTION_FORMAT
202#define PUSHSECTION_FORMAT	"\t.pushsection\t\"%s\"\n"
203#endif
204
205#define MD_UNWIND_SUPPORT "config/sparc/sol2-unwind.h"
206