-/* Target definitions for GNU compiler for Intel 80386 running Solaris 2
- Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- Free Software Foundation, Inc.
+/* Target definitions for GCC for Intel 80386 running Solaris 2
+ Copyright (C) 1993-2014 Free Software Foundation, Inc.
Contributed by Fred Fish (fnf@cygnus.com).
-This file is part of GNU CC.
+This file is part of GCC.
-GNU CC is free software; you can redistribute it and/or modify
+GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
-GNU CC is distributed in the hope that it will be useful,
+GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING. If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
-#include "i386/sysv4.h"
+#define SUBTARGET_OPTIMIZATION_OPTIONS \
+ { OPT_LEVELS_1_PLUS, OPT_momit_leaf_frame_pointer, NULL, 1 }
-/* We use stabs-in-elf for debugging, because that is what the native
- toolchain uses. */
-#undef PREFERRED_DEBUGGING_TYPE
-#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
-
-#if ! GAS_REJECTS_MINUS_S
-
-/*
- Changed from config/svr4.h in the following ways:
-
- - Removed -Yd (neither the sun bundled assembler nor gas accept it).
- - Added "-s" so that stabs are not discarded.
-*/
-
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s"
-
-#else /* GAS_REJECTS_MINUS_S */
-
-/* Same as above, except for -s, unsupported by GNU as. */
-#undef ASM_SPEC
-#define ASM_SPEC \
- "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*}"
-
-#endif /* GAS_REJECTS_MINUS_S */
-
-/* The Solaris 2.0 x86 linker botches alignment of code sections.
- It tries to align to a 16 byte boundary by padding with 0x00000090
- ints, rather than 0x90 bytes (nop). This generates trash in the
- ".init" section since the contribution from crtbegin.o is only 7
- bytes. The linker pads it to 16 bytes with a single 0x90 byte, and
- two 0x00000090 ints, which generates a segmentation violation when
- executed. This macro forces the assembler to do the padding, since
- it knows what it is doing. */
-
-#define FORCE_INIT_SECTION_ALIGN asm (ALIGN_ASM_OP ## "16")
-#define FORCE_FINI_SECTION_ALIGN FORCE_INIT_SECTION_ALIGN
-
-/* Select a format to encode pointers in exception handling data. CODE
- is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
- true if the symbol may be affected by dynamic relocations. */
+/* Old versions of the Solaris assembler can not handle the difference of
+ labels in different sections, so force DW_EH_PE_datarel if so. */
+#ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
#undef ASM_PREFERRED_EH_DATA_FORMAT
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
- (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel \
+ (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0) \
+ | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4 \
+ : DW_EH_PE_datarel)) \
: DW_EH_PE_absptr)
+#endif
+
+/* The Solaris linker will not merge a read-only .eh_frame section
+ with a read-write .eh_frame section. None of the encodings used
+ with non-PIC code require runtime relocations. In 64-bit mode,
+ since there is no backwards compatibility issue, we use a read-only
+ section for .eh_frame. In 32-bit mode, we use a writable .eh_frame
+ section in order to be compatible with G++ for Solaris x86. */
+#undef EH_TABLES_CAN_BE_READ_ONLY
+#define EH_TABLES_CAN_BE_READ_ONLY (TARGET_64BIT)
+
+/* Follow Sun requirements for TLS code sequences and use Sun assembler TLS
+ syntax. */
+#undef TARGET_SUN_TLS
+#define TARGET_SUN_TLS 1
+
+/* Solaris 2/Intel as chokes on #line directives before Solaris 10. */
+#undef CPP_SPEC
+#define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)"
+
+/* GNU as understands --32 and --64, but the native Solaris
+ assembler requires -xarch=generic or -xarch=generic64 instead. */
+#ifdef USE_GAS
+#define ASM_CPU32_DEFAULT_SPEC "--32"
+#define ASM_CPU64_DEFAULT_SPEC "--64"
+#else
+#define ASM_CPU32_DEFAULT_SPEC "-xarch=generic"
+#define ASM_CPU64_DEFAULT_SPEC "-xarch=generic64"
+#endif
+
+#undef ASM_CPU_SPEC
+#define ASM_CPU_SPEC "%(asm_cpu_default)"
+
+/* Don't include ASM_PIC_SPEC. While the Solaris 10+ assembler accepts -K PIC,
+ it gives many warnings:
+ Absolute relocation is used for symbol "<symbol>"
+ GNU as doesn't recognize -K at all. */
+#undef ASM_SPEC
+#define ASM_SPEC ASM_SPEC_BASE
-/* Add "sun" to the list of symbols defined for SVR4. */
-#undef CPP_PREDEFINES
-#define CPP_PREDEFINES \
- "-Dunix -D__svr4__ -D__SVR4 -Dsun -Asystem=svr4"
+#define DEFAULT_ARCH32_P !TARGET_64BIT_DEFAULT
-/* Solaris 2/Intel as chokes on #line directives. */
-#undef CPP_SPEC
-#define CPP_SPEC \
- "%{.S:-P} \
- %(cpp_cpu) \
- %{pthreads:-D_REENTRANT -D_PTHREADS} \
- %{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} \
- %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}"
-
-/* For C++ we need to add some additional macro definitions required
- by the C++ standard library. */
-#define CPLUSPLUS_CPP_SPEC "\
--D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
--D__EXTENSIONS__ \
-%(cpp) \
-"
-
-#undef LIB_SPEC
-#define LIB_SPEC \
- "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
- %{!shared:\
- %{!symbolic:\
- %{pthreads:-lpthread} \
- %{!pthreads:%{threads:-lthread}} \
- -lc}}"
+#define ARCH64_SUBDIR "amd64"
+
+#ifdef USE_GLD
+/* Since binutils 2.21, GNU ld supports new *_sol2 emulations to strictly
+ follow the Solaris 2 ABI. Prefer them if present. */
+#ifdef HAVE_LD_SOL2_EMULATION
+#define ARCH32_EMULATION "elf_i386_sol2"
+#define ARCH64_EMULATION "elf_x86_64_sol2"
+#else
+#define ARCH32_EMULATION "elf_i386"
+#define ARCH64_EMULATION "elf_x86_64"
+#endif
+#endif
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC "crtend.o%s %{pg:crtn.o%s}%{!pg:crtn.o%s}"
-
-#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared: \
- %{!symbolic: \
- %{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}}\
- %{pg:gmon.o%s} crti.o%s \
- %{ansi:values-Xc.o%s} \
- %{!ansi: \
- %{traditional:values-Xt.o%s} \
- %{!traditional:values-Xa.o%s}} \
- crtbegin.o%s"
-
-/* This should be the same as in svr4.h, except with -R added. */
-#undef LINK_SPEC
-#define LINK_SPEC \
- "%{h*} %{v:-V} \
- %{b} %{Wl,*:%*} \
- %{static:-dn -Bstatic} \
- %{shared:-G -dy %{!mimpure-text:-z text}} \
- %{symbolic:-Bsymbolic -G -dy -z text} \
- %{G:-G} \
- %{YP,*} \
- %{R*} \
- %{compat-bsd: \
- %{!YP,*:%{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!pg:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \
- -R /usr/ucblib} \
- %{!compat-bsd: \
- %{!YP,*:%{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!pg:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
- %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}} \
- %{Qy:} %{!Qn:-Qy}"
-
-/* This defines which switch letters take arguments.
- It is as in svr4.h but with -R added. */
-
-#undef SWITCH_TAKES_ARG
-#define SWITCH_TAKES_ARG(CHAR) \
- (DEFAULT_SWITCH_TAKES_ARG(CHAR) \
- || (CHAR) == 'R' \
- || (CHAR) == 'h' \
- || (CHAR) == 'z')
-
-#define STDC_0_IN_SYSTEM_HEADERS 1
+#define ENDFILE_SPEC \
+ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
+ %{mpc32:crtprec32.o%s} \
+ %{mpc64:crtprec64.o%s} \
+ %{mpc80:crtprec80.o%s} \
+ crtend.o%s crtn.o%s"
+
+#define SUBTARGET_CPU_EXTRA_SPECS \
+ { "cpp_subtarget", CPP_SUBTARGET_SPEC }, \
+ { "asm_cpu", ASM_CPU_SPEC }, \
+ { "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
+
+/* Register the Solaris-specific #pragma directives. */
+#define REGISTER_SUBTARGET_PRAGMAS() solaris_register_pragmas ()
#undef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX "."
+
+/* The Solaris 10 FCS as doesn't accept "#" comments, while later versions
+ do. */
+#undef ASM_COMMENT_START
+#define ASM_COMMENT_START "/"
+
+/* The 32-bit Solaris assembler does not support .quad. Do not use it. */
+#ifndef HAVE_AS_IX86_QUAD
+#undef ASM_QUAD
+#endif
+
+/* The native Solaris assembler can't calculate the difference between
+ symbols in different sections, which causes problems for -fPIC jump
+ tables in .rodata. */
+#ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
+#undef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
+/* The native Solaris assembler cannot handle the SYMBOL-. syntax, but
+ requires SYMBOL@rel/@rel64 instead. */
+#define ASM_OUTPUT_DWARF_PCREL(FILE, SIZE, LABEL) \
+ do { \
+ fputs (integer_asm_op (SIZE, FALSE), FILE); \
+ assemble_name (FILE, LABEL); \
+ fputs (SIZE == 8 ? "@rel64" : "@rel", FILE); \
+ } while (0)
+#endif
+
+/* The Solaris assembler wants a .local for non-exported aliases. */
+#define ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET) \
+ do { \
+ const char *declname = \
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
+ ASM_OUTPUT_DEF ((FILE), declname, \
+ IDENTIFIER_POINTER (TARGET)); \
+ if (! TREE_PUBLIC (DECL)) \
+ { \
+ fprintf ((FILE), "%s", LOCAL_ASM_OP); \
+ assemble_name ((FILE), declname); \
+ fprintf ((FILE), "\n"); \
+ } \
+ } while (0)
+
+#ifndef USE_GAS
+/* The Sun assembler uses .tcomm for TLS common sections. */
+#define TLS_COMMON_ASM_OP ".tcomm"
+
+/* Similar to the Sun assembler on SPARC, the native assembler requires
+ TLS objects to be declared as @tls_obj (not @tls_object). Unlike SPARC,
+ gas doesn't understand this variant. */
+#undef ASM_DECLARE_OBJECT_NAME
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do \
+ { \
+ HOST_WIDE_INT size; \
+ \
+ if (targetm.have_tls && DECL_THREAD_LOCAL_P (DECL)) \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "tls_obj"); \
+ else \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
+ \
+ size_directive_output = 0; \
+ if (!flag_inhibit_size_directive \
+ && (DECL) && DECL_SIZE (DECL)) \
+ { \
+ size_directive_output = 1; \
+ size = int_size_in_bytes (TREE_TYPE (DECL)); \
+ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
+ } \
+ \
+ ASM_OUTPUT_LABEL (FILE, NAME); \
+ } \
+ while (0)
+#endif /* !USE_GAS */
+
+/* As in sparc/sol2.h, override the default from i386/x86-64.h to work
+ around Sun as TLS bug. */
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
+ do \
+ { \
+ if (TARGET_SUN_TLS \
+ && in_section \
+ && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
+ switch_to_section (bss_section); \
+ x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); \
+ } \
+ while (0)
+
+/* Output a simple call for .init/.fini. */
+#define ASM_OUTPUT_CALL(FILE, FN) \
+ do \
+ { \
+ fprintf (FILE, "\tcall\t"); \
+ ix86_print_operand (FILE, XEXP (DECL_RTL (FN), 0), 'P'); \
+ fprintf (FILE, "\n"); \
+ } \
+ while (0)
+
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
+
+#ifndef USE_GAS
+/* Emit COMDAT group signature symbols for Sun as. */
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END solaris_file_end
+#endif
+
+/* Unlike GNU ld, Sun ld doesn't coalesce .ctors.N/.dtors.N sections, so
+ inhibit their creation. Also cf. sparc/sysv4.h. */
+#ifndef USE_GLD
+#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\""
+#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\""
+#endif
+
+#define USE_IX86_FRAME_POINTER 1
+#define USE_X86_64_FRAME_POINTER 1
+
+#undef NO_PROFILE_COUNTERS
+
+#undef MCOUNT_NAME
+#define MCOUNT_NAME "_mcount"
+
+/* We do not need NT_VERSION notes. */
+#undef X86_FILE_START_VERSION_DIRECTIVE
+#define X86_FILE_START_VERSION_DIRECTIVE false
+
+/* Only recent versions of Solaris 11 ld properly support hidden .gnu.linkonce
+ sections, so don't use them. */
+#ifndef USE_GLD
+#define USE_HIDDEN_LINKONCE 0
+#endif