OSDN Git Service

* dbxout.c: Include obstack.h.
[pf3gnuchains/gcc-fork.git] / gcc / xcoffout.h
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.
5
6 This file is part of GCC.
7
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.
12
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.
17
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.  */
22
23
24 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM.  */
25
26 #define DBX_TYPE_DECL_STABS_CODE N_DECL
27
28 /* Use the XCOFF predefined type numbers.  */
29
30 #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \
31   xcoff_assign_fundamental_type_number (TYPE)
32
33 /* Any type with a negative type index has already been output.  */
34
35 #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
36
37 /* Must use N_STSYM for static const variables (those in the text section)
38    instead of N_FUN.  */
39
40 #define DBX_STATIC_CONST_VAR_CODE N_STSYM
41
42 /* For static variables, output code to define the start of a static block.  */
43
44 #define DBX_STATIC_BLOCK_START(ASMFILE,CODE)                            \
45 {                                                                       \
46   if ((CODE) == N_STSYM)                                                \
47     fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
48   else if ((CODE) == N_LCSYM)                                           \
49     fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
50 }
51
52 /* For static variables, output code to define the end of a static block.  */
53
54 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE)                              \
55 {                                                                       \
56   if ((CODE) == N_STSYM || (CODE) == N_LCSYM)                           \
57     fputs ("\t.es\n", (ASMFILE));                                       \
58 }
59
60 /* We must use N_RPYSM instead of N_RSYM for register parameters.  */
61
62 #define DBX_REGPARM_STABS_CODE N_RPSYM
63
64 /* We must use 'R' instead of 'P' for register parameters.  */
65
66 #define DBX_REGPARM_STABS_LETTER 'R'
67
68 /* Define our own finish symbol function, since xcoff stabs have their
69    own different format.  */
70
71 #define DBX_FINISH_STABS(CODE, LINE, ADDR, LABEL, NUMBER) do {  \
72   if (ADDR)                                                     \
73     {                                                           \
74       /* If we are writing a function name, we must ensure that \
75          there is no storage-class suffix on the name.  */      \
76       if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF)       \
77         {                                                       \
78           const char *_p = XSTR (ADDR, 0);                      \
79           if (*_p == '*')                                       \
80             fputs (_p+1, asm_out_file);                         \
81           else                                                  \
82             for (; *_p != '[' && *_p; _p++)                     \
83               putc (*_p, asm_out_file);                         \
84         }                                                       \
85       else                                                      \
86         {                                                       \
87           if (CODE == N_FUN)                                    \
88             putc ('.', asm_out_file);                           \
89           output_addr_const (asm_out_file, ADDR);               \
90         }                                                       \
91     }                                                           \
92   else if (LABEL)                                               \
93     assemble_name (asm_out_file, LABEL);                        \
94   else                                                          \
95     dbxout_int (NUMBER);                                        \
96   putc (',', asm_out_file);                                     \
97   dbxout_int (stab_to_sclass (CODE));                           \
98   fputs (",0\n", asm_out_file);                                 \
99 } while (0)
100
101 /* These are IBM XCOFF extensions we need to reference in dbxout.c
102    and xcoffout.c.  */
103
104 /* AIX XCOFF uses this for typedefs.  This can have any value, since it is
105    only used for translation into a C_DECL storage class.  */
106 #ifndef N_DECL
107 #define N_DECL 0x8c
108 #endif
109 /* AIX XCOFF uses this for parameters passed in registers.  This can have
110    any value, since it is only used for translation into a C_RPSYM storage
111    class.  */
112 #ifndef N_RPSYM
113 #define N_RPSYM 0x8e
114 #endif
115
116 /* Name of the current include file.  */
117
118 extern const char *xcoff_current_include_file;
119
120 /* Names of bss and data sections.  These should be unique names for each
121    compilation unit.  */
122
123 extern char *xcoff_bss_section_name;
124 extern char *xcoff_private_data_section_name;
125 extern char *xcoff_read_only_section_name;
126
127 /* Last source file name mentioned in a NOTE insn.  */
128
129 extern const char *xcoff_lastfile;
130
131 /* Don't write out path name for main source file.  */
132 #define NO_DBX_MAIN_SOURCE_DIRECTORY 1
133
134 /* Write out main source file name using ".file" rather than ".stabs".
135    We don't actually do this here, because the assembler gets confused if there
136    is more than one .file directive.  rs6000_xcoff_file_start is already
137    emitting a .file directory, so we don't output one here also.
138    Initialize xcoff_lastfile.  */
139 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
140   xcoff_lastfile = (FILENAME)
141
142 /* If we are still in an include file, its end must be marked.  */
143 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
144 do {                                                    \
145   if (xcoff_current_include_file)                       \
146     {                                                   \
147       fputs ("\t.ei\t", (FILE));                        \
148       output_quoted_string ((FILE), xcoff_current_include_file);        \
149       putc ('\n', (FILE));                              \
150       xcoff_current_include_file = NULL;                \
151     }                                                   \
152 } while (0)
153
154 /* Do not emit any marker for XCOFF until assembler allows XFT_CV.  */
155 #define NO_DBX_GCC_MARKER
156
157 /* Do not break .stabs pseudos into continuations.  */
158 #define DBX_CONTIN_LENGTH 0
159
160 /* Don't try to use the `x' type-cross-reference character in DBX data.
161    Also has the consequence of putting each struct, union or enum
162    into a separate .stabs, containing only cross-refs to the others.  */
163 #define DBX_NO_XREFS
164
165 /* We must put stabs in the text section.  If we don't the assembler
166    won't handle them correctly; it will sometimes put stabs where gdb
167    can't find them.  */
168
169 #define DEBUG_SYMS_TEXT
170
171 /* Prototype functions in xcoffout.c.  */
172
173 extern int stab_to_sclass (int);
174 extern void xcoffout_begin_prologue (unsigned int, const char *);
175 extern void xcoffout_begin_block (unsigned, unsigned);
176 extern void xcoffout_end_epilogue (unsigned int, const char *);
177 extern void xcoffout_end_function (unsigned int);
178 extern void xcoffout_end_block (unsigned, unsigned);
179 extern int xcoff_assign_fundamental_type_number (tree);
180 extern void xcoffout_declare_function (FILE *, tree, const char *);
181 extern void xcoffout_source_line (unsigned int, const char *);