]> gcc.gnu.org Git - gcc.git/blob - gcc/config/i386/osfrose.h
Make ROSE shared library profiling work; Use GOTOFF if possible for ELF.
[gcc.git] / gcc / config / i386 / osfrose.h
1 /* Definitions of target machine for GNU compiler.
2 Intel 386 (OSF/1 with OSF/rose) version.
3 Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 #include "halfpic.h"
22 #include "i386/gstabs.h"
23
24 /* Get perform_* macros to build libgcc.a. */
25 #include "i386/perform.h"
26
27 #define OSF_OS
28
29 #undef WORD_SWITCH_TAKES_ARG
30 #define WORD_SWITCH_TAKES_ARG(STR) \
31 (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))
32
33 #define MASK_HALF_PIC 0x40000000 /* Mask for half-pic code */
34 #define MASK_HALF_PIC_DEBUG 0x20000000 /* Debug flag */
35 #define MASK_ELF 0x10000000 /* ELF not rose */
36 #define MASK_NO_IDENT 0x08000000 /* suppress .ident */
37 #define MASK_NO_UNDERSCORES 0x04000000 /* suppress leading _ */
38 #define MASK_LARGE_ALIGN 0x02000000 /* align to >word boundaries */
39 #define MASK_NO_MCOUNT 0x01000000 /* profiling uses mcount_ptr */
40
41 #define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)
42 #define TARGET_DEBUG (target_flags & MASK_HALF_PIC_DEBUG)
43 #define HALF_PIC_DEBUG TARGET_DEBUG
44 #define TARGET_ELF (target_flags & MASK_ELF)
45 #define TARGET_ROSE ((target_flags & MASK_ELF) == 0)
46 #define TARGET_IDENT ((target_flags & MASK_NO_IDENT) == 0)
47 #define TARGET_UNDERSCORES ((target_flags & MASK_NO_UNDERSCORES) == 0)
48 #define TARGET_LARGE_ALIGN (target_flags & MASK_LARGE_ALIGN)
49 #define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)
50
51 #undef SUBTARGET_SWITCHES
52 #define SUBTARGET_SWITCHES \
53 { "half-pic", MASK_HALF_PIC}, \
54 { "no-half-pic", -MASK_HALF_PIC}, \
55 { "debug-half-pic", MASK_HALF_PIC_DEBUG}, \
56 { "debugb", MASK_HALF_PIC_DEBUG}, \
57 { "elf", MASK_ELF}, \
58 { "rose", -MASK_ELF}, \
59 { "ident", -MASK_NO_IDENT}, \
60 { "no-ident", MASK_NO_IDENT}, \
61 { "underscores", -MASK_NO_UNDERSCORES}, \
62 { "no-underscores", MASK_NO_UNDERSCORES}, \
63 { "large-align", MASK_LARGE_ALIGN}, \
64 { "no-large-align",-MASK_LARGE_ALIGN}, \
65 { "mcount", -MASK_NO_MCOUNT}, \
66 { "no-mcount", MASK_NO_MCOUNT},
67
68 /* OSF/rose uses stabs, not dwarf. */
69 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
70
71 #ifndef DWARF_DEBUGGING_INFO
72 #define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */
73 #endif
74
75 /* Handle #pragma weak and #pragma pack. */
76
77 #define HANDLE_SYSV_PRAGMA
78
79 /* Change default predefines. */
80 #undef CPP_PREDEFINES
81 #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Di386 -Asystem(unix) -Asystem(xpg4) -Acpu(i386) -Amachine(i386)"
82
83 #undef CPP_SPEC
84 #define CPP_SPEC "\
85 %{!melf: -D__ROSE__} %{melf: -D__ELF__} \
86 %{mno-underscores: -D__NO_UNDERSCORES__} \
87 %{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \
88 %{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \
89 %{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
90 %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
91 %{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \
92 %{.C: -D__LANGUAGE_C_PLUS_PLUS} \
93 %{.m: -D__LANGUAGE_OBJECTIVE_C} \
94 %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
95
96 /* Turn on -pic-extern by default. */
97 #undef CC1_SPEC
98 #define CC1_SPEC "\
99 %{!melf: %{!mrose: -mrose }} \
100 %{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }}} \
101 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
102 %{!melf: %{pic-none: -mno-half-pic} \
103 %{pic-extern: } %{pic-lib: } %{pic-calls: } %{pic-names*: } \
104 %{!pic-none: -mhalf-pic }}"
105
106 #undef ASM_SPEC
107 #define ASM_SPEC "%{v*: -v}"
108
109 #undef LINK_SPEC
110 #define LINK_SPEC "%{v*: -v} \
111 %{!melf: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
112 %{nostdlib} %{noshrlib} %{glue}} \
113 %{melf: %{dy} %{dn} %{glue: } \
114 %{!dy: %{!dn: \
115 %{noshrlib: -dn } %{pic-none: -dn } \
116 %{!noshrlib: %{!pic-none: -dy}}}}}"
117
118 #undef LIB_SPEC
119 #define LIB_SPEC "-lc"
120
121 #undef LIBG_SPEC
122 #define LIBG_SPEC ""
123
124 #undef STARTFILE_SPEC
125 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
126
127 #undef TARGET_VERSION_INTERNAL
128 #undef TARGET_VERSION
129
130 #define I386_VERSION " 80386, OSF/rose objects"
131
132 #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
133 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
134
135 #undef MD_EXEC_PREFIX
136 #define MD_EXEC_PREFIX "/usr/ccs/gcc/"
137
138 #undef MD_STARTFILE_PREFIX
139 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
140
141 /* Specify size_t, ptrdiff_t, and wchar_t types. */
142 #undef SIZE_TYPE
143 #undef PTRDIFF_TYPE
144 #undef WCHAR_TYPE
145 #undef WCHAR_TYPE_SIZE
146
147 #define SIZE_TYPE "long unsigned int"
148 #define PTRDIFF_TYPE "int"
149 #define WCHAR_TYPE "unsigned int"
150 #define WCHAR_TYPE_SIZE BITS_PER_WORD
151
152 /* Temporarily turn off long double being 96 bits. */
153 #undef LONG_DOUBLE_TYPE_SIZE
154
155 /* This macro generates the assembly code for function entry.
156 FILE is a stdio stream to output the code to.
157 SIZE is an int: how many units of temporary storage to allocate.
158 Refer to the array `regs_ever_live' to determine which registers
159 to save; `regs_ever_live[I]' is nonzero if register number I
160 is ever used in the function. This macro is responsible for
161 knowing which registers should not be saved even if used.
162
163 We override it here to allow for the new profiling code to go before
164 the prologue and the old mcount code to go after the prologue (and
165 after %ebx has been set up for ELF shared library support). */
166
167 #define OSF_PROFILE_BEFORE_PROLOGUE \
168 (!TARGET_MCOUNT \
169 && !current_function_needs_context \
170 && (!flag_pic \
171 || !frame_pointer_needed \
172 || (!current_function_uses_pic_offset_table \
173 && !current_function_uses_const_pool)))
174
175 #undef FUNCTION_PROLOGUE
176 #define FUNCTION_PROLOGUE(FILE, SIZE) \
177 do \
178 { \
179 char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
180 char *lprefix = LPREFIX; \
181 int labelno = profile_label_no; \
182 \
183 if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \
184 { \
185 if (!flag_pic && !HALF_PIC_P ()) \
186 { \
187 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
188 fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \
189 } \
190 \
191 else if (HALF_PIC_P ()) \
192 { \
193 rtx symref; \
194 \
195 HALF_PIC_EXTERNAL ("_mcount_ptr"); \
196 symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \
197 "_mcount_ptr")); \
198 \
199 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
200 fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \
201 XSTR (symref, 0)); \
202 fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
203 fprintf (FILE, "\tcall *%%eax\n"); \
204 } \
205 \
206 else \
207 { \
208 static int call_no = 0; \
209 \
210 fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \
211 fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \
212 fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \
213 lprefix, call_no++); \
214 fprintf (FILE, "\tleal $%sP%d@GOTOFF(%%eax),%%edx\n", \
215 lprefix, labelno); \
216 fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \
217 prefix); \
218 fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
219 fprintf (FILE, "\tcall *%%eax\n"); \
220 } \
221 } \
222 \
223 function_prologue (FILE, SIZE); \
224 } \
225 while (0)
226
227 /* A C statement or compound statement to output to FILE some assembler code to
228 call the profiling subroutine `mcount'. Before calling, the assembler code
229 must load the address of a counter variable into a register where `mcount'
230 expects to find the address. The name of this variable is `LP' followed by
231 the number LABELNO, so you would generate the name using `LP%d' in a
232 `fprintf'.
233
234 The details of how the address should be passed to `mcount' are determined
235 by your operating system environment, not by GNU CC. To figure them out,
236 compile a small program for profiling using the system's installed C
237 compiler and look at the assembler code that results. */
238
239 #undef FUNCTION_PROFILER
240 #define FUNCTION_PROFILER(FILE, LABELNO) \
241 do \
242 { \
243 if (!OSF_PROFILE_BEFORE_PROLOGUE) \
244 { \
245 char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \
246 char *lprefix = LPREFIX; \
247 int labelno = LABELNO; \
248 \
249 /* Note that OSF/rose blew it in terms of calling mcount, \
250 since OSF/rose prepends a leading underscore, but mcount's \
251 doesn't. At present, we keep this kludge for ELF as well \
252 to allow old kernels to build profiling. */ \
253 \
254 if (flag_pic \
255 && !current_function_uses_pic_offset_table \
256 && !current_function_uses_const_pool) \
257 abort (); \
258 \
259 if (TARGET_MCOUNT && flag_pic) \
260 { \
261 fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \
262 lprefix, labelno); \
263 fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \
264 } \
265 \
266 else if (TARGET_MCOUNT && HALF_PIC_P ()) \
267 { \
268 rtx symdef; \
269 \
270 HALF_PIC_EXTERNAL ("mcount"); \
271 symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \
272 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
273 fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, XSTR (symdef, 0)); \
274 fprintf (FILE, "\tcall *%%eax\n"); \
275 } \
276 \
277 else if (TARGET_MCOUNT) \
278 { \
279 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
280 fprintf (FILE, "\tcall %smcount\n", prefix); \
281 } \
282 \
283 else if (flag_pic && frame_pointer_needed) \
284 { \
285 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
286 fprintf (FILE, "\tpushl %%ecx\n"); \
287 fprintf (FILE, "\tleal $%sP%d@GOTOFF(%%ebx),%%edx\n", \
288 lprefix, labelno); \
289 fprintf (FILE, "\tmovl _mcount_ptr@GOT(%%eax),%%eax\n"); \
290 fprintf (FILE, "\tmovl (%%eax),%%eax\n"); \
291 fprintf (FILE, "\tcall *%%eax\n"); \
292 fprintf (FILE, "\tpopl %%eax\n"); \
293 } \
294 \
295 else if (frame_pointer_needed) \
296 { \
297 fprintf (FILE, "\tmovl 4(%%ebp),%%ecx\n"); \
298 fprintf (FILE, "\tpushl %%ecx\n"); \
299 fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \
300 fprintf (FILE, "\tcall *_mcount_ptr\n"); \
301 fprintf (FILE, "\tpopl %%eax\n"); \
302 } \
303 \
304 else \
305 abort (); \
306 } \
307 } \
308 while (0)
309
310 /* A C statement or compound statement to output to FILE some
311 assembler code to initialize basic-block profiling for the current
312 object module. This code should call the subroutine
313 `__bb_init_func' once per object module, passing it as its sole
314 argument the address of a block allocated in the object module.
315
316 The name of the block is a local symbol made with this statement:
317
318 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
319
320 Of course, since you are writing the definition of
321 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
322 can take a short cut in the definition of this macro and use the
323 name that you know will result.
324
325 The first word of this block is a flag which will be nonzero if the
326 object module has already been initialized. So test this word
327 first, and do not call `__bb_init_func' if the flag is nonzero. */
328
329 #undef FUNCTION_BLOCK_PROFILER
330 #define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO) \
331 do \
332 { \
333 if (!flag_pic) \
334 { \
335 fprintf (STREAM, "\tcmpl $0,%sPBX0\n", LPREFIX); \
336 fprintf (STREAM, "\tjne 0f\n"); \
337 fprintf (STREAM, "\tpushl $%sPBX0\n", LPREFIX); \
338 fprintf (STREAM, "\tcall %s__bb_init_func\n", \
339 (TARGET_UNDERSCORES) ? "_" : ""); \
340 fprintf (STREAM, "0:\n"); \
341 } \
342 else \
343 { \
344 fprintf (STREAM, "\tpushl %eax\n"); \
345 fprintf (STREAM, "\tmovl %sPBX0@GOT(%ebx),%eax\n"); \
346 fprintf (STREAM, "\tcmpl $0,(%eax)\n"); \
347 fprintf (STREAM, "\tjne 0f\n"); \
348 fprintf (STREAM, "\tpushl %eax\n"); \
349 fprintf (STREAM, "\tcall %s__bb_init_func@PLT\n", \
350 (TARGET_UNDERSCORES) ? "_" : ""); \
351 fprintf (STREAM, "0:\n"); \
352 fprintf (STREAM, "\tpopl %eax\n"); \
353 } \
354 } \
355 while (0)
356
357 /* A C statement or compound statement to increment the count
358 associated with the basic block number BLOCKNO. Basic blocks are
359 numbered separately from zero within each compilation. The count
360 associated with block number BLOCKNO is at index BLOCKNO in a
361 vector of words; the name of this array is a local symbol made
362 with this statement:
363
364 ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
365
366 Of course, since you are writing the definition of
367 `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
368 can take a short cut in the definition of this macro and use the
369 name that you know will result. */
370
371 #undef BLOCK_PROFILER
372 #define BLOCK_PROFILER(STREAM, BLOCKNO) \
373 do \
374 { \
375 if (!flag_pic) \
376 fprintf (STREAM, "\tincl %sPBX2+%d\n", LPREFIX, (BLOCKNO)*4); \
377 else \
378 { \
379 fprintf (STREAM, "\tpushl %eax\n"); \
380 fprintf (STREAM, "\tmovl %sPBX2@GOT(%ebx),%eax\n", LPREFIX); \
381 fprintf (STREAM, "\tincl %d(%eax)\n", (BLOCKNO)*4); \
382 fprintf (STREAM, "\tpopl %eax\n"); \
383 } \
384 } \
385 while (0)
386
387 /* A C function or functions which are needed in the library to
388 support block profiling. When support goes into libc, undo
389 the #if 0. */
390
391 #if 0
392 #undef BLOCK_PROFILING_CODE
393 #define BLOCK_PROFILING_CODE
394 #endif
395
396 /* Prefix for internally generated assembler labels. If we aren't using
397 underscores, we are using prefix `.'s to identify labels that should
398 be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
399 #undef LPREFIX
400 #define LPREFIX ((TARGET_UNDERSCORES) ? "L" : ".L")
401
402 /* This is how to store into the string BUF
403 the symbol_ref name of an internal numbered label where
404 PREFIX is the class of label and NUM is the number within the class.
405 This is suitable for output with `assemble_name'. */
406
407 #undef ASM_GENERATE_INTERNAL_LABEL
408 #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
409 sprintf ((BUF), "*%s%s%d", (TARGET_UNDERSCORES) ? "" : ".", \
410 (PREFIX), (NUMBER))
411
412 /* This is how to output an internal numbered label where
413 PREFIX is the class of label and NUM is the number within the class. */
414
415 #undef ASM_OUTPUT_INTERNAL_LABEL
416 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
417 fprintf (FILE, "%s%s%d:\n", (TARGET_UNDERSCORES) ? "" : ".", \
418 PREFIX, NUM)
419
420 /* This is how to output a reference to a user-level label named NAME. */
421
422 #undef ASM_OUTPUT_LABELREF
423 #define ASM_OUTPUT_LABELREF(FILE,NAME) \
424 fprintf (FILE, "%s%s", (TARGET_UNDERSCORES) ? "_" : "", NAME)
425
426 /* A C expression to output text to align the location counter in the
427 way that is desirable at a point in the code that is reached only
428 by jumping.
429
430 This macro need not be defined if you don't want any special
431 alignment to be done at such a time. Most machine descriptions do
432 not currently define the macro. */
433
434 #undef ASM_OUTPUT_ALIGN_CODE
435 #define ASM_OUTPUT_ALIGN_CODE(STREAM) \
436 fprintf (STREAM, "\t.align\t%d\n", \
437 (TARGET_486 && TARGET_LARGE_ALIGN) ? 4 : 2)
438
439 /* A C expression to output text to align the location counter in the
440 way that is desirable at the beginning of a loop.
441
442 This macro need not be defined if you don't want any special
443 alignment to be done at such a time. Most machine descriptions do
444 not currently define the macro. */
445
446 #undef ASM_OUTPUT_LOOP_ALIGN
447 #define ASM_OUTPUT_LOOP_ALIGN(STREAM) \
448 fprintf (STREAM, "\t.align\t2\n")
449
450 /* A C statement to output to the stdio stream STREAM an assembler
451 command to advance the location counter to a multiple of 2 to the
452 POWER bytes. POWER will be a C expression of type `int'. */
453
454 #undef ASM_OUTPUT_ALIGN
455 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
456 fprintf (STREAM, "\t.align\t%d\n", \
457 (!TARGET_LARGE_ALIGN && (POWER) > 2) ? 2 : (POWER))
458
459 /* A C expression that is 1 if the RTX X is a constant which is a
460 valid address. On most machines, this can be defined as
461 `CONSTANT_P (X)', but a few machines are more restrictive in
462 which constant addresses are supported.
463
464 `CONSTANT_P' accepts integer-values expressions whose values are
465 not explicitly known, such as `symbol_ref', `label_ref', and
466 `high' expressions and `const' arithmetic expressions, in
467 addition to `const_int' and `const_double' expressions. */
468
469 #define CONSTANT_ADDRESS_P_ORIG(X) \
470 (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF \
471 || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
472 || GET_CODE (X) == HIGH)
473
474 #undef CONSTANT_ADDRESS_P
475 #define CONSTANT_ADDRESS_P(X) \
476 ((CONSTANT_ADDRESS_P_ORIG (X)) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
477
478 /* Nonzero if the constant value X is a legitimate general operand.
479 It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
480
481 #undef LEGITIMATE_CONSTANT_P
482 #define LEGITIMATE_CONSTANT_P(X) \
483 (!HALF_PIC_P () \
484 || GET_CODE (X) == CONST_DOUBLE \
485 || GET_CODE (X) == CONST_INT \
486 || !HALF_PIC_ADDRESS_P (X))
487
488 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
489 that is a valid memory address for an instruction.
490 The MODE argument is the machine mode for the MEM expression
491 that wants to use this address. */
492
493 #define GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR) \
494 { \
495 if (CONSTANT_ADDRESS_P (X) \
496 && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (X))) \
497 goto ADDR; \
498 GO_IF_INDEXING (X, ADDR); \
499 if (GET_CODE (X) == PLUS && CONSTANT_ADDRESS_P (XEXP (X, 1))) \
500 { \
501 rtx x0 = XEXP (X, 0); \
502 if (! flag_pic || ! SYMBOLIC_CONST (XEXP (X, 1))) \
503 { GO_IF_INDEXING (x0, ADDR); } \
504 else if (x0 == pic_offset_table_rtx) \
505 goto ADDR; \
506 else if (GET_CODE (x0) == PLUS) \
507 { \
508 if (XEXP (x0, 0) == pic_offset_table_rtx) \
509 { GO_IF_INDEXABLE_BASE (XEXP (x0, 1), ADDR); } \
510 if (XEXP (x0, 1) == pic_offset_table_rtx) \
511 { GO_IF_INDEXABLE_BASE (XEXP (x0, 0), ADDR); } \
512 } \
513 } \
514 }
515
516 #undef GO_IF_LEGITIMATE_ADDRESS
517 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \
518 { \
519 if (! HALF_PIC_P ()) \
520 { \
521 GO_IF_LEGITIMATE_ADDRESS_ORIG(MODE, X, ADDR); \
522 } \
523 else \
524 { \
525 if (CONSTANT_P (X) && ! HALF_PIC_ADDRESS_P (X)) \
526 goto ADDR; \
527 \
528 GO_IF_INDEXING (X, ADDR); \
529 if (GET_CODE (X) == PLUS) \
530 { \
531 rtx x1 = XEXP (X, 1); \
532 \
533 if (CONSTANT_P (x1) && ! HALF_PIC_ADDRESS_P (x1)) \
534 { \
535 rtx x0 = XEXP (X, 0); \
536 GO_IF_INDEXING (x0, ADDR); \
537 } \
538 } \
539 } \
540 }
541
542 /* Sometimes certain combinations of command options do not make sense
543 on a particular target machine. You can define a macro
544 `OVERRIDE_OPTIONS' to take account of this. This macro, if
545 defined, is executed once just after all the command options have
546 been parsed. */
547
548 #undef SUBTARGET_OVERRIDE_OPTIONS
549 #define SUBTARGET_OVERRIDE_OPTIONS \
550 { \
551 /* \
552 if (TARGET_ELF && TARGET_HALF_PIC) \
553 { \
554 target_flags &= ~MASK_HALF_PIC; \
555 flag_pic = 1; \
556 } \
557 */ \
558 \
559 if (TARGET_ROSE && flag_pic) \
560 { \
561 target_flags |= MASK_HALF_PIC; \
562 flag_pic = 0; \
563 } \
564 \
565 if (TARGET_HALF_PIC) \
566 half_pic_init (); \
567 }
568
569 /* Define this macro if references to a symbol must be treated
570 differently depending on something about the variable or
571 function named by the symbol (such as what section it is in).
572
573 The macro definition, if any, is executed immediately after the
574 rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
575 The value of the rtl will be a `mem' whose address is a
576 `symbol_ref'.
577
578 The usual thing for this macro to do is to a flag in the
579 `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
580 name string in the `symbol_ref' (if one bit is not enough
581 information).
582
583 The best way to modify the name string is by adding text to the
584 beginning, with suitable punctuation to prevent any ambiguity.
585 Allocate the new name in `saveable_obstack'. You will have to
586 modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
587 and output the name accordingly.
588
589 You can also check the information stored in the `symbol_ref' in
590 the definition of `GO_IF_LEGITIMATE_ADDRESS' or
591 `PRINT_OPERAND_ADDRESS'. */
592
593 #undef ENCODE_SECTION_INFO
594 #define ENCODE_SECTION_INFO(DECL) \
595 do \
596 { \
597 if (HALF_PIC_P ()) \
598 HALF_PIC_ENCODE (DECL); \
599 \
600 else if (flag_pic) \
601 { \
602 rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
603 ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \
604 SYMBOL_REF_FLAG (XEXP (rtl, 0)) \
605 = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \
606 || ! TREE_PUBLIC (DECL)); \
607 } \
608 } \
609 while (0)
610
611
612 /* On most machines, read-only variables, constants, and jump tables
613 are placed in the text section. If this is not the case on your
614 machine, this macro should be defined to be the name of a function
615 (either `data_section' or a function defined in `EXTRA_SECTIONS')
616 that switches to the section to be used for read-only items.
617
618 If these items should be placed in the text section, this macro
619 should not be defined. */
620
621 #if 0
622 #undef READONLY_DATA_SECTION
623 #define READONLY_DATA_SECTION() \
624 do \
625 { \
626 if (TARGET_ELF) \
627 { \
628 if (in_section != in_rodata) \
629 { \
630 fprintf (asm_out_file, "\t.section \"rodata\"\n"); \
631 in_section = in_rodata; \
632 } \
633 } \
634 else \
635 text_section (); \
636 } \
637 while (0)
638 #endif
639
640 /* A list of names for sections other than the standard two, which are
641 `in_text' and `in_data'. You need not define this macro on a
642 system with no other sections (that GCC needs to use). */
643
644 #undef EXTRA_SECTIONS
645 #define EXTRA_SECTIONS in_rodata, in_data1
646
647 /* Given a decl node or constant node, choose the section to output it in
648 and select that section. */
649
650 #undef SELECT_RTX_SECTION
651 #define SELECT_RTX_SECTION(MODE, RTX) \
652 do \
653 { \
654 if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX)) \
655 data_section (); \
656 else \
657 readonly_data_section (); \
658 } \
659 while (0)
660
661 #undef SELECT_SECTION
662 #define SELECT_SECTION(DECL, RELOC) \
663 { \
664 if (RELOC && HALF_PIC_P ()) \
665 data_section (); \
666 \
667 else if (TREE_CODE (DECL) == STRING_CST) \
668 { \
669 if (flag_writable_strings) \
670 data_section (); \
671 else \
672 readonly_data_section (); \
673 } \
674 \
675 else if (TREE_CODE (DECL) != VAR_DECL) \
676 readonly_data_section (); \
677 \
678 else if (!TREE_READONLY (DECL)) \
679 data_section (); \
680 \
681 else \
682 readonly_data_section (); \
683 }
684
685
686 /* Define the strings used for the special svr4 .type and .size directives.
687 These strings generally do not vary from one system running svr4 to
688 another, but if a given system (e.g. m88k running svr) needs to use
689 different pseudo-op names for these, they may be overridden in the
690 file which includes this one. */
691
692 #define TYPE_ASM_OP ".type"
693 #define SIZE_ASM_OP ".size"
694 #define WEAK_ASM_OP ".weak"
695 #define SET_ASM_OP ".set"
696
697 /* The following macro defines the format used to output the second
698 operand of the .type assembler directive. Different svr4 assemblers
699 expect various different forms for this operand. The one given here
700 is just a default. You may need to override it in your machine-
701 specific tm.h file (depending upon the particulars of your assembler). */
702
703 #define TYPE_OPERAND_FMT "@%s"
704
705 /* A C statement (sans semicolon) to output to the stdio stream
706 STREAM any text necessary for declaring the name NAME of an
707 initialized variable which is being defined. This macro must
708 output the label definition (perhaps using `ASM_OUTPUT_LABEL').
709 The argument DECL is the `VAR_DECL' tree node representing the
710 variable.
711
712 If this macro is not defined, then the variable name is defined
713 in the usual manner as a label (by means of `ASM_OUTPUT_LABEL'). */
714
715 #undef ASM_DECLARE_OBJECT_NAME
716 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
717 do \
718 { \
719 ASM_OUTPUT_LABEL(STREAM,NAME); \
720 HALF_PIC_DECLARE (NAME); \
721 if (TARGET_ELF) \
722 { \
723 fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
724 assemble_name (STREAM, NAME); \
725 putc (',', STREAM); \
726 fprintf (STREAM, TYPE_OPERAND_FMT, "object"); \
727 putc ('\n', STREAM); \
728 if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \
729 { \
730 fprintf (STREAM, "\t%s\t ", SIZE_ASM_OP); \
731 assemble_name (STREAM, NAME); \
732 fprintf (STREAM, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \
733 } \
734 } \
735 } \
736 while (0)
737
738 /* This is how to declare a function name. */
739
740 #undef ASM_DECLARE_FUNCTION_NAME
741 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
742 do \
743 { \
744 ASM_OUTPUT_LABEL(STREAM,NAME); \
745 HALF_PIC_DECLARE (NAME); \
746 if (TARGET_ELF) \
747 { \
748 fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \
749 assemble_name (STREAM, NAME); \
750 putc (',', STREAM); \
751 fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \
752 putc ('\n', STREAM); \
753 ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \
754 } \
755 } \
756 while (0)
757
758 /* Write the extra assembler code needed to declare a function's result.
759 Most svr4 assemblers don't require any special declaration of the
760 result value, but there are exceptions. */
761
762 #ifndef ASM_DECLARE_RESULT
763 #define ASM_DECLARE_RESULT(FILE, RESULT)
764 #endif
765
766 /* This is how to declare the size of a function. */
767
768 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
769 do \
770 { \
771 if (TARGET_ELF && !flag_inhibit_size_directive) \
772 { \
773 char label[256]; \
774 static int labelno; \
775 labelno++; \
776 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
777 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
778 fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \
779 assemble_name (FILE, (FNAME)); \
780 fprintf (FILE, ","); \
781 assemble_name (FILE, label); \
782 fprintf (FILE, "-"); \
783 assemble_name (FILE, (FNAME)); \
784 putc ('\n', FILE); \
785 } \
786 } \
787 while (0)
788
789 /* Attach a special .ident directive to the end of the file to identify
790 the version of GCC which compiled this code. The format of the
791 .ident string is patterned after the ones produced by native svr4
792 C compilers. */
793
794 #define IDENT_ASM_OP ".ident"
795
796 /* Allow #sccs in preprocessor. */
797
798 #define SCCS_DIRECTIVE
799
800 /* This says what to print at the end of the assembly file */
801 #define ASM_FILE_END(STREAM) \
802 do \
803 { \
804 if (HALF_PIC_P ()) \
805 HALF_PIC_FINISH (STREAM); \
806 \
807 if (TARGET_IDENT) \
808 { \
809 char *fstart = main_input_filename; \
810 char *fname; \
811 \
812 if (!fstart) \
813 fstart = "<no file>"; \
814 \
815 fname = fstart + strlen (fstart) - 1; \
816 while (fname > fstart && *fname != '/') \
817 fname--; \
818 \
819 if (*fname == '/') \
820 fname++; \
821 \
822 fprintf ((STREAM), "\t%s\t\"GCC: (GNU) %s %s -O%d", \
823 IDENT_ASM_OP, version_string, fname, optimize); \
824 \
825 if (write_symbols == PREFERRED_DEBUGGING_TYPE) \
826 fprintf ((STREAM), " -g%d", (int)debug_info_level); \
827 \
828 else if (write_symbols == DBX_DEBUG) \
829 fprintf ((STREAM), " -gstabs%d", (int)debug_info_level); \
830 \
831 else if (write_symbols == DWARF_DEBUG) \
832 fprintf ((STREAM), " -gdwarf%d", (int)debug_info_level); \
833 \
834 else if (write_symbols != NO_DEBUG) \
835 fprintf ((STREAM), " -g??%d", (int)debug_info_level); \
836 \
837 if (flag_omit_frame_pointer) \
838 fprintf ((STREAM), " -fomit-frame-pointer"); \
839 \
840 if (flag_strength_reduce) \
841 fprintf ((STREAM), " -fstrength-reduce"); \
842 \
843 if (flag_unroll_loops) \
844 fprintf ((STREAM), " -funroll-loops"); \
845 \
846 if (flag_force_mem) \
847 fprintf ((STREAM), " -fforce-mem"); \
848 \
849 if (flag_force_addr) \
850 fprintf ((STREAM), " -fforce-addr"); \
851 \
852 if (flag_inline_functions) \
853 fprintf ((STREAM), " -finline-functions"); \
854 \
855 if (flag_caller_saves) \
856 fprintf ((STREAM), " -fcaller-saves"); \
857 \
858 if (flag_pic) \
859 fprintf ((STREAM), (flag_pic > 1) ? " -fPIC" : " -fpic"); \
860 \
861 if (flag_inhibit_size_directive) \
862 fprintf ((STREAM), " -finhibit-size-directive"); \
863 \
864 if (flag_gnu_linker) \
865 fprintf ((STREAM), " -fgnu-linker"); \
866 \
867 if (profile_flag) \
868 fprintf ((STREAM), " -p"); \
869 \
870 if (profile_block_flag) \
871 fprintf ((STREAM), " -a"); \
872 \
873 if (TARGET_IEEE_FP) \
874 fprintf ((STREAM), " -mieee-fp"); \
875 \
876 if (TARGET_HALF_PIC) \
877 fprintf ((STREAM), " -mhalf-pic"); \
878 \
879 fprintf ((STREAM), (TARGET_486) ? " -m486" : " -m386"); \
880 fprintf ((STREAM), (TARGET_ELF) ? " -melf\"\n" : " -mrose\"\n"); \
881 } \
882 } \
883 while (0)
884
885 /* Tell collect that the object format is OSF/rose. */
886 #define OBJECT_FORMAT_ROSE
887
888 /* Tell collect where the appropriate binaries are. */
889 #define REAL_LD_FILE_NAME "/usr/ccs/gcc/gld"
890 #define REAL_NM_FILE_NAME "/usr/ccs/bin/nm"
891 #define REAL_STRIP_FILE_NAME "/usr/ccs/bin/strip"
892
893 /* Use atexit for static constructors/destructors, instead of defining
894 our own exit function. */
895 #define HAVE_ATEXIT
896
897 /* Define this macro meaning that gcc should find the library 'libgcc.a'
898 by hand, rather than passing the argument '-lgcc' to tell the linker
899 to do the search */
900 #define LINK_LIBGCC_SPECIAL
901
902 /* A C statement to output assembler commands which will identify the object
903 file as having been compile with GNU CC. We don't need or want this for
904 OSF1. GDB doesn't need it and kdb doesn't like it */
905 #define ASM_IDENTIFY_GCC(FILE)
906
907 /* Identify the front-end which produced this file. To keep symbol
908 space down, and not confuse kdb, only do this if the language is
909 not C. */
910
911 #define ASM_IDENTIFY_LANGUAGE(STREAM) \
912 { \
913 if (strcmp (lang_identify (), "c") != 0) \
914 output_lang_identify (STREAM); \
915 }
916
917 /* This is how to output an assembler line defining a `double' constant.
918 Use "word" pseudos to avoid printing NaNs, infinity, etc. */
919
920 /* This is how to output an assembler line defining a `double' constant. */
921 #undef ASM_OUTPUT_DOUBLE
922 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
923 do \
924 { \
925 long value_long[2]; \
926 char dstr[30]; \
927 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, value_long); \
928 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
929 if (sizeof (int) == sizeof (long)) \
930 fprintf (STREAM, "\t.long\t0x%08x\t\t# %s\n\t.long\t0x%08x\n", \
931 value_long[0], dstr, value_long[1]); \
932 else \
933 fprintf (STREAM, "\t.long\t0x%08lx\t\t# %s\n\t.long\t0x%08lx\n", \
934 value_long[0], dstr, value_long[1]); \
935 } \
936 while (0)
937
938 /* This is how to output an assembler line defining a `float' constant. */
939 #undef ASM_OUTPUT_FLOAT
940 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
941 do \
942 { \
943 long value_long; \
944 char dstr[30]; \
945 REAL_VALUE_TO_TARGET_SINGLE (VALUE, value_long); \
946 REAL_VALUE_TO_DECIMAL (VALUE, "%.12g", dstr); \
947 if (sizeof (int) == sizeof (long)) \
948 fprintf (STREAM, "\t.long\t0x%08x\t\t# %s (float)\n", \
949 value_long, dstr); \
950 else \
951 fprintf (STREAM, "\t.long\t0x%08lx\t\t# %s (float)\n", \
952 value_long, dstr); \
953 } \
954 while (0)
955
956 /* This is how to output an assembler line for a `long double' constant. */
957 #undef ASM_OUTPUT_LONG_DOUBLE
958 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
959 do { long l[3]; \
960 char dstr[30]; \
961 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
962 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
963 if (sizeof (int) == sizeof (long)) \
964 fprintf (FILE, \
965 "\t.long\t0x%08x\t\t# %s\n\t.long\t0x%08x\n\t.long\t0x%08x\n", \
966 l[0], dstr, l[1], l[2]); \
967 else \
968 fprintf (FILE, \
969 "\t.long\t0x%08lx\t\t# %s\n\t.long\t0x%08lx\n\t.long\t0x%08lx\n", \
970 l[0], dstr, l[1], l[2]); \
971 } while (0)
972
973 /* Generate calls to memcpy, etc., not bcopy, etc. */
974 #define TARGET_MEM_FUNCTIONS
975
976 /* Don't default to pcc-struct-return, because gcc is the only compiler, and
977 we want to retain compatibility with older gcc versions. */
978 #define DEFAULT_PCC_STRUCT_RETURN 0
979
980 /* Map i386 registers to the numbers dwarf expects. Of course this is different
981 from what stabs expects. */
982
983 #define DWARF_DBX_REGISTER_NUMBER(n) \
984 ((n) == 0 ? 0 \
985 : (n) == 1 ? 2 \
986 : (n) == 2 ? 1 \
987 : (n) == 3 ? 3 \
988 : (n) == 4 ? 6 \
989 : (n) == 5 ? 7 \
990 : (n) == 6 ? 5 \
991 : (n) == 7 ? 4 \
992 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
993 : (-1))
994
995 /* Now what stabs expects in the register. */
996 #define STABS_DBX_REGISTER_NUMBER(n) \
997 ((n) == 0 ? 0 : \
998 (n) == 1 ? 2 : \
999 (n) == 2 ? 1 : \
1000 (n) == 3 ? 3 : \
1001 (n) == 4 ? 6 : \
1002 (n) == 5 ? 7 : \
1003 (n) == 6 ? 4 : \
1004 (n) == 7 ? 5 : \
1005 (n) + 4)
1006
1007 #undef DBX_REGISTER_NUMBER
1008 #define DBX_REGISTER_NUMBER(n) ((write_symbols == DWARF_DEBUG) \
1009 ? DWARF_DBX_REGISTER_NUMBER(n) \
1010 : STABS_DBX_REGISTER_NUMBER(n))
This page took 0.088172 seconds and 6 git commands to generate.