11debfc3dSmrg /* XCOFF definitions. These are needed in dbxout.c, final.c, 21debfc3dSmrg and xcoffout.h. 3*8feb0f0bSmrg Copyright (C) 1998-2020 Free Software Foundation, Inc. 41debfc3dSmrg 51debfc3dSmrg This file is part of GCC. 61debfc3dSmrg 71debfc3dSmrg GCC is free software; you can redistribute it and/or modify it under 81debfc3dSmrg the terms of the GNU General Public License as published by the Free 91debfc3dSmrg Software Foundation; either version 3, or (at your option) any later 101debfc3dSmrg version. 111debfc3dSmrg 121debfc3dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY 131debfc3dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or 141debfc3dSmrg FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 151debfc3dSmrg for more details. 161debfc3dSmrg 171debfc3dSmrg You should have received a copy of the GNU General Public License 181debfc3dSmrg along with GCC; see the file COPYING3. If not see 191debfc3dSmrg <http://www.gnu.org/licenses/>. */ 201debfc3dSmrg 211debfc3dSmrg #ifndef GCC_XCOFFOUT_H 221debfc3dSmrg #define GCC_XCOFFOUT_H 231debfc3dSmrg 241debfc3dSmrg /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */ 251debfc3dSmrg 261debfc3dSmrg #define DBX_TYPE_DECL_STABS_CODE N_DECL 271debfc3dSmrg 281debfc3dSmrg /* Use the XCOFF predefined type numbers. */ 291debfc3dSmrg 301debfc3dSmrg #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \ 311debfc3dSmrg xcoff_assign_fundamental_type_number (TYPE) 321debfc3dSmrg 331debfc3dSmrg /* Any type with a negative type index has already been output. */ 341debfc3dSmrg 351debfc3dSmrg #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0) 361debfc3dSmrg 371debfc3dSmrg /* Must use N_STSYM for static const variables (those in the text section) 381debfc3dSmrg instead of N_FUN. */ 391debfc3dSmrg 401debfc3dSmrg #define DBX_STATIC_CONST_VAR_CODE N_STSYM 411debfc3dSmrg 421debfc3dSmrg /* For static variables, output code to define the start of a static block. */ 431debfc3dSmrg 441debfc3dSmrg #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ 451debfc3dSmrg { \ 461debfc3dSmrg if ((CODE) == N_STSYM) \ 471debfc3dSmrg fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ 481debfc3dSmrg else if ((CODE) == N_LCSYM) \ 491debfc3dSmrg fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ 501debfc3dSmrg } 511debfc3dSmrg 521debfc3dSmrg /* For static variables, output code to define the end of a static block. */ 531debfc3dSmrg 541debfc3dSmrg #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \ 551debfc3dSmrg { \ 561debfc3dSmrg if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ 571debfc3dSmrg fputs ("\t.es\n", (ASMFILE)); \ 581debfc3dSmrg } 591debfc3dSmrg 601debfc3dSmrg /* We must use N_RPYSM instead of N_RSYM for register parameters. */ 611debfc3dSmrg 621debfc3dSmrg #define DBX_REGPARM_STABS_CODE N_RPSYM 631debfc3dSmrg 641debfc3dSmrg /* We must use 'R' instead of 'P' for register parameters. */ 651debfc3dSmrg 661debfc3dSmrg #define DBX_REGPARM_STABS_LETTER 'R' 671debfc3dSmrg 681debfc3dSmrg /* Define our own finish symbol function, since xcoff stabs have their 691debfc3dSmrg own different format. */ 701debfc3dSmrg 711debfc3dSmrg #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) do { \ 721debfc3dSmrg if (ADDR) \ 731debfc3dSmrg { \ 741debfc3dSmrg /* If we are writing a function name, we must emit a dot in \ 751debfc3dSmrg order to refer to the function code, not its descriptor. */ \ 761debfc3dSmrg if (CODE == N_FUN) \ 771debfc3dSmrg putc ('.', asm_out_file); \ 781debfc3dSmrg \ 791debfc3dSmrg /* If we are writing a function name, we must ensure that \ 801debfc3dSmrg there is no storage-class suffix on the name. */ \ 811debfc3dSmrg if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF) \ 821debfc3dSmrg { \ 831debfc3dSmrg const char *_p = XSTR (ADDR, 0); \ 841debfc3dSmrg if (*_p == '*') \ 851debfc3dSmrg fputs (_p+1, asm_out_file); \ 861debfc3dSmrg else \ 871debfc3dSmrg for (; *_p != '[' && *_p; _p++) \ 881debfc3dSmrg putc (*_p != '$' ? *_p : '_', asm_out_file); \ 891debfc3dSmrg } \ 901debfc3dSmrg else \ 911debfc3dSmrg output_addr_const (asm_out_file, ADDR); \ 921debfc3dSmrg } \ 931debfc3dSmrg /* Another special case: N_GSYM always gets the symbol name, \ 941debfc3dSmrg whether or not LABEL or NUMBER are set. */ \ 951debfc3dSmrg else if (CODE == N_GSYM) \ 961debfc3dSmrg assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (SYM), 0), 0)); \ 971debfc3dSmrg else if (LABEL) \ 981debfc3dSmrg assemble_name (asm_out_file, LABEL); \ 991debfc3dSmrg else \ 1001debfc3dSmrg dbxout_int (NUMBER); \ 1011debfc3dSmrg putc (',', asm_out_file); \ 1021debfc3dSmrg dbxout_int (stab_to_sclass (CODE)); \ 1031debfc3dSmrg fputs (",0\n", asm_out_file); \ 1041debfc3dSmrg } while (0) 1051debfc3dSmrg 1061debfc3dSmrg /* These are IBM XCOFF extensions we need to reference in dbxout.c 1071debfc3dSmrg and xcoffout.c. */ 1081debfc3dSmrg 1091debfc3dSmrg /* AIX XCOFF uses this for typedefs. This can have any value, since it is 1101debfc3dSmrg only used for translation into a C_DECL storage class. */ 1111debfc3dSmrg #ifndef N_DECL 1121debfc3dSmrg #define N_DECL 0x8c 1131debfc3dSmrg #endif 1141debfc3dSmrg /* AIX XCOFF uses this for parameters passed in registers. This can have 1151debfc3dSmrg any value, since it is only used for translation into a C_RPSYM storage 1161debfc3dSmrg class. */ 1171debfc3dSmrg #ifndef N_RPSYM 1181debfc3dSmrg #define N_RPSYM 0x8e 1191debfc3dSmrg #endif 1201debfc3dSmrg 1211debfc3dSmrg /* Name of the current include file. */ 1221debfc3dSmrg 1231debfc3dSmrg extern const char *xcoff_current_include_file; 1241debfc3dSmrg 1251debfc3dSmrg /* Names of bss and data sections. These should be unique names for each 1261debfc3dSmrg compilation unit. */ 1271debfc3dSmrg 1281debfc3dSmrg extern char *xcoff_bss_section_name; 1291debfc3dSmrg extern char *xcoff_private_data_section_name; 130a05ac97eSmrg extern char *xcoff_private_rodata_section_name; 1311debfc3dSmrg extern char *xcoff_tls_data_section_name; 1321debfc3dSmrg extern char *xcoff_tbss_section_name; 1331debfc3dSmrg extern char *xcoff_read_only_section_name; 1341debfc3dSmrg 1351debfc3dSmrg /* Last source file name mentioned in a NOTE insn. */ 1361debfc3dSmrg 1371debfc3dSmrg extern const char *xcoff_lastfile; 1381debfc3dSmrg 1391debfc3dSmrg /* Don't write out path name for main source file. */ 1401debfc3dSmrg #define NO_DBX_MAIN_SOURCE_DIRECTORY 1 1411debfc3dSmrg 1421debfc3dSmrg /* Write out main source file name using ".file" rather than ".stabs". 1431debfc3dSmrg We don't actually do this here, because the assembler gets confused if there 1441debfc3dSmrg is more than one .file directive. rs6000_xcoff_file_start is already 1451debfc3dSmrg emitting a .file directory, so we don't output one here also. 1461debfc3dSmrg Initialize xcoff_lastfile. */ 1471debfc3dSmrg #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \ 1481debfc3dSmrg xcoff_lastfile = (FILENAME) 1491debfc3dSmrg 1501debfc3dSmrg /* If we are still in an include file, its end must be marked. */ 1511debfc3dSmrg #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ 1521debfc3dSmrg do { \ 1531debfc3dSmrg if (xcoff_current_include_file) \ 1541debfc3dSmrg { \ 1551debfc3dSmrg fputs ("\t.ei\t", (FILE)); \ 1561debfc3dSmrg output_quoted_string ((FILE), xcoff_current_include_file); \ 1571debfc3dSmrg putc ('\n', (FILE)); \ 1581debfc3dSmrg xcoff_current_include_file = NULL; \ 1591debfc3dSmrg } \ 1601debfc3dSmrg } while (0) 1611debfc3dSmrg 1621debfc3dSmrg /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */ 1631debfc3dSmrg #define NO_DBX_GCC_MARKER 1641debfc3dSmrg 1651debfc3dSmrg /* XCOFF32 maximum length is 64K; XLC limits to 16K. */ 1661debfc3dSmrg #define DBX_CONTIN_LENGTH 16384 1671debfc3dSmrg 1681debfc3dSmrg /* XLC uses '?' as continuation character. */ 1691debfc3dSmrg #define DBX_CONTIN_CHAR '?' 1701debfc3dSmrg 1711debfc3dSmrg /* Don't try to use the `x' type-cross-reference character in DBX data. 1721debfc3dSmrg Also has the consequence of putting each struct, union or enum 1731debfc3dSmrg into a separate .stabs, containing only cross-refs to the others. */ 1741debfc3dSmrg #define DBX_NO_XREFS 1751debfc3dSmrg 1761debfc3dSmrg /* We must put stabs in the text section. If we don't the assembler 1771debfc3dSmrg won't handle them correctly; it will sometimes put stabs where gdb 1781debfc3dSmrg can't find them. */ 1791debfc3dSmrg 1801debfc3dSmrg #define DEBUG_SYMS_TEXT 1811debfc3dSmrg 1821debfc3dSmrg /* Prototype functions in xcoffout.c. */ 1831debfc3dSmrg 1841debfc3dSmrg extern int stab_to_sclass (int); 1851debfc3dSmrg extern void xcoffout_begin_prologue (unsigned int, unsigned int, const char *); 1861debfc3dSmrg extern void xcoffout_begin_block (unsigned, unsigned); 1871debfc3dSmrg extern void xcoffout_end_epilogue (unsigned int, const char *); 1881debfc3dSmrg extern void xcoffout_end_function (unsigned int); 1891debfc3dSmrg extern void xcoffout_end_block (unsigned, unsigned); 1901debfc3dSmrg extern int xcoff_assign_fundamental_type_number (tree); 1911debfc3dSmrg extern void xcoffout_declare_function (FILE *, tree, const char *); 1921debfc3dSmrg extern void xcoffout_source_line (unsigned int, unsigned int, const char *, 1931debfc3dSmrg int, bool); 1941debfc3dSmrg 1951debfc3dSmrg #endif /* GCC_XCOFFOUT_H */ 196