1 | /* Core target definitions for GNU compiler |
---|
2 | for IBM RS/6000 PowerPC running NetWare |
---|
3 | Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. |
---|
4 | Contributed by Cygnus Support. |
---|
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 | #define TARGET_AIX 0 |
---|
23 | |
---|
24 | #include "rs6000/powerpc.h" |
---|
25 | |
---|
26 | /* Don't generate XCOFF debugging information. */ |
---|
27 | |
---|
28 | #undef XCOFF_DEBUGGING_INFO |
---|
29 | |
---|
30 | /* Don't use the COFF object file format. */ |
---|
31 | |
---|
32 | #undef OBJECT_FORMAT_COFF |
---|
33 | |
---|
34 | /* The XCOFF support uses weird symbol suffixes, which we don't want |
---|
35 | for ELF. */ |
---|
36 | |
---|
37 | #undef STRIP_NAME_ENCODING |
---|
38 | |
---|
39 | /* Don't bother to output .extern pseudo-ops. They are not needed by |
---|
40 | ELF assemblers. */ |
---|
41 | |
---|
42 | #undef ASM_OUTPUT_EXTERNAL |
---|
43 | |
---|
44 | /* Undefine some things which are defined by the generic svr4.h. */ |
---|
45 | |
---|
46 | #undef ASM_FILE_END |
---|
47 | #undef ASM_OUTPUT_EXTERNAL_LIBCALL |
---|
48 | #undef READONLY_DATA_SECTION |
---|
49 | #undef SELECT_SECTION |
---|
50 | #undef ASM_DECLARE_FUNCTION_NAME |
---|
51 | |
---|
52 | /* Use the regular svr4 definitions. */ |
---|
53 | |
---|
54 | #include "svr4.h" |
---|
55 | #include "netware.h" |
---|
56 | |
---|
57 | /* Create a function descriptor when we declare a function name. This |
---|
58 | is a mixture of the ASM_DECLARE_FUNCTION_NAME macros in rs6000.h |
---|
59 | and svr4.h. The unmodified function name is used to name the |
---|
60 | descriptor. The function name with an initial `.' is used to name |
---|
61 | the code. */ |
---|
62 | |
---|
63 | #undef ASM_DECLARE_FUNCTION_NAME |
---|
64 | #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ |
---|
65 | do { \ |
---|
66 | fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ |
---|
67 | assemble_name (FILE, NAME); \ |
---|
68 | putc (',', FILE); \ |
---|
69 | fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ |
---|
70 | putc ('\n', FILE); \ |
---|
71 | ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ |
---|
72 | if (TREE_PUBLIC (DECL)) \ |
---|
73 | { \ |
---|
74 | fprintf (FILE, "\t.globl ."); \ |
---|
75 | assemble_name (FILE, NAME); \ |
---|
76 | fprintf (FILE, "\n"); \ |
---|
77 | } \ |
---|
78 | data_section (); \ |
---|
79 | ASM_OUTPUT_ALIGN (FILE, 2); \ |
---|
80 | ASM_OUTPUT_LABEL (FILE, NAME); \ |
---|
81 | fprintf (FILE, "\t.long ."); \ |
---|
82 | assemble_name (FILE, NAME); \ |
---|
83 | fprintf (FILE, ", __GOT0, 0\n"); \ |
---|
84 | text_section (); \ |
---|
85 | fprintf (FILE, "."); \ |
---|
86 | ASM_OUTPUT_LABEL (FILE, NAME); \ |
---|
87 | } while (0) |
---|
88 | |
---|
89 | /* We need to override the .size output in order to put a `.' before |
---|
90 | the function name. */ |
---|
91 | |
---|
92 | #undef ASM_DECLARE_FUNCTION_SIZE |
---|
93 | #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ |
---|
94 | do { \ |
---|
95 | if (!flag_inhibit_size_directive) \ |
---|
96 | { \ |
---|
97 | char label[256]; \ |
---|
98 | static int labelno; \ |
---|
99 | labelno++; \ |
---|
100 | ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ |
---|
101 | ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ |
---|
102 | fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ |
---|
103 | assemble_name (FILE, (FNAME)); \ |
---|
104 | fprintf (FILE, ","); \ |
---|
105 | assemble_name (FILE, label); \ |
---|
106 | fprintf (FILE, "-."); \ |
---|
107 | assemble_name (FILE, (FNAME)); \ |
---|
108 | putc ('\n', FILE); \ |
---|
109 | } \ |
---|
110 | } while (0) |
---|
111 | |
---|
112 | /* Use ELF style section commands. */ |
---|
113 | |
---|
114 | #undef TEXT_SECTION_ASM_OP |
---|
115 | #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" |
---|
116 | |
---|
117 | #undef DATA_SECTION_ASM_OP |
---|
118 | #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" |
---|
119 | |
---|
120 | /* Besides the usual ELF sections, we need a toc section. */ |
---|
121 | |
---|
122 | #undef EXTRA_SECTIONS |
---|
123 | #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_toc |
---|
124 | |
---|
125 | #undef EXTRA_SECTION_FUNCTIONS |
---|
126 | #define EXTRA_SECTION_FUNCTIONS \ |
---|
127 | CONST_SECTION_FUNCTION \ |
---|
128 | CTORS_SECTION_FUNCTION \ |
---|
129 | DTORS_SECTION_FUNCTION \ |
---|
130 | TOC_SECTION_FUNCTION |
---|
131 | |
---|
132 | #define TOC_SECTION_FUNCTION \ |
---|
133 | void \ |
---|
134 | toc_section () \ |
---|
135 | { \ |
---|
136 | if (TARGET_MINIMAL_TOC) \ |
---|
137 | { \ |
---|
138 | static int toc_initialized = 0; \ |
---|
139 | \ |
---|
140 | if (! toc_initialized) \ |
---|
141 | { \ |
---|
142 | fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); \ |
---|
143 | fprintf (asm_out_file, ".LCTOC0:\n"); \ |
---|
144 | fprintf (asm_out_file, "\t.tc .LCTOC1\n"); \ |
---|
145 | fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ |
---|
146 | fprintf (asm_out_file, ".LCTOC1:\n"); \ |
---|
147 | toc_initialized = 1; \ |
---|
148 | } \ |
---|
149 | } \ |
---|
150 | \ |
---|
151 | if (in_section != in_toc) \ |
---|
152 | { \ |
---|
153 | fprintf (asm_out_file, "%s\n", \ |
---|
154 | (TARGET_MINIMAL_TOC \ |
---|
155 | ? MINIMAL_TOC_SECTION_ASM_OP \ |
---|
156 | : TOC_SECTION_ASM_OP)); \ |
---|
157 | in_section = in_toc; \ |
---|
158 | } \ |
---|
159 | } |
---|
160 | |
---|
161 | #define TOC_SECTION_ASM_OP "\t.section\t.got,\"aw\"" |
---|
162 | #define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t.got1,\"aw\"" |
---|
163 | |
---|
164 | /* Use the TOC section for TOC entries. */ |
---|
165 | |
---|
166 | #undef SELECT_RTX_SECTION |
---|
167 | #define SELECT_RTX_SECTION(MODE, X) \ |
---|
168 | { if (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (X)) \ |
---|
169 | toc_section (); \ |
---|
170 | else \ |
---|
171 | const_section (); \ |
---|
172 | } |
---|
173 | |
---|
174 | /* How to renumber registers for dbx and gdb. */ |
---|
175 | |
---|
176 | #define DBX_REGISTER_NUMBER(REGNO) (REGNO) |
---|
177 | |
---|
178 | /* svr4.h overrides ASM_OUTPUT_INTERNAL_LABEL. */ |
---|
179 | |
---|
180 | #undef ASM_OUTPUT_INTERNAL_LABEL_PREFIX |
---|
181 | #define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ |
---|
182 | fprintf (FILE, ".%s", PREFIX) |
---|
183 | |
---|
184 | #undef ASM_SPEC |
---|
185 | #define ASM_SPEC "-u %(asm_cpu) \ |
---|
186 | {v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}" |
---|
187 | /* This is the end of what might become sysv4.h. */ |
---|
188 | |
---|
189 | /* Enable output of DBX (stabs) debugging information when asked for it. */ |
---|
190 | |
---|
191 | #define DBX_DEBUGGING_INFO |
---|
192 | |
---|
193 | /* Prefer DBX (stabs) debugging information over the native (DWARF) format. */ |
---|
194 | |
---|
195 | #undef PREFERRED_DEBUGGING_TYPE |
---|
196 | #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG |
---|
197 | |
---|
198 | /* Line numbers are relative to the current function. */ |
---|
199 | |
---|
200 | #undef ASM_OUTPUT_SOURCE_LINE |
---|
201 | #define ASM_OUTPUT_SOURCE_LINE(file, line) \ |
---|
202 | { static int sym_lineno = 1; \ |
---|
203 | fprintf (file, ".stabn 68,0,%d,.LM%d-.%s\n.LM%d:\n",\ |
---|
204 | line, sym_lineno, \ |
---|
205 | XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0), \ |
---|
206 | sym_lineno); \ |
---|
207 | sym_lineno += 1; } |
---|
208 | |
---|
209 | /* But, to make this work, we have to output the stabs for the function |
---|
210 | name *first*... */ |
---|
211 | |
---|
212 | #define DBX_FUNCTION_FIRST |
---|
213 | |
---|
214 | /* We need to output LBRAC and RBRAC lines specially to include the |
---|
215 | dot in from of the text symbol for a function. */ |
---|
216 | |
---|
217 | #define DBX_OUTPUT_LBRAC(FILE, BUF) \ |
---|
218 | do \ |
---|
219 | { \ |
---|
220 | fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC); \ |
---|
221 | assemble_name (FILE, BUF); \ |
---|
222 | fprintf (FILE, "-."); \ |
---|
223 | assemble_name (asmfile, \ |
---|
224 | XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ |
---|
225 | fprintf (asmfile, "\n"); \ |
---|
226 | } \ |
---|
227 | while (0) |
---|
228 | |
---|
229 | #define DBX_OUTPUT_RBRAC(FILE, BUF) \ |
---|
230 | do \ |
---|
231 | { \ |
---|
232 | fprintf (FILE, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC); \ |
---|
233 | assemble_name (FILE, BUF); \ |
---|
234 | fprintf (FILE, "-."); \ |
---|
235 | assemble_name (asmfile, \ |
---|
236 | XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ |
---|
237 | fprintf (asmfile, "\n"); \ |
---|
238 | } \ |
---|
239 | while (0) |
---|
240 | |
---|
241 | /* We are using function descriptors, so the value of a function |
---|
242 | symbol is in the .data section. However, we want the stabs entry |
---|
243 | for that function to point at the actual function code in the .text |
---|
244 | section, which we get by prefixing the symbol with a dot. */ |
---|
245 | |
---|
246 | #define DBX_FINISH_SYMBOL(sym) \ |
---|
247 | do { \ |
---|
248 | int line = 0; \ |
---|
249 | if (use_gnu_debug_info_extensions && sym != 0) \ |
---|
250 | line = DECL_SOURCE_LINE (sym); \ |
---|
251 | \ |
---|
252 | fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line); \ |
---|
253 | if (current_sym_addr) \ |
---|
254 | { \ |
---|
255 | if (TREE_CODE (sym) == FUNCTION_DECL) \ |
---|
256 | fprintf (asmfile, "."); \ |
---|
257 | output_addr_const (asmfile, current_sym_addr); \ |
---|
258 | } \ |
---|
259 | else \ |
---|
260 | fprintf (asmfile, "%d", current_sym_value); \ |
---|
261 | putc ('\n', asmfile); \ |
---|
262 | } while (0) |
---|
263 | |
---|
264 | /* This is the end of what might become sysv4dbx.h. */ |
---|
265 | |
---|
266 | #undef TARGET_VERSION |
---|
267 | #define TARGET_VERSION fprintf (stderr, " (PowerPC Netware)"); |
---|
268 | |
---|
269 | /* FIXME: These should actually indicate PowerPC, when there is some |
---|
270 | standard way of expressing that. */ |
---|
271 | #undef CPP_PREDEFINES |
---|
272 | #define CPP_PREDEFINES \ |
---|
273 | "-DPPC D__netware__ -Asystem(netware) -Acpu(powerpc) -Amachine(powerpc)" |
---|