gcc50: Disconnect from buildworld.
[dragonfly.git] / contrib / gcc-5.0 / gcc / xcoffout.h
1 /* XCOFF definitions.  These are needed in dbxout.c, final.c,
2    and xcoffout.h.
3    Copyright (C) 1998-2015 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
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 3, or (at your option) any later
10 version.
11
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.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 #ifndef GCC_XCOFFOUT_H
22 #define GCC_XCOFFOUT_H
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(SYM, CODE, LINE, ADDR, LABEL, NUMBER) do {     \
72   if (ADDR)                                                             \
73     {                                                                   \
74       /* If we are writing a function name, we must emit a dot in       \
75          order to refer to the function code, not its descriptor.  */   \
76       if (CODE == N_FUN)                                                \
77         putc ('.', asm_out_file);                                       \
78                                                                         \
79       /* If we are writing a function name, we must ensure that         \
80          there is no storage-class suffix on the name.  */              \
81       if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF)               \
82         {                                                               \
83           const char *_p = XSTR (ADDR, 0);                              \
84           if (*_p == '*')                                               \
85             fputs (_p+1, asm_out_file);                                 \
86           else                                                          \
87             for (; *_p != '[' && *_p; _p++)                             \
88               putc (*_p != '$' ? *_p : '_', asm_out_file);              \
89         }                                                               \
90       else                                                              \
91         output_addr_const (asm_out_file, ADDR);                         \
92     }                                                                   \
93   /* Another special case: N_GSYM always gets the symbol name,          \
94      whether or not LABEL or NUMBER are set.  */                        \
95   else if (CODE == N_GSYM)                                              \
96     assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (SYM), 0), 0));   \
97   else if (LABEL)                                                       \
98     assemble_name (asm_out_file, LABEL);                                \
99   else                                                                  \
100     dbxout_int (NUMBER);                                                \
101   putc (',', asm_out_file);                                             \
102   dbxout_int (stab_to_sclass (CODE));                                   \
103   fputs (",0\n", asm_out_file);                                         \
104 } while (0)
105
106 /* These are IBM XCOFF extensions we need to reference in dbxout.c
107    and xcoffout.c.  */
108
109 /* AIX XCOFF uses this for typedefs.  This can have any value, since it is
110    only used for translation into a C_DECL storage class.  */
111 #ifndef N_DECL
112 #define N_DECL 0x8c
113 #endif
114 /* AIX XCOFF uses this for parameters passed in registers.  This can have
115    any value, since it is only used for translation into a C_RPSYM storage
116    class.  */
117 #ifndef N_RPSYM
118 #define N_RPSYM 0x8e
119 #endif
120
121 /* Name of the current include file.  */
122
123 extern const char *xcoff_current_include_file;
124
125 /* Names of bss and data sections.  These should be unique names for each
126    compilation unit.  */
127
128 extern char *xcoff_bss_section_name;
129 extern char *xcoff_private_data_section_name;
130 extern char *xcoff_tls_data_section_name;
131 extern char *xcoff_tbss_section_name;
132 extern char *xcoff_read_only_section_name;
133
134 /* Last source file name mentioned in a NOTE insn.  */
135
136 extern const char *xcoff_lastfile;
137
138 /* Don't write out path name for main source file.  */
139 #define NO_DBX_MAIN_SOURCE_DIRECTORY 1
140
141 /* Write out main source file name using ".file" rather than ".stabs".
142    We don't actually do this here, because the assembler gets confused if there
143    is more than one .file directive.  rs6000_xcoff_file_start is already
144    emitting a .file directory, so we don't output one here also.
145    Initialize xcoff_lastfile.  */
146 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
147   xcoff_lastfile = (FILENAME)
148
149 /* If we are still in an include file, its end must be marked.  */
150 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
151 do {                                                    \
152   if (xcoff_current_include_file)                       \
153     {                                                   \
154       fputs ("\t.ei\t", (FILE));                        \
155       output_quoted_string ((FILE), xcoff_current_include_file);        \
156       putc ('\n', (FILE));                              \
157       xcoff_current_include_file = NULL;                \
158     }                                                   \
159 } while (0)
160
161 /* Do not emit any marker for XCOFF until assembler allows XFT_CV.  */
162 #define NO_DBX_GCC_MARKER
163
164 /* XCOFF32 maximum length is 64K; XLC limits to 16K.  */
165 #define DBX_CONTIN_LENGTH 16384
166
167 /* XLC uses '?' as continuation character.  */
168 #define DBX_CONTIN_CHAR '?'
169
170 /* Don't try to use the `x' type-cross-reference character in DBX data.
171    Also has the consequence of putting each struct, union or enum
172    into a separate .stabs, containing only cross-refs to the others.  */
173 #define DBX_NO_XREFS
174
175 /* We must put stabs in the text section.  If we don't the assembler
176    won't handle them correctly; it will sometimes put stabs where gdb
177    can't find them.  */
178
179 #define DEBUG_SYMS_TEXT
180
181 /* Prototype functions in xcoffout.c.  */
182
183 extern int stab_to_sclass (int);
184 extern void xcoffout_begin_prologue (unsigned int, const char *);
185 extern void xcoffout_begin_block (unsigned, unsigned);
186 extern void xcoffout_end_epilogue (unsigned int, const char *);
187 extern void xcoffout_end_function (unsigned int);
188 extern void xcoffout_end_block (unsigned, unsigned);
189 extern int xcoff_assign_fundamental_type_number (tree);
190 extern void xcoffout_declare_function (FILE *, tree, const char *);
191 extern void xcoffout_source_line (unsigned int, const char *, int, bool);
192
193 #endif /* GCC_XCOFFOUT_H */