home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update20.zoo / gcc / tm-atari.h < prev   
Encoding:
C/C++ Source or Header  |  1992-04-19  |  12.3 KB  |  439 lines

  1. /* Definitions of target machine for GNU compiler.  atariST/TT version.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* The following Macros control the compilation
  21.  *
  22.  *    CROSSATARI    defined when making cross compiler for TOS or Minix
  23.  *    MINIX        defined when making cross compiler for MINIX only
  24.  *    atariminix    defined when making compiler for MINIX
  25.  *    atarist        defined when making compiler for TOS
  26.  */
  27.  
  28. #include "m68k.h"
  29.  
  30. #if defined(__GNUC__)
  31. #  if defined(alloca)
  32. #    undef alloca
  33. #  endif
  34. #  define alloca(x) __builtin_alloca(x)
  35. #endif
  36.  
  37. #if defined(sparc)
  38. # if !defined(alloca)
  39. #    include <alloca.h>
  40. # endif
  41. #endif
  42.  
  43. /* See m68k.h.  0 means 68000 with no 68881.  */
  44.  
  45. #define TARGET_DEFAULT 0    /* use this for a regular ST       */
  46. /* #define TARGET_DEFAULT 2    use this for a ST with 68881/82    */
  47. /* #define TARGET_DEFAULT 5    use this for a TT withOUT 68881/82 */
  48. /* #define TARGET_DEFAULT 7    use this for a TT with 68881/82    */
  49. /* #define TARGET_DEFAULT 0407  use this for a Falcon           */
  50. /*          may be vaporware but we are ready for it. yeah!! */
  51.       /* USE this for a 68040, when -m68040 is specified. In this
  52.          mode, the 881/2 instructions not on the 040 are not produced
  53.          see TARGET_68040 in m68k.h
  54.          (also note the difference vs TARGET_68040_ONLY) */
  55.  
  56. /* #define TARGET_DEFAULT 01000 use this for 68040_ONLY, dont know what
  57.                     this is useful for */
  58.  
  59.  
  60. /* These compiler options take an argument.  We ignore -target for now.  */
  61.  
  62. #define WORD_SWITCH_TAKES_ARG(STR)                \
  63.  (!strcmp (STR, "Tdata") || !strcmp (STR, "include")        \
  64.   || !strcmp (STR, "imacros") || !strcmp (STR, "target")    \
  65.   || !strcmp (STR, "assert"))
  66.  
  67. /* -m68040-only requires special flags to assembler  */
  68. /* -m68020 requires special flags to the assembler.  */
  69.  
  70. /* -m68000 (on atari) need this flag to assembler, otherwise pc relative
  71.    code is produced where it should not be (in places where the
  72.    68000 only allows data ALTERABLE addressing modes) (++jrb 03/19/89) */
  73.  
  74. #if (TARGET_DEFAULT & 01000)
  75. /* note atleast gas-1.38 Patchlevel 2 required for mc68040 specific
  76.    support in the assembler.
  77.  */
  78. #define ASM_SPEC \
  79.  "%{m68000:-mc68000}%{mc68000:-mc68000} \
  80.   %{!mc68000:%{!m68000:\
  81.                   %{mc68020:-mc68020}%{m68020:-mc68020} \
  82.                   %{!mc68020:%{!m68020:\
  83.             %{mc68040:-mc68020}%{m68040:-mc68020} \
  84.             %{!mc68040:%{!m68040:-mc68040}} \
  85.                   }} \
  86.               }}"
  87. #else 
  88. /* falcon/TT */
  89. #if (TARGET_DEFAULT & 5) /* note this is true for TARGET_DEFAULT == 0407 too */
  90. /* for the TT etc (020/030) also appropriate for m68040 (falcon)
  91.    ie: -m68040 (and not -m68040-only). Note that the
  92.    assembler does not need any special indication of the 040
  93.    when -m68040, only needs -mc68020. the only time
  94.    the assembler needs -mc68040 is when -m68040-only
  95.  */
  96. #define ASM_SPEC \
  97.  "%{m68000:-mc68000}%{mc68000:-mc68000} \
  98.   %{!mc68000:%{!m68000:\
  99.                   %{m68040-only:-mc68040}%{mc68040-only:-mc68040} \
  100.                   %{!m68040-only:%{!mc68040-only:-mc68020}} \
  101.           }}"
  102. #else
  103. /* for a regular 68k ST */
  104. #define ASM_SPEC \
  105.  "%{m68040-only:-mc68040}%{mc68040-only:-mc68040} \
  106.   %{!m68040-only:%{!mc68040-only:\
  107.                       %{m68020:-mc68020}%{mc68020:-mc68020} \
  108.                       %{!mc68020:%{!m68020:-mc68000}} \
  109.           }}"
  110. #endif /* TT /falcon */
  111. #endif /* m68040-only */
  112.  
  113. /* Names to predefine in the preprocessor for this target machine.  */
  114.  
  115. #if (defined(MINIX) || defined(atariminix))
  116. #  if (TARGET_DEFAULT & 5)
  117. #    if(TARGET_DEFAULT & 2)
  118. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DATARI_TT -DM68881"
  119. #    else
  120. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DATARI_TT"
  121. #    endif
  122. #  else
  123. #    if(TARGET_DEFAULT & 2)
  124. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DM68881"
  125. #    else
  126. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k"
  127. #    endif
  128. #  endif
  129. #else
  130. #  if (TARGET_DEFAULT & 5)
  131. #    if(TARGET_DEFAULT & 2)
  132. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -Dataritt -DM68881"
  133. #    else
  134. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -Dataritt"
  135. #    endif
  136. #  else
  137. #    if(TARGET_DEFAULT & 2)
  138. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -DM68881"
  139. #    else
  140. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k"
  141. #    endif
  142. #  endif
  143. #endif
  144.  
  145. #define PTRDIFF_TYPE "long int"
  146. #define SIZE_TYPE "long unsigned int"
  147. #undef WCHAR_TYPE
  148. #undef WCHAR_TYPE_SIZE
  149. #define WCHAR_TYPE "int"
  150. #define WCHAR_TYPE_SIZE 32 /* just for building the compiler */
  151.  
  152. /* default exec dir */
  153. #ifndef STANDARD_EXEC_PREFIX
  154. #  ifdef MINIX
  155. #    define STANDARD_EXEC_PREFIX CROSSDIR "/lib/gcc-"
  156. #  else
  157. #    ifdef atariminix
  158. #      define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-"
  159. #    else
  160. #      define STANDARD_EXEC_PREFIX CROSSDIR "/lib/gcc-"
  161. #    endif
  162. #  endif
  163. #endif
  164.  
  165. #define STANDARD_STARTFILE_PREFIX ""
  166. #define EXECUTABLE_SUFFIX ".ttp"
  167.  
  168. /* Alignment of field after `int : 0' in a structure.  */
  169. /* recent gcc's have this as 16, this is left in for the benfit of */
  170.  /* older gcc */
  171. #undef EMPTY_FIELD_BOUNDARY
  172. #define EMPTY_FIELD_BOUNDARY 16
  173.  
  174. /* Every structure or union's size must be a multiple of 2 bytes.  */
  175.  
  176. #undef STRUCTURE_SIZE_BOUNDARY
  177. #define STRUCTURE_SIZE_BOUNDARY 16
  178.  
  179. #define DBX_DEBUGGING_INFO 1
  180.  
  181. #ifndef HAVE_VPRINTF
  182. #define HAVE_VPRINTF 1
  183. #endif
  184.  
  185. #ifdef abort
  186. #undef abort
  187. #define abort fancy_abort
  188. #endif
  189.  
  190.  
  191. /* the following stolen from tm-sun3.h, they seem to work better */
  192. /* This is how to output an assembler line defining a `double' constant.  */
  193.  
  194. /* fake out isinf for !sun for now */
  195. #ifndef sun
  196. #define isinf(X) (0)
  197. #endif
  198.  
  199. #define double_is_minus_zero(X)    ((X) == -0.0)
  200.  
  201. #undef ASM_OUTPUT_DOUBLE
  202. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  203.   (isinf ((VALUE))                            \
  204.    ? fprintf (FILE, "\t.double 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
  205.    : double_is_minus_zero ((VALUE))                    \
  206.    ? fprintf (FILE, "\t.long 0x80000000,0\n")                \
  207.    : fprintf (FILE, "\t.double 0r%.20e\n", (VALUE)))
  208.  
  209. /* This is how to output an assembler line defining a `float' constant.  */
  210.  
  211. #undef ASM_OUTPUT_FLOAT
  212. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  213.   (isinf ((VALUE))                            \
  214.    ? fprintf (FILE, "\t.single 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
  215.    : double_is_minus_zero ((VALUE))                    \
  216.    ? fprintf (FILE, "\t.long 0x80000000\n")                \
  217.    : fprintf (FILE, "\t.single 0r%.20e\n", (VALUE)))
  218.  
  219. #undef ASM_OUTPUT_FLOAT_OPERAND
  220. #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)                \
  221.   (isinf ((VALUE))                            \
  222.    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-"))         \
  223.    : double_is_minus_zero ((VALUE))                    \
  224.    ? fprintf (FILE, "#0r-0.0")                        \
  225.    : fprintf (FILE, "#0r%.9g", (VALUE)))
  226.  
  227. #undef ASM_OUTPUT_DOUBLE_OPERAND
  228. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  229.   (isinf ((VALUE))                            \
  230.    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-"))        \
  231.    : double_is_minus_zero ((VALUE))                    \
  232.    ? fprintf (FILE, "#0r-0.0")                        \
  233.    : fprintf (FILE, "#0r%.20g", (VALUE)))
  234.  
  235.  
  236. /* specs for start file and link specs */
  237.  
  238. #ifndef CROSSATARI
  239.  
  240. #ifdef atariminix
  241. #define STARTFILE_SPEC  \
  242.   "%{pg:/usr/local/lib/gcrtso.o%s}\
  243.    %{!pg:\
  244.          %{p:/usr/local/lib/mcrtso.o%s}\
  245.          %{!p:/usr/local/lib/crtso.o%s}}"
  246. #else /* atarist */
  247. #define STARTFILE_SPEC  \
  248.  "%{mint:\
  249.      %{pg:$GNULIB$\\mgcrt0.o%s}\
  250.      %{!pg:\
  251.          %{p:$GNULIB$\\mmcrt0.o%s}\
  252.          %{!p:$GNULIB$\\mcrt0.o%s}}}\
  253. \
  254.   %{!mint:\
  255.      %{pg:$GNULIB$\\gcrt0.o%s}\
  256.      %{!pg:\
  257.          %{p:$GNULIB$\\mcrt0.o%s}\
  258.          %{!p:$GNULIB$\\crt0.o%s}}}"
  259. #endif
  260.  
  261. #else    /* CROSSATARI */
  262.  
  263. #ifdef MINIX
  264. #define STARTFILE_SPEC  \
  265.   "%{pg:" CROSSDIR "/lib/gcrtso.o%s}\
  266.    %{!pg:\
  267.          %{p:" CROSSDIR "/lib/mcrtso.o%s}\
  268.          %{!p:" CROSSDIR "/lib/crtso.o%s}}"
  269. #else
  270. #define STARTFILE_SPEC  \
  271.   "%{mint:\
  272.       %{pg:" CROSSDIR "/lib/mgcrt0.o%s}\
  273.       %{!pg:\
  274.              %{p:" CROSSDIR "/lib/mmcrt0.o%s}\
  275.              %{!p:" CROSSDIR "/lib/mcrt0.o%s}}}\
  276. \
  277.   %{!mint:\
  278.       %{pg:" CROSSDIR "/lib/gcrt0.o%s}\
  279.       %{!pg:\
  280.              %{p:" CROSSDIR "/lib/mcrt0.o%s}\
  281.              %{!p:" CROSSDIR "/lib/crt0.o%s}}}"
  282. #endif
  283. #endif /* CROSSATARI */
  284.  
  285. /* NOTE: for ataris we dont need to do anything special for -a or -tcov
  286.    as bb_* routines will automatically be pulled in from the libraries
  287.    as required when they are referenced by the generated code.
  288.  */
  289.  
  290. #ifdef MINIX
  291. #define LIB_SPEC \
  292.   "%{mshort:" CROSSDIR "/lib/libc.a}\
  293.    %{!mshort:" CROSSDIR "/lib/libc32.a}"
  294. #else
  295. #ifdef atariminix
  296. #define LIB_SPEC \
  297.   "%{mshort:/usr/local/lib/libc.a}\
  298.    %{!mshort:/usr/local/lib/libc32.a}"
  299. #else /* atarist cross or native */
  300.  
  301. #ifndef __GPLUSPLUS__
  302. #define LIB_SPEC \
  303.  "%{mint:\
  304.    %{!gg:\
  305.          %{mshort:-lmint16 -lgnu16}\
  306.          %{!mshort:-lmint -lgnu}}\
  307.     %{gg:\
  308.          %{mshort:-lmintg16 -lgnugdb16}\
  309.          %{!mshort:-lmintg -lgnugdb}}}\
  310. \
  311.   %{!mint:\
  312.    %{!gg:\
  313.          %{mshort:-lgnu16}\
  314.          %{!mshort:-lgnu}}\
  315.     %{gg:\
  316.          %{mshort:-lgnugdb16}\
  317.          %{!mshort:-lgnugdb}}}"
  318.  
  319. #else /* atariSt g++ */
  320.  
  321. #define LIB_SPEC \
  322.  "%{mint:\
  323.    %{!gg:\
  324.          %{mshort:-lmint16 -lg++16 -lgnu16}\
  325.          %{!mshort:-lmint -lg++ -lgnu}}\
  326.     %{gg:\
  327.          %{mshort:-lmintg16 -lg++gdb16 -lgnugdb16}\
  328.          %{!mshort:-lmintg -lg++gdb -lgnugdb}}}\
  329. \
  330.   %{!mint:\
  331.    %{!gg:\
  332.          %{mshort:-lg++16 -lgnu16}\
  333.          %{!mshort:-lg++ -lgnu}}\
  334.     %{gg:\
  335.          %{mshort:-lg++gdb16 -lgnugdb16}\
  336.          %{!mshort:-lg++gdb -lgnugdb}}}"
  337. #endif
  338.  
  339. #endif
  340. #endif
  341.  
  342. /* add -mint : meanining
  343.    pre-procees with -D__MINT__
  344.    compile with -mint    (target_flags & 02000) (this flag is
  345.      currently not used by cc1, but maybe later)
  346.    link with mcrt0.o and -lmint -lgnu
  347.    
  348.  */
  349. #undef TARGET_SWITCHES
  350. #define TARGET_SWITCHES  \
  351.   { { "68020", 5},                \
  352.     { "c68020", 5},                \
  353.     { "68881", 2},                \
  354.     { "bitfield", 4},                \
  355.     { "68000", -5},                \
  356.     { "c68000", -5},                \
  357.     { "soft-float", -0102},            \
  358.     { "nobitfield", -4},            \
  359.     { "rtd", 8},                \
  360.     { "nortd", -8},                \
  361.     { "short", 040},                \
  362.     { "noshort", -040},                \
  363.     { "fpa", 0100},                \
  364.     { "nofpa", -0100},                \
  365.     { "sky", 0200},                \
  366.     { "nosky", -0200},                \
  367.     { "68040", 0407},                \
  368.     { "68030", -01400},                \
  369.     { "68030", 7},                \
  370.     { "68040-only", 01000},            \
  371.     { "int", 02000},                \
  372.     { "noint", -02000},                \
  373.     { "", TARGET_DEFAULT}}
  374.  
  375. #ifdef atarist
  376. #  ifdef ASM_OUTPUT_SOURCE_FILENAME
  377. #    undef ASM_OUTPUT_SOURCE_FILENAME
  378. #  endif
  379. #  define  ASM_OUTPUT_SOURCE_FILENAME(file, filename)     \
  380.     fprintf (file, "\t.stabs \"");         \
  381.         atari_output_filename(file, filename);        \
  382.     fprintf(file, "\",%d,0,0,Ltext\n", N_SOL)
  383. #endif
  384.  
  385. #ifndef ASM_COMMENT_START
  386. #define ASM_COMMENT_START " | "
  387. #endif
  388.  
  389. /* these two should never be used, #define them here so they are'nt
  390.    in cccp.c
  391. */
  392. #define STANDARD_INCLUDE_DIR    8086_sucks
  393. #define LOCAL_INCLUDE_DIR    80486_sucks
  394.  
  395. /* all the INCLUDE_DEFAULTS */
  396. #ifdef CROSSATARI    /* TOS or MINIX cross compiler */
  397. #ifndef SYSTEM_INCLUDE_DIR
  398. #  define SYSTEM_INCLUDE_DIR        CROSSINC
  399. #endif
  400. #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
  401. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    GPLUSPLUS_INCLUDE_DIR
  402. #endif
  403. #endif
  404.  
  405. #ifdef atarist        /* TOS native compiler */
  406. #ifndef SYSTEM_INCLUDE_DIR
  407. #  define SYSTEM_INCLUDE_DIR        "\\gnu\\lib"
  408. #endif
  409. #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
  410. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    "\\gnu\\g++-inc"
  411. #endif
  412. #endif
  413.  
  414. #ifdef atariminix    /* MINIX native compiler */
  415. #ifndef SYSTEM_INCLUDE_DIR
  416. #  define SYSTEM_INCLUDE_DIR        "/usr/local/gcc-include"
  417. #endif
  418. #ifndef SYSTEM_GPLUSPLUS_INCLUDE_DIR
  419. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    "/usr/local/g++-inc"
  420. #endif
  421. #endif
  422.  
  423. #define INCLUDE_DEFAULTS            \
  424.     {                        \
  425.           { SYSTEM_INCLUDE_DIR, 0 },        \
  426.           { SYSTEM_GPLUSPLUS_INCLUDE_DIR, 1 },  \
  427.           { 0, 0 }                \
  428.     }
  429.  
  430. #ifdef atarist
  431. void atari_output_filename();
  432. #endif
  433.  
  434. #ifdef atarist
  435. #define FILE_NAME_NONDIRECTORY(X)        \
  436.     atari_filename_nondirectory(X);
  437. extern char *atari_filename_nondirectory();
  438. #endif
  439.