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