]>
Commit | Line | Data |
---|---|---|
17fd0700 | 1 | /* Target definitions for GNU compiler for Sparc running System V.4 |
2398fb2a RB |
2 | Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000 |
3 | Free Software Foundation, Inc. | |
e5e809f4 | 4 | Contributed by Ron Guilmette (rfg@monkeys.com). |
17fd0700 RS |
5 | |
6 | This file is part of GNU CC. | |
7 | ||
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. | |
12 | ||
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. | |
17 | ||
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 | |
c15c9075 RK |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. */ | |
17fd0700 | 22 | |
f1c7021e | 23 | #include "sparc/sparc.h" |
19c3fc24 RS |
24 | |
25 | /* Undefine some symbols which are defined in "sparc.h" but which are | |
26 | appropriate only for SunOS 4.x, and not for svr4. */ | |
27 | ||
19c3fc24 | 28 | #undef WORD_SWITCH_TAKES_ARG |
136bfcb3 | 29 | #undef ASM_OUTPUT_SOURCE_LINE |
19c3fc24 RS |
30 | #undef SELECT_SECTION |
31 | #undef ASM_DECLARE_FUNCTION_NAME | |
32 | #undef TEXT_SECTION_ASM_OP | |
33 | #undef DATA_SECTION_ASM_OP | |
34 | ||
17fd0700 RS |
35 | #include "svr4.h" |
36 | ||
82d6b402 RH |
37 | /* ??? Put back the SIZE_TYPE/PTRDIFF_TYPE definitions set by sparc.h. |
38 | Why, exactly, is svr4.h messing with this? Seems like the chip | |
39 | would know best. */ | |
40 | ||
41 | #undef SIZE_TYPE | |
42 | #define SIZE_TYPE (TARGET_ARCH64 ? "long unsigned int" : "unsigned int") | |
43 | ||
44 | #undef PTRDIFF_TYPE | |
45 | #define PTRDIFF_TYPE (TARGET_ARCH64 ? "long int" : "int") | |
46 | ||
19c3fc24 RS |
47 | /* Undefined some symbols which are defined in "svr4.h" but which are |
48 | appropriate only for typical svr4 systems, but not for the specific | |
49 | case of svr4 running on a Sparc. */ | |
50 | ||
19c3fc24 | 51 | #undef INIT_SECTION_ASM_OP |
68d69835 | 52 | #undef FINI_SECTION_ASM_OP |
19c3fc24 RS |
53 | #undef CONST_SECTION_ASM_OP |
54 | #undef TYPE_OPERAND_FMT | |
55 | #undef PUSHSECTION_FORMAT | |
56 | #undef STRING_ASM_OP | |
57 | #undef COMMON_ASM_OP | |
58 | #undef SKIP_ASM_OP | |
ed493872 | 59 | #undef SET_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */ |
19c3fc24 | 60 | |
17fd0700 | 61 | /* Provide a set of pre-definitions and pre-assertions appropriate for |
19c3fc24 | 62 | the Sparc running svr4. __svr4__ is our extension. */ |
17fd0700 RS |
63 | |
64 | #define CPP_PREDEFINES \ | |
2b57e919 | 65 | "-Dsparc -Dunix -D__svr4__ -Asystem=unix -Asystem=svr4" |
17fd0700 | 66 | |
3ae29d63 JW |
67 | /* The native assembler can't compute differences between symbols in different |
68 | sections when generating pic code, so we must put jump tables in the | |
69 | text section. */ | |
e0d80184 DM |
70 | /* But we now defer the tables to the end of the function, so we make |
71 | this 0 to not confuse the branch shortening code. */ | |
72 | #define JUMP_TABLES_IN_TEXT_SECTION 0 | |
3ae29d63 | 73 | |
1052937b JW |
74 | /* Pass -K to the assembler when PIC. */ |
75 | #undef ASM_SPEC | |
76 | #define ASM_SPEC \ | |
6b67c5a3 | 77 | "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ |
7c0e725d | 78 | %{fpic:-K PIC} %{fPIC:-K PIC} %(asm_cpu)" |
1052937b JW |
79 | |
80 | /* Must use data section for relocatable constants when pic. */ | |
81 | #undef SELECT_RTX_SECTION | |
201556f0 | 82 | #define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ |
1052937b | 83 | { \ |
b1474bb7 | 84 | if (flag_pic && symbolic_operand ((RTX), (MODE))) \ |
1052937b JW |
85 | data_section (); \ |
86 | else \ | |
87 | const_section (); \ | |
88 | } | |
89 | ||
19c3fc24 RS |
90 | /* Define the names of various pseudo-op used by the Sparc/svr4 assembler. |
91 | Note that many of these are different from the typical pseudo-ops used | |
92 | by most svr4 assemblers. That is probably due to a (misguided?) attempt | |
93 | to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS | |
94 | assembler. */ | |
95 | ||
471b6f1b HPN |
96 | #define STRING_ASM_OP "\t.asciz\t" |
97 | #define COMMON_ASM_OP "\t.common\t" | |
98 | #define SKIP_ASM_OP "\t.skip\t" | |
99 | #define UNALIGNED_DOUBLE_INT_ASM_OP "\t.uaxword\t" | |
100 | #define UNALIGNED_INT_ASM_OP "\t.uaword\t" | |
101 | #define UNALIGNED_SHORT_ASM_OP "\t.uahalf\t" | |
102 | #define PUSHSECTION_ASM_OP "\t.pushsection\t" | |
103 | #define POPSECTION_ASM_OP "\t.popsection" | |
19c3fc24 | 104 | |
b91b26c9 DE |
105 | /* This is defined in sparc.h but is not used by svr4.h. */ |
106 | #undef ASM_LONG | |
107 | #define ASM_LONG ".long" | |
108 | ||
19c3fc24 RS |
109 | /* This is the format used to print the second operand of a .type pseudo-op |
110 | for the Sparc/svr4 assembler. */ | |
111 | ||
17fd0700 RS |
112 | #define TYPE_OPERAND_FMT "#%s" |
113 | ||
19c3fc24 RS |
114 | /* This is the format used to print a .pushsection pseudo-op (and its operand) |
115 | for the Sparc/svr4 assembler. */ | |
116 | ||
b9f7d63e | 117 | #define PUSHSECTION_FORMAT "%s\"%s\"\n" |
19c3fc24 | 118 | |
32686e40 JW |
119 | #undef ASM_OUTPUT_CASE_LABEL |
120 | #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ | |
df9da8ad | 121 | do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \ |
32686e40 JW |
122 | ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM); \ |
123 | } while (0) | |
124 | ||
19c3fc24 RS |
125 | /* This is how to equate one symbol to another symbol. The syntax used is |
126 | `SYM1=SYM2'. Note that this is different from the way equates are done | |
127 | with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */ | |
128 | ||
129 | #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ | |
130 | do { fprintf ((FILE), "\t"); \ | |
131 | assemble_name (FILE, LABEL1); \ | |
132 | fprintf (FILE, " = "); \ | |
133 | assemble_name (FILE, LABEL2); \ | |
134 | fprintf (FILE, "\n"); \ | |
135 | } while (0) | |
136 | ||
19c3fc24 | 137 | /* Define how the Sparc registers should be numbered for Dwarf output. |
17fd0700 | 138 | The numbering provided here should be compatible with the native |
19c3fc24 RS |
139 | svr4 SDB debugger in the Sparc/svr4 reference port. The numbering |
140 | is as follows: | |
141 | ||
142 | Assembly name gcc internal regno Dwarf regno | |
143 | ---------------------------------------------------------- | |
144 | g0-g7 0-7 0-7 | |
145 | o0-o7 8-15 8-15 | |
146 | l0-l7 16-23 16-23 | |
147 | i0-i7 24-31 24-31 | |
148 | f0-f31 32-63 40-71 | |
149 | */ | |
17fd0700 | 150 | |
e5e809f4 | 151 | #define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 32 ? (REGNO) : (REGNO) + 8) |
17fd0700 | 152 | |
19c3fc24 RS |
153 | /* A set of symbol definitions for assembly pseudo-ops which will |
154 | get us switched to various sections of interest. These are used | |
155 | in all places where we simply want to switch to a section, and | |
156 | *not* to push the previous section name onto the assembler's | |
157 | section names stack (as we do often in dwarfout.c). */ | |
17fd0700 | 158 | |
471b6f1b HPN |
159 | #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" |
160 | #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" | |
161 | #define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" | |
162 | #define CONST_SECTION_ASM_OP "\t.section\t\".rodata\"" | |
163 | #define INIT_SECTION_ASM_OP "\t.section\t\".init\"" | |
164 | #define FINI_SECTION_ASM_OP "\t.section\t\".fini\"" | |
68d69835 JM |
165 | |
166 | /* Define the pseudo-ops used to switch to the .ctors and .dtors sections. | |
167 | ||
168 | Note that we want to give these sections the SHF_WRITE attribute | |
169 | because these sections will actually contain data (i.e. tables of | |
170 | addresses of functions in the current root executable or shared library | |
171 | file) and, in the case of a shared library, the relocatable addresses | |
172 | will have to be properly resolved/relocated (and then written into) by | |
173 | the dynamic linker when it actually attaches the given shared library | |
174 | to the executing process. (Note that on SVR4, you may wish to use the | |
175 | `-z text' option to the ELF linker, when building a shared library, as | |
176 | an additional check that you are doing everything right. But if you do | |
177 | use the `-z text' option when building a shared library, you will get | |
178 | errors unless the .ctors and .dtors sections are marked as writable | |
179 | via the SHF_WRITE attribute.) */ | |
180 | ||
181 | #undef CTORS_SECTION_ASM_OP | |
471b6f1b | 182 | #define CTORS_SECTION_ASM_OP "\t.section\t\".ctors\",#alloc,#write" |
68d69835 | 183 | #undef DTORS_SECTION_ASM_OP |
471b6f1b | 184 | #define DTORS_SECTION_ASM_OP "\t.section\t\".dtors\",#alloc,#write" |
7c262518 RH |
185 | |
186 | /* Switch into a generic section. */ | |
187 | #undef TARGET_ASM_NAMED_SECTION | |
188 | #define TARGET_ASM_NAMED_SECTION sparc_elf_asm_named_section | |
7947717f | 189 | |
17d6fedc | 190 | /* A C statement (sans semicolon) to output to the stdio stream |
0bb7aea5 | 191 | FILE the assembler definition of uninitialized global DECL named |
17d6fedc JM |
192 | NAME whose size is SIZE bytes and alignment is ALIGN bytes. |
193 | Try to use asm_output_aligned_bss to implement this macro. */ | |
194 | ||
101d9529 | 195 | #undef ASM_OUTPUT_ALIGNED_BSS |
0bb7aea5 DE |
196 | #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ |
197 | asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) | |
2be15d0f RH |
198 | |
199 | /* Override the name of the mcount profiling function. */ | |
200 | ||
201 | #undef MCOUNT_FUNCTION | |
202 | #define MCOUNT_FUNCTION "*_mcount" |