* target.h (asm_out.byte_op, asm_out.aligned_op, asm_out.unaligned_op,
[official-gcc.git] / gcc / config / sparc / sysv4.h
bloba4c7f915c2e9985a372c77f2c5e65f8591eeaf7d
1 /* Target definitions for GNU compiler for Sparc running System V.4
2 Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000
3 Free Software Foundation, Inc.
4 Contributed by Ron Guilmette (rfg@monkeys.com).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 #ifndef TARGET_VERSION
24 #define TARGET_VERSION fprintf (stderr, " (sparc ELF)");
25 #endif
27 /* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h.
28 Why, exactly, is svr4.h messing with this? Seems like the chip
29 would know best. */
31 #undef SIZE_TYPE
32 #define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int")
34 #undef PTRDIFF_TYPE
35 #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int")
37 /* Undefined some symbols which are defined in "svr4.h" but which are
38 appropriate only for typical svr4 systems, but not for the specific
39 case of svr4 running on a Sparc. */
41 #undef INIT_SECTION_ASM_OP
42 #undef FINI_SECTION_ASM_OP
43 #undef CONST_SECTION_ASM_OP
44 #undef TYPE_OPERAND_FMT
45 #undef PUSHSECTION_FORMAT
46 #undef STRING_ASM_OP
47 #undef COMMON_ASM_OP
48 #undef SKIP_ASM_OP
49 #undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */
51 /* Provide a set of pre-definitions and pre-assertions appropriate for
52 the Sparc running svr4. __svr4__ is our extension. */
54 #undef CPP_PREDEFINES
55 #define CPP_PREDEFINES \
56 "-Dsparc -Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
58 /* The native assembler can't compute differences between symbols in different
59 sections when generating pic code, so we must put jump tables in the
60 text section. */
61 /* But we now defer the tables to the end of the function, so we make
62 this 0 to not confuse the branch shortening code. */
63 #define JUMP_TABLES_IN_TEXT_SECTION 0
65 /* Pass -K to the assembler when PIC. */
66 #undef ASM_SPEC
67 #define ASM_SPEC \
68 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
69 %{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)"
71 /* Must use data section for relocatable constants when pic. */
72 #undef SELECT_RTX_SECTION
73 #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \
74 { \
75 if (flag_pic && symbolic_operand ((RTX), (MODE))) \
76 data_section (); \
77 else \
78 const_section (); \
81 /* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
82 Note that many of these are different from the typical pseudo-ops used
83 by most svr4 assemblers. That is probably due to a (misguided?) attempt
84 to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
85 assembler. */
87 #define STRING_ASM_OP "\t.asciz\t"
88 #define COMMON_ASM_OP "\t.common\t"
89 #define SKIP_ASM_OP "\t.skip\t"
90 #define PUSHSECTION_ASM_OP "\t.pushsection\t"
91 #define POPSECTION_ASM_OP "\t.popsection"
93 /* This is the format used to print the second operand of a .type pseudo-op
94 for the Sparc/svr4 assembler. */
96 #define TYPE_OPERAND_FMT "#%s"
98 /* This is the format used to print a .pushsection pseudo-op (and its operand)
99 for the Sparc/svr4 assembler. */
101 #define PUSHSECTION_FORMAT "%s\"%s\"\n"
103 #undef ASM_OUTPUT_CASE_LABEL
104 #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \
105 do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \
106 ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \
107 } while (0)
109 /* This is how to equate one symbol to another symbol. The syntax used is
110 `SYM1=SYM2'. Note that this is different from the way equates are done
111 with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */
113 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
114 do { fprintf ((FILE), "\t"); \
115 assemble_name (FILE, LABEL1); \
116 fprintf (FILE, " = "); \
117 assemble_name (FILE, LABEL2); \
118 fprintf (FILE, "\n"); \
119 } while (0)
121 /* Define how the Sparc registers should be numbered for Dwarf output.
122 The numbering provided here should be compatible with the native
123 svr4 SDB debugger in the Sparc/svr4 reference port. The numbering
124 is as follows:
126 Assembly name gcc internal regno Dwarf regno
127 ----------------------------------------------------------
128 g0-g7 0-7 0-7
129 o0-o7 8-15 8-15
130 l0-l7 16-23 16-23
131 i0-i7 24-31 24-31
132 f0-f31 32-63 40-71
135 #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 32 ? (REGNO) : (REGNO) + 8)
137 /* A set of symbol definitions for assembly pseudo-ops which will
138 get us switched to various sections of interest. These are used
139 in all places where we simply want to switch to a section, and
140 *not* to push the previous section name onto the assembler's
141 section names stack (as we do often in dwarfout.c). */
143 #define TEXT_SECTION_ASM_OP "\t.section\t\".text\""
144 #define DATA_SECTION_ASM_OP "\t.section\t\".data\""
145 #define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
146 #define CONST_SECTION_ASM_OP "\t.section\t\".rodata\""
147 #define INIT_SECTION_ASM_OP "\t.section\t\".init\""
148 #define FINI_SECTION_ASM_OP "\t.section\t\".fini\""
150 /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
152 Note that we want to give these sections the SHF_WRITE attribute
153 because these sections will actually contain data (i.e. tables of
154 addresses of functions in the current root executable or shared library
155 file) and, in the case of a shared library, the relocatable addresses
156 will have to be properly resolved/relocated (and then written into) by
157 the dynamic linker when it actually attaches the given shared library
158 to the executing process. (Note that on SVR4, you may wish to use the
159 `-z text' option to the ELF linker, when building a shared library, as
160 an additional check that you are doing everything right. But if you do
161 use the `-z text' option when building a shared library, you will get
162 errors unless the .ctors and .dtors sections are marked as writable
163 via the SHF_WRITE attribute.) */
165 #undef CTORS_SECTION_ASM_OP
166 #define CTORS_SECTION_ASM_OP "\t.section\t\".ctors\",#alloc,#write"
167 #undef DTORS_SECTION_ASM_OP
168 #define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write"
170 /* Switch into a generic section. */
171 #undef TARGET_ASM_NAMED_SECTION
172 #define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section
174 /* A C statement (sans semicolon) to output to the stdio stream
175 FILE the assembler definition of uninitialized global DECL named
176 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
177 Try to use asm_output_aligned_bss to implement this macro. */
179 #undef ASM_OUTPUT_ALIGNED_BSS
180 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
181 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
183 /* Override the name of the mcount profiling function. */
185 #undef MCOUNT_FUNCTION
186 #define MCOUNT_FUNCTION "*_mcount"