1 /* XCOFF definitions. These are needed in dbxout.c, final.c, 2 and xcoffout.h. 3 Copyright (C) 1998, 2000, 2002 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 2, 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 COPYING. If not, write to the Free 19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 20 02111-1307, USA. */ 21 22 23 #define ASM_STABS_OP "\t.stabx\t" 24 25 /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */ 26 27 #define DBX_TYPE_DECL_STABS_CODE N_DECL 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 50 /* For static variables, output code to define the start of a static block. */ 51 52 #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ 53 { \ 54 if ((CODE) == N_STSYM) \ 55 fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ 56 else if ((CODE) == N_LCSYM) \ 57 fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ 58 } 59 60 /* For static variables, output code to define the end of a static block. */ 61 62 #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \ 63 { \ 64 if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ 65 fputs ("\t.es\n", (ASMFILE)); \ 66 } 67 68 /* We must use N_RPYSM instead of N_RSYM for register parameters. */ 69 70 #define DBX_REGPARM_STABS_CODE N_RPSYM 71 72 /* We must use 'R' instead of 'P' for register parameters. */ 73 74 #define DBX_REGPARM_STABS_LETTER 'R' 75 76 /* Define our own finish symbol function, since xcoff stabs have their 77 own different format. */ 78 79 #define DBX_FINISH_SYMBOL(SYM) \ 80 { \ 81 if (current_sym_addr && current_sym_code == N_FUN) \ 82 fprintf (asmfile, "\",."); \ 83 else \ 84 fprintf (asmfile, "\","); \ 85 /* If we are writing a function name, we must ensure that \ 86 there is no storage-class suffix on the name. */ \ 87 if (current_sym_addr && current_sym_code == N_FUN \ 88 && GET_CODE (current_sym_addr) == SYMBOL_REF) \ 89 { \ 90 const char *_p = XSTR (current_sym_addr, 0); \ 91 if (*_p == '*') \ 92 fprintf (asmfile, "%s", _p+1); \ 93 else \ 94 for (; *_p != '[' && *_p; _p++) \ 95 fprintf (asmfile, "%c", *_p); \ 96 } \ 97 else if (current_sym_addr) \ 98 output_addr_const (asmfile, current_sym_addr); \ 99 else if (current_sym_code == N_GSYM) \ 100 assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \ 101 else \ 102 fprintf (asmfile, "%d", current_sym_value); \ 103 fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \ 104 } 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_read_only_section_name; 131 132 /* Last source file name mentioned in a NOTE insn. */ 133 134 extern const char *xcoff_lastfile; 135 136 /* Don't write out path name for main source file. */ 137 #define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME) 138 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. ASM_FILE_START in config/rs6000/rs6000.h 142 is already 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) 146 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 { \ 150 if (xcoff_current_include_file) \ 151 { \ 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; \ 156 } \ 157 } 158 159 /* .stabx has the type in a different place. */ 160 #if 0 /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */ 161 #define DBX_OUTPUT_GCC_MARKER(FILE) \ 162 fprintf ((FILE), "%s\"%s\",0,%d,0\n", ASM_STABS_OP, STABS_GCC_MARKER, \ 163 stab_to_sclass (N_GSYM)) 164 #else 165 #define DBX_OUTPUT_GCC_MARKER(FILE) 166 #endif 167 168 /* Do not break .stabs pseudos into continuations. */ 169 #define DBX_CONTIN_LENGTH 0 170 171 /* Don't try to use the `x' type-cross-reference character in DBX data. 172 Also has the consequence of putting each struct, union or enum 173 into a separate .stabs, containing only cross-refs to the others. */ 174 #define DBX_NO_XREFS 175 176 /* We must put stabs in the text section. If we don't the assembler 177 won't handle them correctly; it will sometimes put stabs where gdb 178 can't find them. */ 179 180 #define DEBUG_SYMS_TEXT 181 182 /* Prototype functions in xcoffout.c. */ 183 184 extern int stab_to_sclass PARAMS ((int)); 185 #ifdef BUFSIZ 186 extern void xcoffout_begin_prologue PARAMS ((unsigned int, 187 const char *)); 188 extern void xcoffout_begin_block PARAMS ((unsigned, unsigned)); 189 extern void xcoffout_end_epilogue PARAMS ((unsigned int, 190 const char *)); 191 extern void xcoffout_end_function PARAMS ((unsigned int)); 192 extern void xcoffout_end_block PARAMS ((unsigned, unsigned)); 193 #endif /* BUFSIZ */ 194 195 #ifdef TREE_CODE 196 extern void xcoff_output_standard_types PARAMS ((tree)); 197 #ifdef BUFSIZ 198 extern void xcoffout_declare_function PARAMS ((FILE *, tree, const char *)); 199 #endif /* BUFSIZ */ 200 #endif /* TREE_CODE */ 201 202 #ifdef RTX_CODE 203 #ifdef BUFSIZ 204 extern void xcoffout_source_line PARAMS ((unsigned int, 205 const char *)); 206 #endif /* BUFSIZ */ 207 #endif /* RTX_CODE */ 208