home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gcc-2.7.2.1-base.tgz / gcc-2.7.2.1-base.tar / fsf / gcc / config / sparc / litecoff.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  5KB  |  150 lines

  1. /* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF.
  2.    Copyright (C) 1994 Free Software Foundation, Inc.
  3.    Written by Ken Raeburn (raeburn@cygnus.com).
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22. #include "sparc/lite.h"
  23.  
  24. #undef ASM_OUTPUT_IDENT
  25.  
  26. #undef SELECT_SECTION
  27. #undef SELECT_RTX_SECTION
  28. #define BSS_SECTION_ASM_OP    ".section\t\".bss\""
  29.  
  30. #include "svr3.h"
  31.  
  32. #undef CPP_PREDEFINES
  33. #define CPP_PREDEFINES "-Dsparc -Dsparclite -Acpu(sparc) -Amachine(sparc)"
  34.  
  35. /* just in case */
  36. #undef DBX_DEBUGGING_INFO
  37. #undef PREFERRED_DEBUGGING_TYPE
  38. #define DBX_DEBUGGING_INFO
  39. #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
  40.  
  41. /* These are all necessary because this is how gdb expects gcc to output
  42.    stabs in coff.  */
  43.  
  44. /* Be function-relative for block and source line stab directives.  */
  45.  
  46. #define DBX_BLOCKS_FUNCTION_RELATIVE 1
  47.  
  48. /* but, to make this work, functions must appear prior to line info.  */
  49.  
  50. #define DBX_FUNCTION_FIRST
  51.  
  52. /* Generate a blank trailing N_SO to mark the end of the .o file, since
  53.    we can't depend upon the linker to mark .o file boundaries with
  54.    embedded stabs.  */
  55.  
  56. #define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)            \
  57.   fprintf (FILE,                            \
  58.        "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO)
  59.  
  60. /* This is copied from final.c and sparc.h.  */
  61. #undef ASM_OUTPUT_SOURCE_LINE
  62. #define ASM_OUTPUT_SOURCE_LINE(FILE, LINE)            \
  63. { if (write_symbols == SDB_DEBUG) {                \
  64.     fprintf ((FILE), "\t.ln\t%d\n",                \
  65.          ((sdb_begin_function_line > -1)            \
  66.           ? (LINE) - sdb_begin_function_line : 1));        \
  67.   } else if (write_symbols == DBX_DEBUG) {            \
  68.     static int sym_lineno = 1;                    \
  69.     fprintf (FILE, ".stabn 68,0,%d,.LM%d-",            \
  70.          LINE, sym_lineno);                    \
  71.     assemble_name (FILE,                    \
  72.            XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \
  73.     fprintf (FILE, "\n.LM%d:\n", sym_lineno);            \
  74.     sym_lineno += 1;                        \
  75.   } }
  76.  
  77. /* Support the ctors and dtors sections for g++.  */
  78.  
  79. #undef INIT_SECTION_ASM_OP
  80.  
  81. /* Support the ctors and dtors sections for g++.  */
  82.  
  83. #undef CTORS_SECTION_ASM_OP
  84. #define CTORS_SECTION_ASM_OP    ".section\t.ctors,\"x\""
  85. #undef DTORS_SECTION_ASM_OP
  86. #define DTORS_SECTION_ASM_OP    ".section\t.dtors,\"x\""
  87.  
  88. /* A list of other sections which the compiler might be "in" at any
  89.    given time.  */
  90.  
  91. #undef EXTRA_SECTIONS
  92. #define EXTRA_SECTIONS in_const, in_bss, in_ctors, in_dtors
  93.  
  94. /* A list of extra section function definitions.  */
  95.  
  96. #undef EXTRA_SECTION_FUNCTIONS
  97. #define EXTRA_SECTION_FUNCTIONS                        \
  98.   CONST_SECTION_FUNCTION                        \
  99.   CTORS_SECTION_FUNCTION                        \
  100.   DTORS_SECTION_FUNCTION
  101.  
  102. #define CTORS_SECTION_FUNCTION                        \
  103. void                                    \
  104. ctors_section ()                            \
  105. {                                    \
  106.   if (in_section != in_ctors)                        \
  107.     {                                    \
  108.       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);        \
  109.       in_section = in_ctors;                        \
  110.     }                                    \
  111. }
  112.  
  113. #define DTORS_SECTION_FUNCTION                        \
  114. void                                    \
  115. dtors_section ()                            \
  116. {                                    \
  117.   if (in_section != in_dtors)                        \
  118.     {                                    \
  119.       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);        \
  120.       in_section = in_dtors;                        \
  121.     }                                    \
  122. }
  123.  
  124. #define INT_ASM_OP ".long"
  125.  
  126. /* A C statement (sans semicolon) to output an element in the table of
  127.    global constructors.  */
  128. #undef ASM_OUTPUT_CONSTRUCTOR
  129. #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                \
  130.   do {                                    \
  131.     ctors_section ();                            \
  132.     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                \
  133.     assemble_name (FILE, NAME);                        \
  134.     fprintf (FILE, "\n");                        \
  135.   } while (0)
  136.  
  137. /* A C statement (sans semicolon) to output an element in the table of
  138.    global destructors.  */
  139. #undef ASM_OUTPUT_DESTRUCTOR
  140. #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                       \
  141.   do {                                    \
  142.     dtors_section ();                                   \
  143.     fprintf (FILE, "\t%s\t ", INT_ASM_OP);                \
  144.     assemble_name (FILE, NAME);                              \
  145.     fprintf (FILE, "\n");                        \
  146.   } while (0)
  147.  
  148. #undef DO_GLOBAL_CTORS_BODY
  149. #undef DO_GLOBAL_DTORS_BODY
  150.