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