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