OSDN Git Service

* i386/386bsd.h, i386/beos-pe.h, i386/bsd386.h, i386/crtdll.h,
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / sysv4.h
1 /* Target definitions for GNU compiler for Intel 80386 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 "i386/i386.h"  /* Base i386 target machine definitions */
24 #include "i386/att.h"   /* Use the i386 AT&T assembler syntax */
25 #include "svr4.h"       /* Definitions common to all SVR4 targets */
26
27 #undef TARGET_VERSION
28 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
29
30 /* The svr4 ABI for the i386 says that records and unions are returned
31    in memory.  */
32
33 #undef RETURN_IN_MEMORY
34 #define RETURN_IN_MEMORY(TYPE) \
35   (TYPE_MODE (TYPE) == BLKmode)
36
37 /* Define which macros to predefine.  __svr4__ is our extension.  */
38 /* This used to define X86, but james@bigtex.cactus.org says that
39    is supposed to be defined optionally by user programs--not by default.  */
40 #define CPP_PREDEFINES \
41   "-Dunix -D__svr4__ -Asystem(unix) -Asystem(svr4)"
42
43 /* This is how to output assembly code to define a `float' constant.
44    We always have to use a .long pseudo-op to do this because the native
45    SVR4 ELF assembler is buggy and it generates incorrect values when we
46    try to use the .float pseudo-op instead.  */
47
48 #undef ASM_OUTPUT_FLOAT
49 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
50 do { long value;                                                        \
51      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                      \
52      if (sizeof (int) == sizeof (long))                                 \
53          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value);                \
54      else                                                               \
55          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value);               \
56    } while (0)
57
58 /* This is how to output assembly code to define a `double' constant.
59    We always have to use a pair of .long pseudo-ops to do this because
60    the native SVR4 ELF assembler is buggy and it generates incorrect
61    values when we try to use the .double pseudo-op instead.  */
62
63 #undef ASM_OUTPUT_DOUBLE
64 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
65 do { long value[2];                                                     \
66      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                      \
67      if (sizeof (int) == sizeof (long))                                 \
68        {                                                                \
69          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
70          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
71        }                                                                \
72      else                                                               \
73        {                                                                \
74          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
75          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
76        }                                                                \
77    } while (0)
78
79
80 #undef ASM_OUTPUT_LONG_DOUBLE
81 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
82 do { long value[3];                                                     \
83      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                 \
84      if (sizeof (int) == sizeof (long))                                 \
85        {                                                                \
86          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);             \
87          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);             \
88          fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[2]);             \
89        }                                                                \
90      else                                                               \
91        {                                                                \
92          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);            \
93          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);            \
94          fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[2]);            \
95        }                                                                \
96    } while (0)
97
98 /* Output at beginning of assembler file.  */
99 /* The .file command should always begin the output.  */
100
101 #undef ASM_FILE_START
102 #define ASM_FILE_START(FILE)                                            \
103   do {                                                                  \
104         output_file_directive (FILE, main_input_filename);              \
105         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
106   } while (0)
107
108 #undef DBX_REGISTER_NUMBER
109 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
110
111 /* The routine used to output sequences of byte values.  We use a special
112    version of this for most svr4 targets because doing so makes the
113    generated assembly code more compact (and thus faster to assemble)
114    as well as more readable.  Note that if we find subparts of the
115    character sequence which end with NUL (and which are shorter than
116    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
117
118 #undef ASM_OUTPUT_ASCII
119 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
120   do                                                                    \
121     {                                                                   \
122       register unsigned char *_ascii_bytes = (unsigned char *) (STR);   \
123       register unsigned char *limit = _ascii_bytes + (LENGTH);          \
124       register unsigned bytes_in_chunk = 0;                             \
125       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
126         {                                                               \
127           register unsigned char *p;                                    \
128           if (bytes_in_chunk >= 64)                                     \
129             {                                                           \
130               fputc ('\n', (FILE));                                     \
131               bytes_in_chunk = 0;                                       \
132             }                                                           \
133           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
134             continue;                                                   \
135           if (p < limit && (p - _ascii_bytes) <= STRING_LIMIT)          \
136             {                                                           \
137               if (bytes_in_chunk > 0)                                   \
138                 {                                                       \
139                   fputc ('\n', (FILE));                                 \
140                   bytes_in_chunk = 0;                                   \
141                 }                                                       \
142               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
143               _ascii_bytes = p;                                         \
144             }                                                           \
145           else                                                          \
146             {                                                           \
147               if (bytes_in_chunk == 0)                                  \
148                 fprintf ((FILE), "\t.byte\t");                          \
149               else                                                      \
150                 fputc (',', (FILE));                                    \
151               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
152               bytes_in_chunk += 5;                                      \
153             }                                                           \
154         }                                                               \
155       if (bytes_in_chunk > 0)                                           \
156         fprintf ((FILE), "\n");                                         \
157     }                                                                   \
158   while (0)
159
160 /* This is how to output an element of a case-vector that is relative.
161    This is only used for PIC code.  See comments by the `casesi' insn in
162    i386.md for an explanation of the expression this outputs. */
163
164 #undef ASM_OUTPUT_ADDR_DIFF_ELT
165 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
166   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
167
168 /* Indicate that jump tables go in the text section.  This is
169    necessary when compiling PIC code.  */
170
171 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
172
173 /* A C statement (sans semicolon) to output to the stdio stream
174    FILE the assembler definition of uninitialized global DECL named
175    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
176    Try to use asm_output_aligned_bss to implement this macro.  */
177
178 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
179   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)