* dwarf2out.c (dwarf2out_finish): Set parent to comp_unit_die
[official-gcc.git] / gcc / xcoffout.h
blobeca245d103c4eb88ed9cb43067194d041698f195
1 /* XCOFF definitions. These are needed in dbxout.c, final.c,
2 and xcoffout.h.
3 Copyright (C) 1998, 2000, 2002, 2003, 2004
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA. */
24 #define ASM_STABS_OP "\t.stabx\t"
26 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */
28 #define DBX_TYPE_DECL_STABS_CODE N_DECL
30 /* Use the XCOFF predefined type numbers. */
32 #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \
33 xcoff_assign_fundamental_type_number (TYPE)
35 /* Any type with a negative type index has already been output. */
37 #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
39 /* Must use N_STSYM for static const variables (those in the text section)
40 instead of N_FUN. */
42 #define DBX_STATIC_CONST_VAR_CODE N_STSYM
44 /* For static variables, output code to define the start of a static block. */
46 #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \
47 { \
48 if ((CODE) == N_STSYM) \
49 fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
50 else if ((CODE) == N_LCSYM) \
51 fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
54 /* For static variables, output code to define the end of a static block. */
56 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \
57 { \
58 if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \
59 fputs ("\t.es\n", (ASMFILE)); \
62 /* We must use N_RPYSM instead of N_RSYM for register parameters. */
64 #define DBX_REGPARM_STABS_CODE N_RPSYM
66 /* We must use 'R' instead of 'P' for register parameters. */
68 #define DBX_REGPARM_STABS_LETTER 'R'
70 /* Define our own finish symbol function, since xcoff stabs have their
71 own different format. */
73 #define DBX_FINISH_SYMBOL(SYM) \
74 { \
75 if (current_sym_addr && current_sym_code == N_FUN) \
76 fprintf (asmfile, "\",."); \
77 else \
78 fprintf (asmfile, "\","); \
79 /* If we are writing a function name, we must ensure that \
80 there is no storage-class suffix on the name. */ \
81 if (current_sym_addr && current_sym_code == N_FUN \
82 && GET_CODE (current_sym_addr) == SYMBOL_REF) \
83 { \
84 const char *_p = XSTR (current_sym_addr, 0); \
85 if (*_p == '*') \
86 fprintf (asmfile, "%s", _p+1); \
87 else \
88 for (; *_p != '[' && *_p; _p++) \
89 fprintf (asmfile, "%c", *_p); \
90 } \
91 else if (current_sym_addr) \
92 output_addr_const (asmfile, current_sym_addr); \
93 else if (current_sym_code == N_GSYM) \
94 assemble_name (asmfile, XSTR (XEXP (DECL_RTL (SYM), 0), 0)); \
95 else \
96 fprintf (asmfile, "%d", current_sym_value); \
97 fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \
100 /* These are IBM XCOFF extensions we need to reference in dbxout.c
101 and xcoffout.c. */
103 /* AIX XCOFF uses this for typedefs. This can have any value, since it is
104 only used for translation into a C_DECL storage class. */
105 #ifndef N_DECL
106 #define N_DECL 0x8c
107 #endif
108 /* AIX XCOFF uses this for parameters passed in registers. This can have
109 any value, since it is only used for translation into a C_RPSYM storage
110 class. */
111 #ifndef N_RPSYM
112 #define N_RPSYM 0x8e
113 #endif
115 /* Name of the current include file. */
117 extern const char *xcoff_current_include_file;
119 /* Names of bss and data sections. These should be unique names for each
120 compilation unit. */
122 extern char *xcoff_bss_section_name;
123 extern char *xcoff_private_data_section_name;
124 extern char *xcoff_read_only_section_name;
126 /* Last source file name mentioned in a NOTE insn. */
128 extern const char *xcoff_lastfile;
130 /* Don't write out path name for main source file. */
131 #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME)
133 /* Write out main source file name using ".file" rather than ".stabs".
134 We don't actually do this here, because the assembler gets confused if there
135 is more than one .file directive. rs6000_xcoff_file_start is already
136 emitting a .file directory, so we don't output one here also.
137 Initialize xcoff_lastfile. */
138 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
139 xcoff_lastfile = (FILENAME)
141 /* If we are still in an include file, its end must be marked. */
142 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
144 if (xcoff_current_include_file) \
146 fputs ("\t.ei\t", (FILE)); \
147 output_quoted_string ((FILE), xcoff_current_include_file); \
148 putc ('\n', (FILE)); \
149 xcoff_current_include_file = NULL; \
153 /* .stabx has the type in a different place. */
154 #if 0 /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */
155 #define DBX_OUTPUT_GCC_MARKER(FILE) \
156 fprintf ((FILE), "%s\"%s\",0,%d,0\n", ASM_STABS_OP, STABS_GCC_MARKER, \
157 stab_to_sclass (N_GSYM))
158 #else
159 #define DBX_OUTPUT_GCC_MARKER(FILE)
160 #endif
162 /* Do not break .stabs pseudos into continuations. */
163 #define DBX_CONTIN_LENGTH 0
165 /* Don't try to use the `x' type-cross-reference character in DBX data.
166 Also has the consequence of putting each struct, union or enum
167 into a separate .stabs, containing only cross-refs to the others. */
168 #define DBX_NO_XREFS
170 /* We must put stabs in the text section. If we don't the assembler
171 won't handle them correctly; it will sometimes put stabs where gdb
172 can't find them. */
174 #define DEBUG_SYMS_TEXT
176 /* Prototype functions in xcoffout.c. */
178 extern int stab_to_sclass (int);
179 extern void xcoffout_begin_prologue (unsigned int, const char *);
180 extern void xcoffout_begin_block (unsigned, unsigned);
181 extern void xcoffout_end_epilogue (unsigned int, const char *);
182 extern void xcoffout_end_function (unsigned int);
183 extern void xcoffout_end_block (unsigned, unsigned);
184 extern int xcoff_assign_fundamental_type_number (tree);
185 extern void xcoffout_declare_function (FILE *, tree, const char *);
186 extern void xcoffout_source_line (unsigned int, const char *);