]>
Commit | Line | Data |
---|---|---|
4ce86f52 | 1 | /* XCOFF definitions. These are needed in dbxout.c, final.c, |
1b0c6de6 | 2 | and xcoffout.h. |
9311a396 | 3 | Copyright (C) 1998, 2000 Free Software Foundation, Inc. |
1b0c6de6 | 4 | |
1322177d | 5 | This file is part of GCC. |
1b0c6de6 | 6 | |
1322177d LB |
7 | GCC is free software; you can redistribute it and/or modify it under |
8 | the terms of the GNU General Public License as published by the Free | |
9 | Software Foundation; either version 2, or (at your option) any later | |
10 | version. | |
1b0c6de6 | 11 | |
1322177d LB |
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
1b0c6de6 JL |
16 | |
17 | You should have received a copy of the GNU General Public License | |
1322177d LB |
18 | along with GCC; see the file COPYING. If not, write to the Free |
19 | Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
1b0c6de6 | 21 | |
4ce86f52 | 22 | |
0a3e1f45 | 23 | #define ASM_STABS_OP "\t.stabx\t" |
4ce86f52 RK |
24 | |
25 | /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */ | |
26 | ||
3251bd40 | 27 | #define DBX_TYPE_DECL_STABS_CODE N_DECL |
4ce86f52 RK |
28 | |
29 | /* Use the XCOFF predefined type numbers. */ | |
30 | ||
31 | /* ??? According to metin, typedef stabx must go in text control section, | |
32 | but he did not make this changes everywhere where such typedef stabx | |
33 | can be emitted, so it is really needed or not? */ | |
34 | ||
35 | #define DBX_OUTPUT_STANDARD_TYPES(SYMS) \ | |
36 | { \ | |
37 | text_section (); \ | |
38 | xcoff_output_standard_types (SYMS); \ | |
39 | } | |
40 | ||
41 | /* Any type with a negative type index has already been output. */ | |
42 | ||
43 | #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0) | |
44 | ||
45 | /* Must use N_STSYM for static const variables (those in the text section) | |
46 | instead of N_FUN. */ | |
47 | ||
48 | #define DBX_STATIC_CONST_VAR_CODE N_STSYM | |
49 | ||
a07287f0 JW |
50 | /* For static variables, output code to define the start of a static block. |
51 | ||
52 | ??? The IBM rs6000/AIX assembler has a bug that causes bss block debug | |
53 | info to be occasionally lost. A simple example is this: | |
54 | int a; static int b; | |
55 | The commands `gcc -g -c tmp.c; dump -t tmp.o' gives | |
56 | [10] m 0x00000016 1 0 0x8f 0x0000 .bs | |
57 | [11] m 0x00000000 1 0 0x90 0x0000 .es | |
58 | ... | |
59 | [21] m 0x00000000 -2 0 0x85 0x0000 b:S-1 | |
60 | which is wrong. The `b:S-1' must be between the `.bs' and `.es'. | |
61 | We can apparently work around the problem by forcing the text section | |
62 | (even if we are already in the text section) immediately before outputting | |
63 | the `.bs'. This should be fixed in the next major AIX release (3.3?). */ | |
4ce86f52 RK |
64 | |
65 | #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ | |
66 | { \ | |
67 | if ((CODE) == N_STSYM) \ | |
68 | fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ | |
69 | else if ((CODE) == N_LCSYM) \ | |
a07287f0 JW |
70 | { \ |
71 | fprintf ((ASMFILE), "%s\n", TEXT_SECTION_ASM_OP); \ | |
72 | fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ | |
73 | } \ | |
4ce86f52 RK |
74 | } |
75 | ||
76 | /* For static variables, output code to define the end of a static block. */ | |
77 | ||
78 | #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \ | |
79 | { \ | |
2afc5ce1 RK |
80 | if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ |
81 | fputs ("\t.es\n", (ASMFILE)); \ | |
4ce86f52 RK |
82 | } |
83 | ||
84 | /* We must use N_RPYSM instead of N_RSYM for register parameters. */ | |
85 | ||
86 | #define DBX_REGPARM_STABS_CODE N_RPSYM | |
87 | ||
88 | /* We must use 'R' instead of 'P' for register parameters. */ | |
89 | ||
90 | #define DBX_REGPARM_STABS_LETTER 'R' | |
91 | ||
92 | /* Define our own finish symbol function, since xcoff stabs have their | |
93 | own different format. */ | |
94 | ||
95 | #define DBX_FINISH_SYMBOL(SYM) \ | |
96 | { \ | |
97 | if (current_sym_addr && current_sym_code == N_FUN) \ | |
98 | fprintf (asmfile, "\",."); \ | |
99 | else \ | |
100 | fprintf (asmfile, "\","); \ | |
101 | /* If we are writing a function name, we must ensure that \ | |
102 | there is no storage-class suffix on the name. */ \ | |
103 | if (current_sym_addr && current_sym_code == N_FUN \ | |
104 | && GET_CODE (current_sym_addr) == SYMBOL_REF) \ | |
105 | { \ | |
3cce094d | 106 | const char *_p = XSTR (current_sym_addr, 0); \ |
be89f7bd RK |
107 | if (*_p == '*') \ |
108 | fprintf (asmfile, "%s", _p+1); \ | |
109 | else \ | |
110 | for (; *_p != '[' && *_p; _p++) \ | |
111 | fprintf (asmfile, "%c", *_p); \ | |
4ce86f52 RK |
112 | } \ |
113 | else if (current_sym_addr) \ | |
114 | output_addr_const (asmfile, current_sym_addr); \ | |
115 | else if (current_sym_code == N_GSYM) \ | |
76767c30 | 116 | assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \ |
4ce86f52 RK |
117 | else \ |
118 | fprintf (asmfile, "%d", current_sym_value); \ | |
119 | fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \ | |
120 | } | |
121 | ||
122 | /* These are IBM XCOFF extensions we need to reference in dbxout.c | |
123 | and xcoffout.c. */ | |
124 | ||
125 | /* AIX XCOFF uses this for typedefs. This can have any value, since it is | |
126 | only used for translation into a C_DECL storage class. */ | |
127 | #ifndef N_DECL | |
128 | #define N_DECL 0x8c | |
129 | #endif | |
130 | /* AIX XCOFF uses this for parameters passed in registers. This can have | |
131 | any value, since it is only used for translation into a C_RPSYM storage | |
132 | class. */ | |
133 | #ifndef N_RPSYM | |
134 | #define N_RPSYM 0x8e | |
135 | #endif | |
136 | ||
4ce86f52 RK |
137 | /* Name of the current include file. */ |
138 | ||
53cd5d6c | 139 | extern const char *xcoff_current_include_file; |
4ce86f52 | 140 | |
4ce86f52 RK |
141 | /* Names of bss and data sections. These should be unique names for each |
142 | compilation unit. */ | |
143 | ||
144 | extern char *xcoff_bss_section_name; | |
145 | extern char *xcoff_private_data_section_name; | |
146 | extern char *xcoff_read_only_section_name; | |
147 | ||
9459d8f5 JW |
148 | /* Last source file name mentioned in a NOTE insn. */ |
149 | ||
53cd5d6c | 150 | extern const char *xcoff_lastfile; |
9459d8f5 | 151 | |
4ce86f52 RK |
152 | /* Don't write out path name for main source file. */ |
153 | #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME) | |
154 | ||
9459d8f5 JW |
155 | /* Write out main source file name using ".file" rather than ".stabs". |
156 | We don't actually do this here, because the assembler gets confused if there | |
117323d4 | 157 | is more than one .file directive. ASM_FILE_START in config/rs6000/rs6000.h |
9faa82d8 | 158 | is already emitting a .file directory, so we don't output one here also. |
9459d8f5 | 159 | Initialize xcoff_lastfile. */ |
4ce86f52 | 160 | #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \ |
2afc5ce1 | 161 | xcoff_lastfile = (FILENAME) |
4ce86f52 RK |
162 | |
163 | /* If we are still in an include file, its end must be marked. */ | |
164 | #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ | |
165 | { \ | |
166 | if (xcoff_current_include_file) \ | |
167 | { \ | |
2afc5ce1 RK |
168 | fputs ("\t.ei\t", (FILE)); \ |
169 | output_quoted_string ((FILE), xcoff_current_include_file); \ | |
170 | putc ('\n', (FILE)); \ | |
4ce86f52 RK |
171 | xcoff_current_include_file = NULL; \ |
172 | } \ | |
173 | } | |
174 | ||
ad087b92 | 175 | /* .stabx has the type in a different place. */ |
f245e30e | 176 | #if 0 /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */ |
ad087b92 | 177 | #define DBX_OUTPUT_GCC_MARKER(FILE) \ |
f245e30e DE |
178 | fprintf ((FILE), "%s\"%s\",0,%d,0\n", ASM_STABS_OP, STABS_GCC_MARKER, \ |
179 | stab_to_sclass (N_GSYM)) | |
180 | #else | |
181 | #define DBX_OUTPUT_GCC_MARKER(FILE) | |
182 | #endif | |
ad087b92 | 183 | |
4ce86f52 RK |
184 | /* Do not break .stabs pseudos into continuations. */ |
185 | #define DBX_CONTIN_LENGTH 0 | |
186 | ||
187 | /* Don't try to use the `x' type-cross-reference character in DBX data. | |
188 | Also has the consequence of putting each struct, union or enum | |
189 | into a separate .stabs, containing only cross-refs to the others. */ | |
190 | #define DBX_NO_XREFS | |
51980b4a JW |
191 | |
192 | /* We must put stabs in the text section. If we don't the assembler | |
193 | won't handle them correctly; it will sometimes put stabs where gdb | |
194 | can't find them. */ | |
195 | ||
196 | #define DEBUG_SYMS_TEXT | |
296b8152 | 197 | |
2ba84f36 | 198 | /* Prototype functions in xcoffout.c. */ |
296b8152 | 199 | |
957e4763 | 200 | extern int stab_to_sclass PARAMS ((int)); |
296b8152 | 201 | #ifdef BUFSIZ |
653e276c NB |
202 | extern void xcoffout_begin_prologue PARAMS ((unsigned int, |
203 | const char *)); | |
e2a12aca NB |
204 | extern void xcoffout_begin_block PARAMS ((unsigned, unsigned)); |
205 | extern void xcoffout_end_epilogue PARAMS ((void)); | |
206 | extern void xcoffout_end_function PARAMS ((unsigned int)); | |
207 | extern void xcoffout_end_block PARAMS ((unsigned, unsigned)); | |
296b8152 KG |
208 | #endif /* BUFSIZ */ |
209 | ||
210 | #ifdef TREE_CODE | |
957e4763 | 211 | extern void xcoff_output_standard_types PARAMS ((tree)); |
296b8152 | 212 | #ifdef BUFSIZ |
53cd5d6c | 213 | extern void xcoffout_declare_function PARAMS ((FILE *, tree, const char *)); |
296b8152 KG |
214 | #endif /* BUFSIZ */ |
215 | #endif /* TREE_CODE */ | |
216 | ||
217 | #ifdef RTX_CODE | |
218 | #ifdef BUFSIZ | |
653e276c NB |
219 | extern void xcoffout_source_line PARAMS ((unsigned int, |
220 | const char *)); | |
296b8152 KG |
221 | #endif /* BUFSIZ */ |
222 | #endif /* RTX_CODE */ |