xcoffout.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_XCOFFOUT_H
  17. #define GCC_XCOFFOUT_H
  18. /* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */
  19. #define DBX_TYPE_DECL_STABS_CODE N_DECL
  20. /* Use the XCOFF predefined type numbers. */
  21. #define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \
  22. xcoff_assign_fundamental_type_number (TYPE)
  23. /* Any type with a negative type index has already been output. */
  24. #define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0)
  25. /* Must use N_STSYM for static const variables (those in the text section)
  26. instead of N_FUN. */
  27. #define DBX_STATIC_CONST_VAR_CODE N_STSYM
  28. /* For static variables, output code to define the start of a static block. */
  29. #define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \
  30. { \
  31. if ((CODE) == N_STSYM) \
  32. fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\
  33. else if ((CODE) == N_LCSYM) \
  34. fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \
  35. }
  36. /* For static variables, output code to define the end of a static block. */
  37. #define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \
  38. { \
  39. if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \
  40. fputs ("\t.es\n", (ASMFILE)); \
  41. }
  42. /* We must use N_RPYSM instead of N_RSYM for register parameters. */
  43. #define DBX_REGPARM_STABS_CODE N_RPSYM
  44. /* We must use 'R' instead of 'P' for register parameters. */
  45. #define DBX_REGPARM_STABS_LETTER 'R'
  46. /* Define our own finish symbol function, since xcoff stabs have their
  47. own different format. */
  48. #define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) do { \
  49. if (ADDR) \
  50. { \
  51. /* If we are writing a function name, we must emit a dot in \
  52. order to refer to the function code, not its descriptor. */ \
  53. if (CODE == N_FUN) \
  54. putc ('.', asm_out_file); \
  55. \
  56. /* If we are writing a function name, we must ensure that \
  57. there is no storage-class suffix on the name. */ \
  58. if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF) \
  59. { \
  60. const char *_p = XSTR (ADDR, 0); \
  61. if (*_p == '*') \
  62. fputs (_p+1, asm_out_file); \
  63. else \
  64. for (; *_p != '[' && *_p; _p++) \
  65. putc (*_p != '$' ? *_p : '_', asm_out_file); \
  66. } \
  67. else \
  68. output_addr_const (asm_out_file, ADDR); \
  69. } \
  70. /* Another special case: N_GSYM always gets the symbol name, \
  71. whether or not LABEL or NUMBER are set. */ \
  72. else if (CODE == N_GSYM) \
  73. assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (SYM), 0), 0)); \
  74. else if (LABEL) \
  75. assemble_name (asm_out_file, LABEL); \
  76. else \
  77. dbxout_int (NUMBER); \
  78. putc (',', asm_out_file); \
  79. dbxout_int (stab_to_sclass (CODE)); \
  80. fputs (",0\n", asm_out_file); \
  81. } while (0)
  82. /* These are IBM XCOFF extensions we need to reference in dbxout.c
  83. and xcoffout.c. */
  84. /* AIX XCOFF uses this for typedefs. This can have any value, since it is
  85. only used for translation into a C_DECL storage class. */
  86. #ifndef N_DECL
  87. #define N_DECL 0x8c
  88. #endif
  89. /* AIX XCOFF uses this for parameters passed in registers. This can have
  90. any value, since it is only used for translation into a C_RPSYM storage
  91. class. */
  92. #ifndef N_RPSYM
  93. #define N_RPSYM 0x8e
  94. #endif
  95. /* Name of the current include file. */
  96. extern const char *xcoff_current_include_file;
  97. /* Names of bss and data sections. These should be unique names for each
  98. compilation unit. */
  99. extern char *xcoff_bss_section_name;
  100. extern char *xcoff_private_data_section_name;
  101. extern char *xcoff_tls_data_section_name;
  102. extern char *xcoff_tbss_section_name;
  103. extern char *xcoff_read_only_section_name;
  104. /* Last source file name mentioned in a NOTE insn. */
  105. extern const char *xcoff_lastfile;
  106. /* Don't write out path name for main source file. */
  107. #define NO_DBX_MAIN_SOURCE_DIRECTORY 1
  108. /* Write out main source file name using ".file" rather than ".stabs".
  109. We don't actually do this here, because the assembler gets confused if there
  110. is more than one .file directive. rs6000_xcoff_file_start is already
  111. emitting a .file directory, so we don't output one here also.
  112. Initialize xcoff_lastfile. */
  113. #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \
  114. xcoff_lastfile = (FILENAME)
  115. /* If we are still in an include file, its end must be marked. */
  116. #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \
  117. do { \
  118. if (xcoff_current_include_file) \
  119. { \
  120. fputs ("\t.ei\t", (FILE)); \
  121. output_quoted_string ((FILE), xcoff_current_include_file); \
  122. putc ('\n', (FILE)); \
  123. xcoff_current_include_file = NULL; \
  124. } \
  125. } while (0)
  126. /* Do not emit any marker for XCOFF until assembler allows XFT_CV. */
  127. #define NO_DBX_GCC_MARKER
  128. /* XCOFF32 maximum length is 64K; XLC limits to 16K. */
  129. #define DBX_CONTIN_LENGTH 16384
  130. /* XLC uses '?' as continuation character. */
  131. #define DBX_CONTIN_CHAR '?'
  132. /* Don't try to use the `x' type-cross-reference character in DBX data.
  133. Also has the consequence of putting each struct, union or enum
  134. into a separate .stabs, containing only cross-refs to the others. */
  135. #define DBX_NO_XREFS
  136. /* We must put stabs in the text section. If we don't the assembler
  137. won't handle them correctly; it will sometimes put stabs where gdb
  138. can't find them. */
  139. #define DEBUG_SYMS_TEXT
  140. /* Prototype functions in xcoffout.c. */
  141. extern int stab_to_sclass (int);
  142. extern void xcoffout_begin_prologue (unsigned int, const char *);
  143. extern void xcoffout_begin_block (unsigned, unsigned);
  144. extern void xcoffout_end_epilogue (unsigned int, const char *);
  145. extern void xcoffout_end_function (unsigned int);
  146. extern void xcoffout_end_block (unsigned, unsigned);
  147. extern int xcoff_assign_fundamental_type_number (tree);
  148. extern void xcoffout_declare_function (FILE *, tree, const char *);
  149. extern void xcoffout_source_line (unsigned int, const char *, int, bool);
  150. #endif /* GCC_XCOFFOUT_H */