home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / gcc / gcc258s.zoo / config / sparc / sysv4.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-04  |  7.6 KB  |  201 lines

  1. /* Target definitions for GNU compiler for Sparc running System V.4
  2.    Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  3.  
  4.    Written by Ron Guilmette (rfg@ncd.com).
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2, or (at your option)
  11. any later version.
  12.  
  13. GNU CC is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU CC; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. #include "sparc/sparc.h"
  23.  
  24. /* Undefine some symbols which are defined in "sparc.h" but which are
  25.    appropriate only for SunOS 4.x, and not for svr4.  */
  26.  
  27. #undef DBX_DEBUGGING_INFO
  28. #undef WORD_SWITCH_TAKES_ARG
  29. #undef SELECT_SECTION
  30. #undef ASM_DECLARE_FUNCTION_NAME
  31. #undef TEXT_SECTION_ASM_OP
  32. #undef DATA_SECTION_ASM_OP
  33.  
  34. #include "svr4.h"
  35.  
  36. /* Undefined some symbols which are defined in "svr4.h" but which are
  37.    appropriate only for typical svr4 systems, but not for the specific
  38.    case of svr4 running on a Sparc.  */
  39.  
  40. #undef CTORS_SECTION_ASM_OP
  41. #undef DTORS_SECTION_ASM_OP
  42. #undef INIT_SECTION_ASM_OP
  43. #undef CONST_SECTION_ASM_OP
  44. #undef TYPE_OPERAND_FMT
  45. #undef PUSHSECTION_FORMAT
  46. #undef STRING_ASM_OP
  47. #undef COMMON_ASM_OP
  48. #undef SKIP_ASM_OP
  49. #undef SET_ASM_OP    /* Has no equivalent.  See ASM_OUTPUT_DEF below.  */
  50.  
  51. /* Provide a set of pre-definitions and pre-assertions appropriate for
  52.    the Sparc running svr4.  __svr4__ is our extension.  */
  53.  
  54. #define CPP_PREDEFINES \
  55.   "-Dsparc -Dunix -D__svr4__ \
  56.    -Asystem(unix) -Asystem(svr4) -Acpu(sparc) -Amachine(sparc) \
  57.    -D__GCC_NEW_VARARGS__"
  58.  
  59. /* The specialized code which needs to appear in the .init section prior
  60.    to the prologue code for `__do_global_ctors' (see crtstuff.c).
  61.  
  62.    On Sparcs running svr4, the /usr/ccs/lib/crti.o file (with gets linked
  63.    in prior to the crtbegin.o file) has a single `save' instruction in its
  64.    .init section.  That `save' instruction tries to setup a stack frame for
  65.    the sake of any subsequent code in the .init section.  Unfortunately,
  66.    the size it uses for the stack frame is only a guess, and is not really
  67.    adequate for our purposes.  More importantly, we independently put our
  68.    own standard function prologue (for __do_global_ctors) into the .init
  69.    section and that function prologue includes its own `save' instruction!
  70.    Thus, unless we do something to correct the situation, we'll get *two*
  71.    stack frames allocated when crt0.o calls the code in the .init section,
  72.    and havoc will ensue.  The following macro definition prevents such woes.
  73. */
  74.  
  75. #define INIT_SECTION_PREAMBLE    asm ("restore")
  76.  
  77. /* This is the string used to begin an assembly language comment for the
  78.    Sparc/svr4 assembler.  */
  79.  
  80. #define ASM_COMMENT_START "!"
  81.  
  82. /* Define the names of various pseudo-op used by the Sparc/svr4 assembler.
  83.    Note that many of these are different from the typical pseudo-ops used
  84.    by most svr4 assemblers.  That is probably due to a (misguided?) attempt
  85.    to keep the Sparc/svr4 assembler somewhat compatible with the Sparc/SunOS
  86.    assembler.  */
  87.  
  88. #define STRING_ASM_OP        ".asciz"
  89. #define COMMON_ASM_OP        ".common"
  90. #define SKIP_ASM_OP        ".skip"
  91. #define UNALIGNED_INT_ASM_OP    ".uaword"
  92. #define UNALIGNED_SHORT_ASM_OP    ".uahalf"
  93. #define PUSHSECTION_ASM_OP    ".pushsection"
  94. #define POPSECTION_ASM_OP    ".popsection"
  95.  
  96. /* This is the format used to print the second operand of a .type pseudo-op
  97.    for the Sparc/svr4 assembler.  */
  98.  
  99. #define TYPE_OPERAND_FMT      "#%s"
  100.  
  101. /* This is the format used to print a .pushsection pseudo-op (and its operand)
  102.    for the Sparc/svr4 assembler.  */
  103.  
  104. #define PUSHSECTION_FORMAT    "\t%s\t\"%s\"\n"
  105.  
  106. #undef ASM_OUTPUT_CASE_LABEL
  107. #define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE)        \
  108. do { ASM_OUTPUT_ALIGN ((FILE), 2);                    \
  109.      ASM_OUTPUT_INTERNAL_LABEL ((FILE), PREFIX, NUM);            \
  110.    } while (0)
  111.  
  112. /* This is how to equate one symbol to another symbol.  The syntax used is
  113.    `SYM1=SYM2'.  Note that this is different from the way equates are done
  114.    with most svr4 assemblers, where the syntax is `.set SYM1,SYM2'.  */
  115.  
  116. #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                \
  117.  do {    fprintf ((FILE), "\t");                        \
  118.     assemble_name (FILE, LABEL1);                    \
  119.     fprintf (FILE, " = ");                        \
  120.     assemble_name (FILE, LABEL2);                    \
  121.     fprintf (FILE, "\n");                        \
  122.   } while (0)
  123.  
  124. /* Define how the Sparc registers should be numbered for Dwarf output.
  125.    The numbering provided here should be compatible with the native
  126.    svr4 SDB debugger in the Sparc/svr4 reference port.  The numbering
  127.    is as follows:
  128.  
  129.    Assembly name    gcc internal regno    Dwarf regno
  130.    ----------------------------------------------------------
  131.    g0-g7        0-7            0-7
  132.    o0-o7        8-15            8-15
  133.    l0-l7        16-23            16-23
  134.    i0-i7        24-31            24-31
  135.    f0-f31        32-63            40-71
  136. */
  137.  
  138. #define DBX_REGISTER_NUMBER(REGNO)                    \
  139.   (((REGNO) < 32) ? (REGNO)                        \
  140.    : ((REGNO) < 63) ? ((REGNO) + 8)                    \
  141.    : (abort (), 0))
  142.  
  143. /* A set of symbol definitions for assembly pseudo-ops which will
  144.    get us switched to various sections of interest.  These are used
  145.    in all places where we simply want to switch to a section, and
  146.    *not* to push the previous section name onto the assembler's
  147.    section names stack (as we do often in dwarfout.c).  */
  148.  
  149. #define TEXT_SECTION_ASM_OP    ".section\t\".text\""
  150. #define DATA_SECTION_ASM_OP    ".section\t\".data\""
  151. #define BSS_SECTION_ASM_OP    ".section\t\".bss\""
  152. #define CONST_SECTION_ASM_OP    ".section\t\".rodata\""
  153. #define INIT_SECTION_ASM_OP    ".section\t\".init\",#alloc"
  154. #define CTORS_SECTION_ASM_OP    ".section\t\".ctors\",#alloc"
  155. #define DTORS_SECTION_ASM_OP    ".section\t\".dtors\",#alloc"
  156.  
  157. /* If the host and target formats match, output the floats as hex.  */
  158. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
  159. #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
  160.  
  161. /* This is how to output assembly code to define a `float' constant.
  162.    We always have to use a .long pseudo-op to do this because the native
  163.    SVR4 ELF assembler is buggy and it generates incorrect values when we
  164.    try to use the .float pseudo-op instead.  */
  165.  
  166. #undef ASM_OUTPUT_FLOAT
  167. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  168. do { long value;                            \
  169.      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);            \
  170.      fprintf((FILE), "\t.long\t0x%x\n", value);                \
  171.    } while (0)
  172.  
  173. /* This is how to output assembly code to define a `double' constant.
  174.    We always have to use a pair of .long pseudo-ops to do this because
  175.    the native SVR4 ELF assembler is buggy and it generates incorrect
  176.    values when we try to use the the .double pseudo-op instead.  */
  177.  
  178. #undef ASM_OUTPUT_DOUBLE
  179. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  180. do { long value[2];                            \
  181.      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);            \
  182.      fprintf((FILE), "\t.long\t0x%x\n", value[0]);            \
  183.      fprintf((FILE), "\t.long\t0x%x\n", value[1]);            \
  184.    } while (0)
  185.  
  186. #endif /* word order matches */
  187. #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
  188.  
  189. /* This is how to output an assembler line defining a `long double'
  190.    constant.  */
  191.  
  192. #undef ASM_OUTPUT_LONG_DOUBLE
  193. #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                \
  194. do { long value[4];                            \
  195.      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);            \
  196.      fprintf((FILE), "\t.long\t0x%x\n", value[0]);            \
  197.      fprintf((FILE), "\t.long\t0x%x\n", value[1]);            \
  198.      fprintf((FILE), "\t.long\t0x%x\n", value[2]);            \
  199.      fprintf((FILE), "\t.long\t0x%x\n", value[3]);            \
  200.    } while (0)
  201.