1/* Target definitions for GNU compiler for SPARC running System V.4
2   Copyright (C) 1991-2015 Free Software Foundation, Inc.
3   Contributed by Ron Guilmette (rfg@monkeys.com).
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3.  If not see
19<http://www.gnu.org/licenses/>.  */
20
21#undef SIZE_TYPE
22#define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
23
24#undef PTRDIFF_TYPE
25#define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
26
27/* Undefined some symbols which are appropriate only for typical svr4
28   systems, but not for the specific case of svr4 running on a
29   SPARC.  */
30
31#undef INIT_SECTION_ASM_OP
32#undef FINI_SECTION_ASM_OP
33#undef READONLY_DATA_SECTION_ASM_OP
34#undef TYPE_OPERAND_FMT
35#undef STRING_ASM_OP
36#undef COMMON_ASM_OP
37#undef SKIP_ASM_OP
38#undef SET_ASM_OP	/* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
39
40/* Pass -K to the assembler when PIC.  */
41#undef ASM_SPEC
42#define ASM_SPEC \
43  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} \
44   %{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)"
45
46/* Define the names of various pseudo-op used by the SPARC/svr4 assembler.
47   Note that many of these are different from the typical pseudo-ops used
48   by most svr4 assemblers.  That is probably due to a (misguided?) attempt
49   to keep the SPARC/svr4 assembler somewhat compatible with the SPARC/SunOS
50   assembler.  */
51
52#define STRING_ASM_OP		"\t.asciz\t"
53#define COMMON_ASM_OP		"\t.common\t"
54#define SKIP_ASM_OP		"\t.skip\t"
55
56/* This is the format used to print the second operand of a .type pseudo-op
57   for the SPARC/svr4 assembler.  */
58
59#define TYPE_OPERAND_FMT      "#%s"
60
61#undef ASM_OUTPUT_CASE_LABEL
62#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)		\
63do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3);		\
64     (*targetm.asm_out.internal_label) ((FILE), PREFIX, NUM);		\
65   } while (0)
66
67/* This is how to equate one symbol to another symbol.  The syntax used is
68   `SYM1=SYM2'.  Note that this is different from the way equates are done
69   with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
70
71#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
72 do {	fprintf ((FILE), "\t");						\
73	assemble_name (FILE, LABEL1);					\
74	fprintf (FILE, " = ");						\
75	assemble_name (FILE, LABEL2);					\
76	fprintf (FILE, "\n");						\
77  } while (0)
78
79/* A set of symbol definitions for assembly pseudo-ops which will
80   get us switched to various sections of interest.  These are used
81   in all places where we simply want to switch to a section, and
82   *not* to push the previous section name onto the assembler's
83   section names stack (as we do often in dwarfout.c).  */
84
85#define TEXT_SECTION_ASM_OP	"\t.section\t\".text\""
86#define DATA_SECTION_ASM_OP	"\t.section\t\".data\""
87#define BSS_SECTION_ASM_OP	"\t.section\t\".bss\""
88#define READONLY_DATA_SECTION_ASM_OP "\t.section\t\".rodata\""
89#define INIT_SECTION_ASM_OP	"\t.section\t\".init\""
90#define FINI_SECTION_ASM_OP	"\t.section\t\".fini\""
91
92/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
93
94   Note that we want to give these sections the SHF_WRITE attribute
95   because these sections will actually contain data (i.e. tables of
96   addresses of functions in the current root executable or shared library
97   file) and, in the case of a shared library, the relocatable addresses
98   will have to be properly resolved/relocated (and then written into) by
99   the dynamic linker when it actually attaches the given shared library
100   to the executing process.  (Note that on SVR4, you may wish to use the
101   `-z text' option to the ELF linker, when building a shared library, as
102   an additional check that you are doing everything right.  But if you do
103   use the `-z text' option when building a shared library, you will get
104   errors unless the .ctors and .dtors sections are marked as writable
105   via the SHF_WRITE attribute.)  */
106
107#undef CTORS_SECTION_ASM_OP
108#define CTORS_SECTION_ASM_OP    "\t.section\t\".ctors\",#alloc,#write"
109#undef DTORS_SECTION_ASM_OP
110#define DTORS_SECTION_ASM_OP    "\t.section\t\".dtors\",#alloc,#write"
111
112#undef ASM_OUTPUT_ALIGNED_BSS
113#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
114  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
115
116/* Override the name of the mcount profiling function.  */
117
118#undef MCOUNT_FUNCTION
119#define MCOUNT_FUNCTION "*_mcount"
120