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