2014-04-15 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / xcoffout.h
blob3373c8e6e7afb2f21b8872ebd6dc3068f7549fc0
1 /* XCOFF definitions. These are needed in dbxout.c, final.c,
2 and xcoffout.h.
3 Copyright (C) 1998-2014 Free Software Foundation, Inc.
5 This file is part of GCC.
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.
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.
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/>. */
22 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */
24 #define DBX_TYPE_DECL_STABS_CODE N_DECL
26 /* Use the XCOFF predefined type numbers. */
28 #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \
29 xcoff_assign_fundamental_type_number (TYPE)
31 /* Any type with a negative type index has already been output. */
33 #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
35 /* Must use N_STSYM for static const variables (those in the text section)
36 instead of N_FUN. */
38 #define DBX_STATIC_CONST_VAR_CODE N_STSYM
40 /* For static variables, output code to define the start of a static block. */
42 #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \
43 { \
44 if ((CODE) == N_STSYM) \
45 fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
46 else if ((CODE) == N_LCSYM) \
47 fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
50 /* For static variables, output code to define the end of a static block. */
52 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \
53 { \
54 if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \
55 fputs ("\t.es\n", (ASMFILE)); \
58 /* We must use N_RPYSM instead of N_RSYM for register parameters. */
60 #define DBX_REGPARM_STABS_CODE N_RPSYM
62 /* We must use 'R' instead of 'P' for register parameters. */
64 #define DBX_REGPARM_STABS_LETTER 'R'
66 /* Define our own finish symbol function, since xcoff stabs have their
67 own different format. */
69 #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) do { \
70 if (ADDR) \
71 { \
72 /* If we are writing a function name, we must emit a dot in \
73 order to refer to the function code, not its descriptor. */ \
74 if (CODE == N_FUN) \
75 putc ('.', asm_out_file); \
77 /* If we are writing a function name, we must ensure that \
78 there is no storage-class suffix on the name. */ \
79 if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF) \
80 { \
81 const char *_p = XSTR (ADDR, 0); \
82 if (*_p == '*') \
83 fputs (_p+1, asm_out_file); \
84 else \
85 for (; *_p != '[' && *_p; _p++) \
86 putc (*_p != '$' ? *_p : '_', asm_out_file); \
87 } \
88 else \
89 output_addr_const (asm_out_file, ADDR); \
90 } \
91 /* Another special case: N_GSYM always gets the symbol name, \
92 whether or not LABEL or NUMBER are set. */ \
93 else if (CODE == N_GSYM) \
94 assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (SYM), 0), 0)); \
95 else if (LABEL) \
96 assemble_name (asm_out_file, LABEL); \
97 else \
98 dbxout_int (NUMBER); \
99 putc (',', asm_out_file); \
100 dbxout_int (stab_to_sclass (CODE)); \
101 fputs (",0\n", asm_out_file); \
102 } while (0)
104 /* These are IBM XCOFF extensions we need to reference in dbxout.c
105 and xcoffout.c. */
107 /* AIX XCOFF uses this for typedefs. This can have any value, since it is
108 only used for translation into a C_DECL storage class. */
109 #ifndef N_DECL
110 #define N_DECL 0x8c
111 #endif
112 /* AIX XCOFF uses this for parameters passed in registers. This can have
113 any value, since it is only used for translation into a C_RPSYM storage
114 class. */
115 #ifndef N_RPSYM
116 #define N_RPSYM 0x8e
117 #endif
119 /* Name of the current include file. */
121 extern const char *xcoff_current_include_file;
123 /* Names of bss and data sections. These should be unique names for each
124 compilation unit. */
126 extern char *xcoff_bss_section_name;
127 extern char *xcoff_private_data_section_name;
128 extern char *xcoff_tls_data_section_name;
129 extern char *xcoff_tbss_section_name;
130 extern char *xcoff_read_only_section_name;
132 /* Last source file name mentioned in a NOTE insn. */
134 extern const char *xcoff_lastfile;
136 /* Don't write out path name for main source file. */
137 #define NO_DBX_MAIN_SOURCE_DIRECTORY 1
139 /* Write out main source file name using ".file" rather than ".stabs".
140 We don't actually do this here, because the assembler gets confused if there
141 is more than one .file directive. rs6000_xcoff_file_start is already
142 emitting a .file directory, so we don't output one here also.
143 Initialize xcoff_lastfile. */
144 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
145 xcoff_lastfile = (FILENAME)
147 /* If we are still in an include file, its end must be marked. */
148 #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
149 do { \
150 if (xcoff_current_include_file) \
152 fputs ("\t.ei\t", (FILE)); \
153 output_quoted_string ((FILE), xcoff_current_include_file); \
154 putc ('\n', (FILE)); \
155 xcoff_current_include_file = NULL; \
157 } while (0)
159 /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */
160 #define NO_DBX_GCC_MARKER
162 /* Do not break .stabs pseudos into continuations. */
163 #define DBX_CONTIN_LENGTH 0
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
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. */
174 #define DEBUG_SYMS_TEXT
176 /* Prototype functions in xcoffout.c. */
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 *, int, bool);