OSDN Git Service

* dbxout.c: Remove unnecessary #undefs.
[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 #define ASM_STABS_OP "\t.stabx\t"
25
26 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM.  */
27
28 #define DBX_TYPE_DECL_STABS_CODE N_DECL
29
30 /* Use the XCOFF predefined type numbers.  */
31
32 #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \
33   xcoff_assign_fundamental_type_number (TYPE)
34
35 /* Any type with a negative type index has already been output.  */
36
37 #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
38
39 /* Must use N_STSYM for static const variables (those in the text section)
40    instead of N_FUN.  */
41
42 #define DBX_STATIC_CONST_VAR_CODE N_STSYM
43
44 /* For static variables, output code to define the start of a static block.  */
45
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); \
52 }
53
54 /* For static variables, output code to define the end of a static block.  */
55
56 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE)                              \
57 {                                                                       \
58   if ((CODE) == N_STSYM || (CODE) == N_LCSYM)                           \
59     fputs ("\t.es\n", (ASMFILE));                                       \
60 }
61
62 /* We must use N_RPYSM instead of N_RSYM for register parameters.  */
63
64 #define DBX_REGPARM_STABS_CODE N_RPSYM
65
66 /* We must use 'R' instead of 'P' for register parameters.  */
67
68 #define DBX_REGPARM_STABS_LETTER 'R'
69
70 /* Define our own finish symbol function, since xcoff stabs have their
71    own different format.  */
72
73 #define DBX_FINISH_SYMBOL(ASMFILE,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)); \
98 }
99
100 /* These are IBM XCOFF extensions we need to reference in dbxout.c
101    and xcoffout.c.  */
102
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
114
115 /* Name of the current include file.  */
116
117 extern const char *xcoff_current_include_file;
118
119 /* Names of bss and data sections.  These should be unique names for each
120    compilation unit.  */
121
122 extern char *xcoff_bss_section_name;
123 extern char *xcoff_private_data_section_name;
124 extern char *xcoff_read_only_section_name;
125
126 /* Last source file name mentioned in a NOTE insn.  */
127
128 extern const char *xcoff_lastfile;
129
130 /* Don't write out path name for main source file.  */
131 #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME)
132
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)
140
141 /* If we are still in an include file, its end must be marked.  */
142 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
143 {                                                       \
144   if (xcoff_current_include_file)                       \
145     {                                                   \
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;                \
150     }                                                   \
151 }
152
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\"gcc2_compiled.\",0,%d,0\n", ASM_STABS_OP, \
157            stab_to_sclass (N_GSYM))
158 #else
159 #define DBX_OUTPUT_GCC_MARKER(FILE)
160 #endif
161
162 /* Do not break .stabs pseudos into continuations.  */
163 #define DBX_CONTIN_LENGTH 0
164
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
169
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.  */
173
174 #define DEBUG_SYMS_TEXT
175
176 /* Prototype functions in xcoffout.c.  */
177
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 *);