home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / config / i386 / freebsd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-14  |  11.3 KB  |  321 lines

  1. /* Definitions of target machine for GNU compiler for Intel 80386
  2.    running FreeBSD.
  3.    Copyright (C) 1988, 1992, 1994 Free Software Foundation, Inc.
  4.    Contributed by Poul-Henning Kamp <phk@login.dkuug.dk>
  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. /* This goes away when the math-emulator is fixed */
  23. #define TARGET_CPU_DEFAULT 0400        /* TARGET_NO_FANCY_MATH_387 */
  24.  
  25. /* This is tested by i386gas.h.  */
  26. #define YES_UNDERSCORES
  27.  
  28. #include "i386/gstabs.h"
  29.  
  30. /* Get perform_* macros to build libgcc.a.  */
  31. #include "i386/perform.h"
  32.  
  33. #undef CPP_PREDEFINES
  34. #define CPP_PREDEFINES "-Dunix -Di386 -D__FreeBSD__ -D__386BSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)"
  35.  
  36. #define INCLUDE_DEFAULTS { \
  37.     { "/usr/include", 0 }, \
  38.     { "/usr/include/g++", 1 }, \
  39.     { 0, 0} \
  40.     }
  41.  
  42. /* Like the default, except no -lg.  */
  43. #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
  44.  
  45. #undef SIZE_TYPE
  46. #define SIZE_TYPE "unsigned int"
  47.  
  48. #undef PTRDIFF_TYPE
  49. #define PTRDIFF_TYPE "int"
  50.  
  51. #undef WCHAR_TYPE
  52. #define WCHAR_TYPE "short unsigned int"
  53.  
  54. #define WCHAR_UNSIGNED 1
  55.  
  56. #undef WCHAR_TYPE_SIZE
  57. #define WCHAR_TYPE_SIZE 16
  58.  
  59. #define HAVE_ATEXIT
  60.  
  61. /* Redefine this to use %eax instead of %edx.  */
  62. #undef FUNCTION_PROFILER
  63. #define FUNCTION_PROFILER(FILE, LABELNO)  \
  64. {                                    \
  65.   if (flag_pic)                                \
  66.     {                                    \
  67.       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%eax\n",        \
  68.            LPREFIX, (LABELNO));                    \
  69.       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");            \
  70.     }                                    \
  71.   else                                    \
  72.     {                                    \
  73.       fprintf (FILE, "\tmovl $%sP%d,%%eax\n", LPREFIX, (LABELNO));    \
  74.       fprintf (FILE, "\tcall mcount\n");                \
  75.     }                                    \
  76. }
  77.  
  78. /* There are conflicting reports about whether this system uses
  79.    a different assembler syntax.  wilson@cygnus.com says # is right.  */
  80. #undef COMMENT_BEGIN
  81. #define COMMENT_BEGIN "#"
  82.  
  83. #undef ASM_APP_ON
  84. #define ASM_APP_ON "#APP\n"
  85.  
  86. #undef ASM_APP_OFF
  87. #define ASM_APP_OFF "#NO_APP\n"
  88.  
  89. /* The following macros are stolen from i386v4.h */
  90. /* These have to be defined to get PIC code correct */
  91.  
  92. /* This is how to output an element of a case-vector that is relative.
  93.    This is only used for PIC code.  See comments by the `casesi' insn in
  94.    i386.md for an explanation of the expression this outputs. */
  95.  
  96. #undef ASM_OUTPUT_ADDR_DIFF_ELT
  97. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
  98.   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
  99.  
  100. /* Indicate that jump tables go in the text section.  This is
  101.    necessary when compiling PIC code.  */
  102.  
  103. #define JUMP_TABLES_IN_TEXT_SECTION
  104.  
  105. /* Don't default to pcc-struct-return, because gcc is the only compiler, and
  106.    we want to retain compatibility with older gcc versions.  */
  107. #define DEFAULT_PCC_STRUCT_RETURN 0
  108.  
  109. /*
  110.  * Some imports from svr4.h in support of shared libraries.
  111.  * Currently, we need the DECLARE_OBJECT_SIZE stuff.
  112.  */
  113.  
  114. /* Define the strings used for the special svr4 .type and .size directives.
  115.    These strings generally do not vary from one system running svr4 to
  116.    another, but if a given system (e.g. m88k running svr) needs to use
  117.    different pseudo-op names for these, they may be overridden in the
  118.    file which includes this one.  */
  119.  
  120. #define TYPE_ASM_OP    ".type"
  121. #define SIZE_ASM_OP    ".size"
  122. #define WEAK_ASM_OP    ".weak"
  123.  
  124. /* The following macro defines the format used to output the second
  125.    operand of the .type assembler directive.  Different svr4 assemblers
  126.    expect various different forms for this operand.  The one given here
  127.    is just a default.  You may need to override it in your machine-
  128.    specific tm.h file (depending upon the particulars of your assembler).  */
  129.  
  130. #define TYPE_OPERAND_FMT    "@%s"
  131.  
  132. /* Write the extra assembler code needed to declare a function's result.
  133.    Most svr4 assemblers don't require any special declaration of the
  134.    result value, but there are exceptions.  */
  135.  
  136. #ifndef ASM_DECLARE_RESULT
  137. #define ASM_DECLARE_RESULT(FILE, RESULT)
  138. #endif
  139.  
  140. /* These macros generate the special .type and .size directives which
  141.    are used to set the corresponding fields of the linker symbol table
  142.    entries in an ELF object file under SVR4.  These macros also output
  143.    the starting labels for the relevant functions/objects.  */
  144.  
  145. /* Write the extra assembler code needed to declare a function properly.
  146.    Some svr4 assemblers need to also have something extra said about the
  147.    function's return value.  We allow for that here.  */
  148.  
  149. #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL)            \
  150.   do {                                    \
  151.     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                \
  152.     assemble_name (FILE, NAME);                        \
  153.     putc (',', FILE);                            \
  154.     fprintf (FILE, TYPE_OPERAND_FMT, "function");            \
  155.     putc ('\n', FILE);                            \
  156.     ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL));            \
  157.     ASM_OUTPUT_LABEL(FILE, NAME);                    \
  158.   } while (0)
  159.  
  160. /* Write the extra assembler code needed to declare an object properly.  */
  161.  
  162. #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL)            \
  163.   do {                                    \
  164.     fprintf (FILE, "\t%s\t ", TYPE_ASM_OP);                \
  165.     assemble_name (FILE, NAME);                        \
  166.     putc (',', FILE);                            \
  167.     fprintf (FILE, TYPE_OPERAND_FMT, "object");                \
  168.     putc ('\n', FILE);                            \
  169.     size_directive_output = 0;                        \
  170.     if (!flag_inhibit_size_directive && DECL_SIZE (DECL))        \
  171.       {                                    \
  172.         size_directive_output = 1;                    \
  173.     fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                \
  174.     assemble_name (FILE, NAME);                    \
  175.     fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL)));    \
  176.       }                                    \
  177.     ASM_OUTPUT_LABEL(FILE, NAME);                    \
  178.   } while (0)
  179.  
  180. /* Output the size directive for a decl in rest_of_decl_compilation
  181.    in the case where we did not do so before the initializer.
  182.    Once we find the error_mark_node, we know that the value of
  183.    size_directive_output was set
  184.    by ASM_DECLARE_OBJECT_NAME when it was run for the same decl.  */
  185.  
  186. #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)        \
  187. do {                                                                    \
  188.      char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0);                  \
  189.      if (!flag_inhibit_size_directive && DECL_SIZE (DECL)            \
  190.          && ! AT_END && TOP_LEVEL                                       \
  191.          && DECL_INITIAL (DECL) == error_mark_node                      \
  192.          && !size_directive_output)                                     \
  193.        {                                                                \
  194.          fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                        \
  195.      assemble_name (FILE, name);                                    \
  196.      fprintf (FILE, ",%d\n",  int_size_in_bytes (TREE_TYPE (DECL)));\
  197.     }                                \
  198.    } while (0)
  199.  
  200.  
  201. /* This is how to declare the size of a function.  */
  202.  
  203. #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)            \
  204.   do {                                    \
  205.     if (!flag_inhibit_size_directive)                    \
  206.       {                                    \
  207.         char label[256];                        \
  208.     static int labelno;                        \
  209.     labelno++;                            \
  210.     ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno);        \
  211.     ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno);        \
  212.     fprintf (FILE, "\t%s\t ", SIZE_ASM_OP);                \
  213.     assemble_name (FILE, (FNAME));                    \
  214.         fprintf (FILE, ",");                        \
  215.     assemble_name (FILE, label);                    \
  216.         fprintf (FILE, "-");                        \
  217.     assemble_name (FILE, (FNAME));                    \
  218.     putc ('\n', FILE);                        \
  219.       }                                    \
  220.   } while (0)
  221.  
  222. #define ASM_SPEC   " %| %{fpic:-k} %{fPIC:-k}"
  223. #define LINK_SPEC \
  224.   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{static:-Bstatic} %{assert*}"
  225.  
  226. /* This section copied from i386/osfrose.h */
  227.  
  228. /* A C statement or compound statement to output to FILE some
  229.    assembler code to initialize basic-block profiling for the current
  230.    object module.  This code should call the subroutine
  231.    `__bb_init_func' once per object module, passing it as its sole
  232.    argument the address of a block allocated in the object module.
  233.  
  234.    The name of the block is a local symbol made with this statement:
  235.  
  236.     ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 0);
  237.  
  238.    Of course, since you are writing the definition of
  239.    `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  240.    can take a short cut in the definition of this macro and use the
  241.    name that you know will result.
  242.  
  243.    The first word of this block is a flag which will be nonzero if the
  244.    object module has already been initialized.  So test this word
  245.    first, and do not call `__bb_init_func' if the flag is nonzero.  */
  246.  
  247. #undef    FUNCTION_BLOCK_PROFILER
  248. #define FUNCTION_BLOCK_PROFILER(STREAM, LABELNO)            \
  249. do                                    \
  250.   {                                    \
  251.     if (!flag_pic)                            \
  252.       {                                    \
  253.     fprintf (STREAM, "\tcmpl $0,%sPBX0\n", LPREFIX);        \
  254.     fprintf (STREAM, "\tjne 0f\n");                    \
  255.     fprintf (STREAM, "\tpushl $%sPBX0\n", LPREFIX);            \
  256.     fprintf (STREAM, "\tcall ___bb_init_func\n");            \
  257.     fprintf (STREAM, "0:\n");                    \
  258.       }                                    \
  259.     else                                \
  260.       {                                    \
  261.     fprintf (STREAM, "\tpushl %eax\n");                \
  262.     fprintf (STREAM, "\tmovl %sPBX0@GOT(%ebx),%eax\n");        \
  263.     fprintf (STREAM, "\tcmpl $0,(%eax)\n");                \
  264.     fprintf (STREAM, "\tjne 0f\n");                    \
  265.     fprintf (STREAM, "\tpushl %eax\n");                \
  266.     fprintf (STREAM, "\tcall ___bb_init_func@PLT\n");        \
  267.     fprintf (STREAM, "0:\n");                    \
  268.     fprintf (STREAM, "\tpopl %eax\n");                \
  269.       }                                    \
  270.   }                                    \
  271. while (0)
  272.  
  273. /* A C statement or compound statement to increment the count
  274.    associated with the basic block number BLOCKNO.  Basic blocks are
  275.    numbered separately from zero within each compilation.  The count
  276.    associated with block number BLOCKNO is at index BLOCKNO in a
  277.    vector of words; the name of this array is a local symbol made
  278.    with this statement:
  279.  
  280.     ASM_GENERATE_INTERNAL_LABEL (BUFFER, "LPBX", 2);
  281.  
  282.    Of course, since you are writing the definition of
  283.    `ASM_GENERATE_INTERNAL_LABEL' as well as that of this macro, you
  284.    can take a short cut in the definition of this macro and use the
  285.    name that you know will result.  */
  286.  
  287. #undef    BLOCK_PROFILER
  288. #define BLOCK_PROFILER(STREAM, BLOCKNO)                    \
  289. do                                    \
  290.   {                                    \
  291.     if (!flag_pic)                            \
  292.       fprintf (STREAM, "\tincl %sPBX2+%d\n", LPREFIX, (BLOCKNO)*4);    \
  293.     else                                \
  294.       {                                    \
  295.     fprintf (STREAM, "\tpushl %eax\n");                \
  296.     fprintf (STREAM, "\tmovl %sPBX2@GOT(%ebx),%eax\n", LPREFIX);    \
  297.     fprintf (STREAM, "\tincl %d(%eax)\n", (BLOCKNO)*4);        \
  298.     fprintf (STREAM, "\tpopl %eax\n");                \
  299.       }                                    \
  300.   }                                    \
  301. while (0)
  302.  
  303. /* This is defined when gcc is compiled in the BSD-directory-tree, and must
  304.  * make up for the gap to all the stuff done in the GNU-makefiles.
  305.  */
  306.  
  307. #ifdef FREEBSD_NATIVE
  308.  
  309. #undef MD_EXEC_PREFIX
  310. #define MD_EXEC_PREFIX "/usr/libexec/"
  311.  
  312. #undef STANDARD_STARTFILE_PREFIX
  313. #define STANDARD_STARTFILE_PREFIX "/usr/lib"
  314.  
  315. #define DEFAULT_TARGET_MACHINE "i386-unknown-freebsd_1.0"
  316. #define GPLUSPLUS_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
  317. #define TOOL_INCLUDE_DIR "/usr/local/i386-unknown-freebsd_1.0/include"
  318. #define GCC_INCLUDE_DIR "/usr/local/lib/gcc-lib/i386-unknown-freebsd_1.0/2.5.8/include"
  319.  
  320. #endif /* FREEBSD_NATIVE */
  321.