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