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 / i860 / sysv4.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  8KB  |  213 lines

  1. /* Target definitions for GNU compiler for Intel 80860 running System V.4
  2.    Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4.    Written by Ron Guilmette (rfg@netcom.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, 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.  */
  22.  
  23. #include "i860/i860.h"
  24. #include "svr4.h"
  25.  
  26. #undef TARGET_VERSION
  27. #define TARGET_VERSION fprintf (stderr, " (i860 System V Release 4)");
  28.  
  29. /* Provide a set of pre-definitions and pre-assertions appropriate for
  30.    the i860 running svr4.  Note that the symbol `__svr4__' MUST BE
  31.    DEFINED!  It is needed so that the va_list struct in va-i860.h
  32.    will get correctly defined for the svr4 (ABI compliant) case rather
  33.    than for the previous (svr3, svr2, ...) case.  It also needs to be
  34.    defined so that the correct (svr4) version of __builtin_saveregs
  35.    will be selected when we are building gnulib2.c.
  36.    __svr4__ is our extension.  */
  37.  
  38. #define CPP_PREDEFINES \
  39.   "-Di860 -Dunix -DSVR4 -D__svr4__ -Asystem(unix) -Asystem(svr4) -Acpu(i860) -Amachine(i860)"
  40.  
  41. /* The prefix to be used in assembler output for all names of registers.
  42.    This string gets prepended to all i860 register names (svr4 only).  */
  43.  
  44. #define I860_REG_PREFIX    "%"
  45.  
  46. #define ASM_COMMENT_START "#"
  47.  
  48. #undef TYPE_OPERAND_FMT
  49. #define TYPE_OPERAND_FMT      "\"%s\""
  50.  
  51. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  52.  
  53. /* The following macro definition overrides the one in i860.h
  54.    because the svr4 i860 assembler requires a different syntax
  55.    for getting parts of constant/relocatable values.  */
  56.  
  57. #undef PRINT_OPERAND_PART
  58. #define PRINT_OPERAND_PART(FILE, X, PART_CODE)                \
  59.   do { fprintf (FILE, "[");                        \
  60.     output_address (X);                        \
  61.     fprintf (FILE, "]@%s", PART_CODE);                \
  62.   } while (0)
  63.  
  64. /* If the host and target formats match, output the floats as hex.  */
  65. #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT
  66. #if defined (HOST_WORDS_BIG_ENDIAN) == WORDS_BIG_ENDIAN
  67.  
  68. /* This is how to output an assembler line defining a `double' constant.
  69.    Note that the native i860/svr4 ELF assembler can't properly handle
  70.    infinity.  It generates an incorrect (non-infinity) value when given
  71.    `.double 99e9999' and it doesn't grok `inf' at all.  It also mishandles
  72.    NaNs and -0.0.  */
  73.  
  74. #undef ASM_OUTPUT_DOUBLE
  75. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  76.   {                                    \
  77.     if (REAL_VALUE_ISINF (VALUE)                    \
  78.         || REAL_VALUE_ISNAN (VALUE)                    \
  79.     || REAL_VALUE_MINUS_ZERO (VALUE))                \
  80.       {                                    \
  81.     long t[2];                            \
  82.     REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), t);            \
  83.     fprintf (FILE, "\t.word 0x%lx\n\t.word 0x%lx\n", t[0], t[1]);    \
  84.       }                                    \
  85.     else                                \
  86.       fprintf (FILE, "\t.double %.20e\n", VALUE);            \
  87.   }
  88.  
  89. /* This is how to output an assembler line defining a `float' constant.
  90.    Note that the native i860/svr4 ELF assembler can't properly handle
  91.    infinity.  It actually generates an assembly time error when given
  92.    `.float 99e9999' and it doesn't grok `inf' at all.  It also mishandles
  93.    NaNs and -0.0.  */
  94.  
  95. #undef ASM_OUTPUT_FLOAT
  96. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  97.   {                                    \
  98.     if (REAL_VALUE_ISINF (VALUE)                    \
  99.         || REAL_VALUE_ISNAN (VALUE)                    \
  100.     || REAL_VALUE_MINUS_ZERO (VALUE))                \
  101.       {                                    \
  102.     long t;                                \
  103.     REAL_VALUE_TO_TARGET_SINGLE ((VALUE), t);            \
  104.     fprintf (FILE, "\t.word 0x%lx\n", t);                \
  105.       }                                    \
  106.     else                                \
  107.       fprintf (FILE, "\t.float %.12e\n", VALUE);            \
  108.   }
  109.  
  110. #endif /* word order matches */
  111. #endif /* HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT */
  112.  
  113. #undef ASM_FILE_START
  114. #define ASM_FILE_START(FILE)                        \
  115.   do {    output_file_directive (FILE, main_input_filename);        \
  116.     fprintf (FILE, "\t.version\t\"01.01\"\n");            \
  117.   } while (0)
  118.  
  119. /* Output the special word the svr4 SDB wants to see just before
  120.    the first word of each function's prologue code.  */
  121.  
  122. extern char *current_function_original_name;
  123.  
  124. /* This special macro is used to output a magic word just before the
  125.    first word of each function.  On some versions of UNIX running on
  126.    the i860, this word can be any word that looks like a NOP, however
  127.    under svr4, this neds to be an `shr r0,r0,r0' instruction in which
  128.    the normally unused low-order bits contain the length of the function
  129.    prologue code (in bytes).  This is needed to make the svr4 SDB debugger
  130.    happy.  */
  131.  
  132. #undef ASM_OUTPUT_FUNCTION_PREFIX
  133. #define ASM_OUTPUT_FUNCTION_PREFIX(FILE, FNNAME)            \
  134.   do {    ASM_OUTPUT_ALIGN (FILE, 2);                    \
  135.       fprintf ((FILE), "\t.long\t.ep.");                \
  136.     assemble_name (FILE, FNNAME);                    \
  137.     fprintf (FILE, "-");                        \
  138.     assemble_name (FILE, FNNAME);                    \
  139.     fprintf (FILE, "+0xc8000000\n");                \
  140.     current_function_original_name = (FNNAME);            \
  141.   } while (0)
  142.  
  143. /* Output the special label that must go just after each function's
  144.    prologue code to support svr4 SDB.  */
  145.  
  146. #define ASM_OUTPUT_PROLOGUE_SUFFIX(FILE)                \
  147.   do {    fprintf (FILE, ".ep.");                        \
  148.     assemble_name (FILE, current_function_original_name);        \
  149.     fprintf (FILE, ":\n");                        \
  150.   } while (0)
  151.  
  152. /* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
  153.  
  154.    Note that we want to give these sections the SHF_WRITE attribute
  155.    because these sections will actually contain data (i.e. tables of
  156.    addresses of functions in the current root executable or shared library
  157.    file) and, in the case of a shared library, the relocatable addresses
  158.    will have to be properly resolved/relocated (and then written into) by
  159.    the dynamic linker when it actually attaches the given shared library
  160.    to the executing process.  (Note that on SVR4, you may wish to use the
  161.    `-z text' option to the ELF linker, when building a shared library, as
  162.    an additional check that you are doing everything right.  But if you do
  163.    use the `-z text' option when building a shared library, you will get
  164.    errors unless the .ctors and .dtors sections are marked as writable
  165.    via the SHF_WRITE attribute.)  */
  166.  
  167. #undef CTORS_SECTION_ASM_OP
  168. #define CTORS_SECTION_ASM_OP    ".section\t.ctors,\"aw\""
  169. #undef DTORS_SECTION_ASM_OP
  170. #define DTORS_SECTION_ASM_OP    ".section\t.dtors,\"aw\""
  171.  
  172. /* Add definitions to support the .tdesc section as specified in the svr4
  173.    ABI for the i860.  */
  174.  
  175. #define TDESC_SECTION_ASM_OP    ".section\t.tdesc"
  176.  
  177. #undef EXTRA_SECTIONS
  178. #define EXTRA_SECTIONS in_const, in_ctors, in_dtors, in_tdesc
  179.  
  180. #undef EXTRA_SECTION_FUNCTIONS
  181. #define EXTRA_SECTION_FUNCTIONS                        \
  182.   CONST_SECTION_FUNCTION                        \
  183.   CTORS_SECTION_FUNCTION                        \
  184.   DTORS_SECTION_FUNCTION                        \
  185.   TDESC_SECTION_FUNCTION
  186.  
  187. #define TDESC_SECTION_FUNCTION                        \
  188. void                                    \
  189. tdesc_section ()                            \
  190. {                                    \
  191.   if (in_section != in_tdesc)                        \
  192.     {                                    \
  193.       fprintf (asm_out_file, "%s\n", TDESC_SECTION_ASM_OP);        \
  194.       in_section = in_tdesc;                        \
  195.     }                                    \
  196. }
  197.  
  198. #ifdef OUTPUT_TDESC
  199. #undef ASM_FILE_END
  200. #define ASM_FILE_END(FILE)                    \
  201. do {                                 \
  202.      if (current_function_original_name != NULL) {        \
  203.        tdesc_section();                        \
  204.        fprintf ((FILE), "%s __ETEXT\n", ASM_LONG);        \
  205.        fprintf ((FILE), "%s 0\n", ASM_LONG);            \
  206.        text_section();                        \
  207.        fputs("__ETEXT:\n", (FILE));                \
  208.      }                                \
  209.      fprintf ((FILE), "\t.ident\t\"GCC: (GNU) %s\"\n",        \
  210.           version_string);                    \
  211.    } while (0)
  212. #endif
  213.