1/* Solaris 10 configuration.
2   Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010
3   Free Software Foundation, Inc.
4   Contributed by CodeSourcery, LLC.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3.  If not see
20<http://www.gnu.org/licenses/>.  */
21
22#undef ASM_COMMENT_START
23#define ASM_COMMENT_START "/"
24
25/* binutils' GNU as understands --32 and --64, but the native Solaris
26   assembler requires -xarch=generic or -xarch=generic64 instead.  */
27#undef ASM_SPEC
28#ifdef USE_GAS
29#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
30		 "%{Wa,*:%*} %{m32:--32} %{m64:--64} -s %(asm_cpu)"
31#else
32#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} " \
33		 "%{Wa,*:%*} %{m32:-xarch=generic} %{m64:-xarch=generic64} " \
34		 "-s %(asm_cpu)"
35#endif
36
37/* The native Solaris assembler can't calculate the difference between
38   symbols in different sections, which causes problems for -fPIC jump
39   tables in .rodata.  */
40#ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
41#undef JUMP_TABLES_IN_TEXT_SECTION
42#define JUMP_TABLES_IN_TEXT_SECTION 1
43
44/* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
45   requires SYMBOL@rel/@rel64 instead.  */
46#define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL)	\
47  do {							\
48    fputs (integer_asm_op (SIZE, FALSE), FILE);		\
49    assemble_name (FILE, LABEL);			\
50    fputs (SIZE == 8 ? "@rel64" : "@rel", FILE);	\
51  } while (0)
52#endif
53
54/* As in sol2.h, override the default from i386/x86-64.h to work around
55   Sun as TLS bug.  */
56#undef  ASM_OUTPUT_ALIGNED_COMMON
57#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)		\
58  do									\
59    {									\
60      if (TARGET_SUN_TLS						\
61	  && in_section							\
62	  && ((in_section->common.flags & (SECTION_TLS | SECTION_BSS))	\
63	      == (SECTION_TLS | SECTION_BSS)))				\
64	switch_to_section (bss_section);				\
65      x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN);			\
66    }									\
67  while  (0)
68
69#undef NO_PROFILE_COUNTERS
70
71#undef MCOUNT_NAME
72#define MCOUNT_NAME "_mcount"
73
74#undef WCHAR_TYPE
75#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
76#undef WCHAR_TYPE_SIZE
77#define WCHAR_TYPE_SIZE 32
78
79#undef WINT_TYPE
80#define WINT_TYPE (TARGET_64BIT ? "int" : "long int")
81#undef WINT_TYPE_SIZE
82#define WINT_TYPE_SIZE 32
83
84#define SUBTARGET_OVERRIDE_OPTIONS				\
85  do								\
86    {								\
87      if (flag_omit_frame_pointer == 2)				\
88	flag_omit_frame_pointer = 0;				\
89    }								\
90  while (0)
91
92#undef TARGET_SUBTARGET_DEFAULT
93#define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP	\
94				  | MASK_FLOAT_RETURNS)
95
96#define SUBTARGET_OPTIMIZATION_OPTIONS			\
97  do							\
98    {							\
99      if (optimize >= 1)				\
100	target_flags |= MASK_OMIT_LEAF_FRAME_POINTER;	\
101    }							\
102  while (0)
103
104#define MULTILIB_DEFAULTS { "m32" }
105
106#undef LINK_ARCH64_SPEC_BASE
107#define LINK_ARCH64_SPEC_BASE \
108  "%{G:-G} \
109   %{YP,*} \
110   %{R*} \
111   %{compat-bsd: \
112     %{!YP,*:%{p|pg:-Y P,/usr/ucblib/64:/usr/lib/libp/64:/lib/64:/usr/lib/64} \
113             %{!p:%{!pg:-Y P,/usr/ucblib/64:/lib:/usr/lib/64}}} \
114             -R /usr/ucblib/64} \
115   %{!compat-bsd: \
116     %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \
117             %{!p:%{!pg:-Y P,/lib/64:/usr/lib/64}}}}"
118
119#undef LINK_ARCH64_SPEC
120#define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
121
122#ifdef TARGET_GNU_LD
123/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
124   follow the Solaris 2 ABI.  Prefer them if present.  */
125#ifdef HAVE_LD_SOL2_EMULATION
126#define I386_EMULATION "elf_i386_sol2"
127#define X86_64_EMULATION "elf_x86_64_sol2"
128#else
129#define I386_EMULATION "elf_i386"
130#define X86_64_EMULATION "elf_x86_64"
131#endif
132
133#define TARGET_LD_EMULATION "%{m64:-m " X86_64_EMULATION "}" \
134			    "%{!m64:-m " I386_EMULATION "} "
135#else
136#define TARGET_LD_EMULATION ""
137#endif
138
139#undef LINK_ARCH_SPEC
140#define LINK_ARCH_SPEC TARGET_LD_EMULATION \
141		       "%{m64:" LINK_ARCH64_SPEC "}%{!m64:" LINK_ARCH32_SPEC "}"
142
143/* We do not need to search a special directory for startup files.  */
144#undef MD_STARTFILE_PREFIX
145
146#undef TARGET_ASM_NAMED_SECTION
147#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
148