]>
Commit | Line | Data |
---|---|---|
17fd0700 | 1 | /* Target definitions for GNU compiler for Sparc running System V.4 |
19c3fc24 | 2 | Copyright (C) 1991, 1992 Free Software Foundation, Inc. |
17fd0700 RS |
3 | |
4 | Written by Ron Guilmette (rfg@ncd.com). | |
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 | |
20 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
21 | ||
22 | #include "sparc.h" | |
19c3fc24 RS |
23 | |
24 | /* Undefine some symbols which are defined in "sparc.h" but which are | |
25 | appropriate only for SunOS 4.x, and not for svr4. */ | |
26 | ||
27 | #undef DBX_DEBUGGING_INFO | |
28 | #undef WORD_SWITCH_TAKES_ARG | |
29 | #undef SELECT_SECTION | |
30 | #undef ASM_DECLARE_FUNCTION_NAME | |
31 | #undef TEXT_SECTION_ASM_OP | |
32 | #undef DATA_SECTION_ASM_OP | |
33 | ||
17fd0700 RS |
34 | #include "svr4.h" |
35 | ||
19c3fc24 RS |
36 | /* Undefined some symbols which are defined in "svr4.h" but which are |
37 | appropriate only for typical svr4 systems, but not for the specific | |
38 | case of svr4 running on a Sparc. */ | |
39 | ||
40 | #undef CTORS_SECTION_ASM_OP | |
41 | #undef DTORS_SECTION_ASM_OP | |
42 | #undef INIT_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 DEF_ASM_OP /* Has no equivalent. See ASM_OUTPUT_DEF below. */ | |
50 | #undef ASM_GENERATE_INTERNAL_LABEL | |
51 | #undef ASM_OUTPUT_INTERNAL_LABEL | |
52 | ||
17fd0700 | 53 | /* Provide a set of pre-definitions and pre-assertions appropriate for |
19c3fc24 | 54 | the Sparc running svr4. __svr4__ is our extension. */ |
17fd0700 RS |
55 | |
56 | #define CPP_PREDEFINES \ | |
57 | "-Dsparc -Dunix -D__svr4__ -Asystem(unix) -Acpu(sparc) -Amachine(sparc)" | |
58 | ||
19c3fc24 RS |
59 | /* This is the string used to begin an assembly language comment for the |
60 | Sparc/svr4 assembler. */ | |
61 | ||
17fd0700 RS |
62 | #define ASM_COMMENT_START "!" |
63 | ||
19c3fc24 RS |
64 | /* Define the names of various pseudo-op used by the Sparc/svr4 assembler. |
65 | Note that many of these are different from the typical pseudo-ops used | |
66 | by most svr4 assemblers. That is probably due to a (misguided?) attempt | |
67 | to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS | |
68 | assembler. */ | |
69 | ||
aa6b905d RS |
70 | #define STRING_ASM_OP ".asciz" |
71 | #define COMMON_ASM_OP ".common" | |
72 | #define SKIP_ASM_OP ".skip" | |
73 | #define UNALIGNED_INT_ASM_OP ".uaword" | |
74 | #define UNALIGNED_SHORT_ASM_OP ".uahalf" | |
75 | #define PUSHSECTION_ASM_OP ".pushsection" | |
76 | #define POPSECTION_ASM_OP ".popsection" | |
19c3fc24 RS |
77 | |
78 | /* This is the format used to print the second operand of a .type pseudo-op | |
79 | for the Sparc/svr4 assembler. */ | |
80 | ||
17fd0700 RS |
81 | #define TYPE_OPERAND_FMT "#%s" |
82 | ||
19c3fc24 RS |
83 | /* This is the format used to print a .pushsection pseudo-op (and its operand) |
84 | for the Sparc/svr4 assembler. */ | |
85 | ||
86 | #define PUSHSECTION_FORMAT "%s\t\"%s\"\n" | |
87 | ||
88 | /* This is how to equate one symbol to another symbol. The syntax used is | |
89 | `SYM1=SYM2'. Note that this is different from the way equates are done | |
90 | with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'. */ | |
91 | ||
92 | #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ | |
93 | do { fprintf ((FILE), "\t"); \ | |
94 | assemble_name (FILE, LABEL1); \ | |
95 | fprintf (FILE, " = "); \ | |
96 | assemble_name (FILE, LABEL2); \ | |
97 | fprintf (FILE, "\n"); \ | |
98 | } while (0) | |
99 | ||
100 | /* Generate the special assembly code needed to align the start of a jump | |
101 | tables. Under svr4, jump tables go into the .rodata section. Other | |
102 | things (e.g. constants) may be put into the .rodata section too, and | |
103 | those other things may end on odd (i.e. unaligned) boundaries, so we | |
104 | need to get re-aligned just before we output each jump table. */ | |
105 | ||
106 | #define ASM_OUTPUT_ALIGN_JUMP_TABLE(FILE) ASM_OUTPUT_ALIGN ((FILE), 2) | |
107 | ||
108 | /* This is how to output an internal numbered label where | |
109 | PREFIX is the class of label and NUM is the number within the class. | |
110 | ||
111 | If the NUM argument is negative, we don't use it when generating the | |
112 | label. | |
113 | ||
114 | For most svr4 systems, the convention is that any symbol which begins | |
115 | with a period is not put into the linker symbol table by the assembler, | |
116 | however the current Sparc/svr4 assembler is brain-dammaged and it needs | |
117 | to see `.L' at the start of a symbol or else it will be put into the | |
118 | linker symbol table. | |
119 | */ | |
120 | ||
121 | #define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \ | |
122 | do { \ | |
123 | if ((int) (NUM) >= 0) \ | |
124 | fprintf (FILE, ".L%s%d:\n", PREFIX, NUM); \ | |
125 | else \ | |
126 | fprintf (FILE, ".L%s:\n", PREFIX); \ | |
127 | } while (0) | |
128 | ||
129 | /* This is how to store into the string LABEL | |
130 | the symbol_ref name of an internal numbered label where | |
131 | PREFIX is the class of label and NUM is the number within the class. | |
132 | This is suitable for output with `assemble_name'. | |
133 | ||
134 | If the NUM argument is negative, we don't use it when generating the | |
135 | label. | |
136 | ||
137 | For most svr4 systems, the convention is that any symbol which begins | |
138 | with a period is not put into the linker symbol table by the assembler, | |
139 | however the current Sparc/svr4 assembler is brain-dammaged and it needs | |
140 | to see `.L' at the start of a symbol or else it will be put into the | |
141 | linker symbol table. | |
142 | */ | |
143 | ||
144 | #define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ | |
145 | do { \ | |
146 | if ((int) (NUM) >= 0) \ | |
147 | sprintf (LABEL, "*.L%s%d", PREFIX, NUM); \ | |
148 | else \ | |
149 | sprintf (LABEL, "*.L%s", PREFIX); \ | |
150 | } while (0) | |
151 | ||
152 | /* Define how the Sparc registers should be numbered for Dwarf output. | |
17fd0700 | 153 | The numbering provided here should be compatible with the native |
19c3fc24 RS |
154 | svr4 SDB debugger in the Sparc/svr4 reference port. The numbering |
155 | is as follows: | |
156 | ||
157 | Assembly name gcc internal regno Dwarf regno | |
158 | ---------------------------------------------------------- | |
159 | g0-g7 0-7 0-7 | |
160 | o0-o7 8-15 8-15 | |
161 | l0-l7 16-23 16-23 | |
162 | i0-i7 24-31 24-31 | |
163 | f0-f31 32-63 40-71 | |
164 | */ | |
17fd0700 RS |
165 | |
166 | #define DBX_REGISTER_NUMBER(REGNO) \ | |
19c3fc24 RS |
167 | (((REGNO) < 32) ? (REGNO) \ |
168 | : ((REGNO) < 63) ? ((REGNO) + 8) \ | |
169 | : (abort (), 0)) | |
17fd0700 | 170 | |
19c3fc24 RS |
171 | /* A set of symbol definitions for assembly pseudo-ops which will |
172 | get us switched to various sections of interest. These are used | |
173 | in all places where we simply want to switch to a section, and | |
174 | *not* to push the previous section name onto the assembler's | |
175 | section names stack (as we do often in dwarfout.c). */ | |
17fd0700 | 176 | |
aa6b905d RS |
177 | #define TEXT_SECTION_ASM_OP ".section\t\".text\"" |
178 | #define DATA_SECTION_ASM_OP ".section\t\".data\"" | |
179 | #define BSS_SECTION_ASM_OP ".section\t\".bss\"" | |
180 | #define CONST_SECTION_ASM_OP ".section\t\".rodata\"" | |
181 | #define INIT_SECTION_ASM_OP ".section\t\".init\",#alloc" | |
182 | #define CTORS_SECTION_ASM_OP ".section\t\".ctors\",#alloc" | |
183 | #define DTORS_SECTION_ASM_OP ".section\t\".dtors\",#alloc" |