xcoffout.h revision 50397
1231200Smm/* XCOFF definitions. These are needed in dbxout.c, final.c, 2231200Smm and xcoffout.h. */ 3231200Smm 4231200Smm#define ASM_STABS_OP ".stabx" 5231200Smm 6231200Smm/* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */ 7231200Smm 8231200Smm#define DBX_TYPE_DECL_STABS_CODE N_DECL 9231200Smm 10231200Smm/* Use the XCOFF predefined type numbers. */ 11231200Smm 12231200Smm/* ??? According to metin, typedef stabx must go in text control section, 13231200Smm but he did not make this changes everywhere where such typedef stabx 14231200Smm can be emitted, so it is really needed or not? */ 15231200Smm 16231200Smm#define DBX_OUTPUT_STANDARD_TYPES(SYMS) \ 17231200Smm{ \ 18231200Smm text_section (); \ 19231200Smm xcoff_output_standard_types (SYMS); \ 20231200Smm} 21231200Smm 22231200Smm/* Any type with a negative type index has already been output. */ 23231200Smm 24231200Smm#define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0) 25238856Smm 26231200Smm/* Must use N_STSYM for static const variables (those in the text section) 27238856Smm instead of N_FUN. */ 28238856Smm 29231200Smm#define DBX_STATIC_CONST_VAR_CODE N_STSYM 30231200Smm 31231200Smm/* For static variables, output code to define the start of a static block. 32231200Smm 33231200Smm ??? The IBM rs6000/AIX assembler has a bug that causes bss block debug 34231200Smm info to be occasionally lost. A simple example is this: 35231200Smm int a; static int b; 36231200Smm The commands `gcc -g -c tmp.c; dump -t tmp.o' gives 37238856Smm[10] m 0x00000016 1 0 0x8f 0x0000 .bs 38238856Smm[11] m 0x00000000 1 0 0x90 0x0000 .es 39231200Smm... 40231200Smm[21] m 0x00000000 -2 0 0x85 0x0000 b:S-1 41231200Smm which is wrong. The `b:S-1' must be between the `.bs' and `.es'. 42231200Smm We can apparently work around the problem by forcing the text section 43231200Smm (even if we are already in the text section) immediately before outputting 44231200Smm the `.bs'. This should be fixed in the next major AIX release (3.3?). */ 45231200Smm 46231200Smm#define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ 47231200Smm{ \ 48231200Smm if ((CODE) == N_STSYM) \ 49231200Smm fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ 50231200Smm else if ((CODE) == N_LCSYM) \ 51231200Smm { \ 52231200Smm fprintf ((ASMFILE), "%s\n", TEXT_SECTION_ASM_OP); \ 53231200Smm fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ 54231200Smm } \ 55231200Smm} 56231200Smm 57231200Smm/* For static variables, output code to define the end of a static block. */ 58231200Smm 59231200Smm#define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \ 60231200Smm{ \ 61231200Smm if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ 62231200Smm fputs ("\t.es\n", (ASMFILE)); \ 63231200Smm} 64231200Smm 65231200Smm/* We must use N_RPYSM instead of N_RSYM for register parameters. */ 66231200Smm 67231200Smm#define DBX_REGPARM_STABS_CODE N_RPSYM 68231200Smm 69231200Smm/* We must use 'R' instead of 'P' for register parameters. */ 70231200Smm 71231200Smm#define DBX_REGPARM_STABS_LETTER 'R' 72231200Smm 73231200Smm/* Define our own finish symbol function, since xcoff stabs have their 74231200Smm own different format. */ 75231200Smm 76231200Smm#define DBX_FINISH_SYMBOL(SYM) \ 77231200Smm{ \ 78231200Smm if (current_sym_addr && current_sym_code == N_FUN) \ 79231200Smm fprintf (asmfile, "\",."); \ 80231200Smm else \ 81231200Smm fprintf (asmfile, "\","); \ 82231200Smm /* If we are writing a function name, we must ensure that \ 83231200Smm there is no storage-class suffix on the name. */ \ 84231200Smm if (current_sym_addr && current_sym_code == N_FUN \ 85231200Smm && GET_CODE (current_sym_addr) == SYMBOL_REF) \ 86231200Smm { \ 87231200Smm char *_p = XSTR (current_sym_addr, 0); \ 88231200Smm if (*_p == '*') \ 89231200Smm fprintf (asmfile, "%s", _p+1); \ 90231200Smm else \ 91231200Smm for (; *_p != '[' && *_p; _p++) \ 92231200Smm fprintf (asmfile, "%c", *_p); \ 93231200Smm } \ 94231200Smm else if (current_sym_addr) \ 95231200Smm output_addr_const (asmfile, current_sym_addr); \ 96231200Smm else if (current_sym_code == N_GSYM) \ 97231200Smm assemble_name (asmfile, XSTR (XEXP (DECL_RTL (sym), 0), 0)); \ 98231200Smm else \ 99231200Smm fprintf (asmfile, "%d", current_sym_value); \ 100231200Smm fprintf (asmfile, ",%d,0\n", stab_to_sclass (current_sym_code)); \ 101231200Smm} 102231200Smm 103231200Smm/* These are IBM XCOFF extensions we need to reference in dbxout.c 104231200Smm and xcoffout.c. */ 105231200Smm 106231200Smm/* AIX XCOFF uses this for typedefs. This can have any value, since it is 107231200Smm only used for translation into a C_DECL storage class. */ 108231200Smm#ifndef N_DECL 109231200Smm#define N_DECL 0x8c 110231200Smm#endif 111231200Smm/* AIX XCOFF uses this for parameters passed in registers. This can have 112231200Smm any value, since it is only used for translation into a C_RPSYM storage 113231200Smm class. */ 114231200Smm#ifndef N_RPSYM 115231200Smm#define N_RPSYM 0x8e 116231200Smm#endif 117231200Smm 118231200Smm/* Name of the current include file. */ 119231200Smm 120231200Smmextern char *xcoff_current_include_file; 121231200Smm 122231200Smm/* Names of bss and data sections. These should be unique names for each 123231200Smm compilation unit. */ 124231200Smm 125231200Smmextern char *xcoff_bss_section_name; 126231200Smmextern char *xcoff_private_data_section_name; 127231200Smmextern char *xcoff_read_only_section_name; 128231200Smm 129231200Smm/* Last source file name mentioned in a NOTE insn. */ 130231200Smm 131231200Smmextern char *xcoff_lastfile; 132231200Smm 133231200Smm/* Don't write out path name for main source file. */ 134231200Smm#define DBX_OUTPUT_MAIN_SOURCE_DIRECTORY(FILE,FILENAME) 135231200Smm 136231200Smm/* Write out main source file name using ".file" rather than ".stabs". 137231200Smm We don't actually do this here, because the assembler gets confused if there 138231200Smm is more than one .file directive. ASM_FILE_START in config/rs6000/rs6000.h 139231200Smm is already emitting a .file directory, so we don't output one here also. 140231200Smm Initialize xcoff_lastfile. */ 141231200Smm#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \ 142231200Smm xcoff_lastfile = (FILENAME) 143231200Smm 144231200Smm/* If we are still in an include file, its end must be marked. */ 145231200Smm#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ 146231200Smm{ \ 147231200Smm if (xcoff_current_include_file) \ 148231200Smm { \ 149231200Smm fputs ("\t.ei\t", (FILE)); \ 150231200Smm output_quoted_string ((FILE), xcoff_current_include_file); \ 151231200Smm putc ('\n', (FILE)); \ 152231200Smm xcoff_current_include_file = NULL; \ 153231200Smm } \ 154231200Smm} 155231200Smm 156231200Smm/* Do not break .stabs pseudos into continuations. */ 157231200Smm#define DBX_CONTIN_LENGTH 0 158231200Smm 159231200Smm/* Don't try to use the `x' type-cross-reference character in DBX data. 160231200Smm Also has the consequence of putting each struct, union or enum 161231200Smm into a separate .stabs, containing only cross-refs to the others. */ 162231200Smm#define DBX_NO_XREFS 163231200Smm 164231200Smm/* We must put stabs in the text section. If we don't the assembler 165231200Smm won't handle them correctly; it will sometimes put stabs where gdb 166231200Smm can't find them. */ 167231200Smm 168231200Smm#define DEBUG_SYMS_TEXT 169231200Smm 170231200Smm/* Prototype functions in xcoffout.c. */ 171231200Smm 172231200Smmextern int stab_to_sclass PROTO ((int)); 173231200Smm#ifdef BUFSIZ 174231200Smmextern void xcoffout_begin_function PROTO ((FILE *, int)); 175231200Smmextern void xcoffout_begin_block PROTO ((FILE *, int, int)); 176231200Smmextern void xcoffout_end_epilogue PROTO ((FILE *)); 177231200Smmextern void xcoffout_end_function PROTO ((FILE *, int)); 178231200Smmextern void xcoffout_end_block PROTO ((FILE *, int, int)); 179231200Smm#endif /* BUFSIZ */ 180231200Smm 181231200Smm#ifdef TREE_CODE 182231200Smmextern void xcoff_output_standard_types PROTO ((tree)); 183231200Smm#ifdef BUFSIZ 184231200Smmextern void xcoffout_declare_function PROTO ((FILE *, tree, char *)); 185231200Smm#endif /* BUFSIZ */ 186231200Smm#endif /* TREE_CODE */ 187231200Smm 188231200Smm#ifdef RTX_CODE 189231200Smm#ifdef BUFSIZ 190231200Smmextern void xcoffout_source_line PROTO ((FILE *, char *, rtx)); 191231200Smm#endif /* BUFSIZ */ 192231200Smm#endif /* RTX_CODE */ 193231200Smm