OSDN Git Service

* clipper/clix.h (ASM_OUTPUT_ASCII): Avoid signed/unsigned
[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, 2001 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
24 #undef TARGET_VERSION
25 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
26
27 /* The svr4 ABI for the i386 says that records and unions are returned
28    in memory.  */
29
30 #undef RETURN_IN_MEMORY
31 #define RETURN_IN_MEMORY(TYPE) \
32   (TYPE_MODE (TYPE) == BLKmode \
33    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
34
35 /* Define which macros to predefine.  __svr4__ is our extension.  */
36 /* This used to define X86, but james@bigtex.cactus.org says that
37    is supposed to be defined optionally by user programs--not by default.  */
38 #define CPP_PREDEFINES \
39   "-Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
40
41 /* This is how to output assembly code to define a `float' constant.
42    We always have to use a .long pseudo-op to do this because the native
43    SVR4 ELF assembler is buggy and it generates incorrect values when we
44    try to use the .float pseudo-op instead.  */
45
46 #undef ASM_OUTPUT_FLOAT
47 #define ASM_OUTPUT_FLOAT(FILE,VALUE)                                    \
48 do { long value;                                                        \
49      REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);                      \
50      if (sizeof (int) == sizeof (long))                                 \
51          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value);            \
52      else                                                               \
53          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value);                 \
54    } while (0)
55
56 /* This is how to output assembly code to define a `double' constant.
57    We always have to use a pair of .long pseudo-ops to do this because
58    the native SVR4 ELF assembler is buggy and it generates incorrect
59    values when we try to use the .double pseudo-op instead.  */
60
61 #undef ASM_OUTPUT_DOUBLE
62 #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                                   \
63 do { long value[2];                                                     \
64      REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);                      \
65      if (sizeof (int) == sizeof (long))                                 \
66        {                                                                \
67          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]);         \
68          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]);         \
69        }                                                                \
70      else                                                               \
71        {                                                                \
72          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]);              \
73          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]);              \
74        }                                                                \
75    } while (0)
76
77
78 #undef ASM_OUTPUT_LONG_DOUBLE
79 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)                              \
80 do { long value[3];                                                     \
81      REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value);                 \
82      if (sizeof (int) == sizeof (long))                                 \
83        {                                                                \
84          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]);         \
85          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]);         \
86          fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[2]);         \
87        }                                                                \
88      else                                                               \
89        {                                                                \
90          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]);              \
91          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]);              \
92          fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[2]);              \
93        }                                                                \
94    } while (0)
95
96 /* Output at beginning of assembler file.  */
97 /* The .file command should always begin the output.  */
98
99 #undef ASM_FILE_START
100 #define ASM_FILE_START(FILE)                                            \
101   do {                                                                  \
102         output_file_directive (FILE, main_input_filename);              \
103         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
104   } while (0)
105
106 #undef DBX_REGISTER_NUMBER
107 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
108
109 /* The routine used to output sequences of byte values.  We use a special
110    version of this for most svr4 targets because doing so makes the
111    generated assembly code more compact (and thus faster to assemble)
112    as well as more readable.  Note that if we find subparts of the
113    character sequence which end with NUL (and which are shorter than
114    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
115
116 #undef ASM_OUTPUT_ASCII
117 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
118   do                                                                    \
119     {                                                                   \
120       register const unsigned char *_ascii_bytes =                      \
121         (const unsigned char *) (STR);                                  \
122       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
123       register unsigned bytes_in_chunk = 0;                             \
124       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
125         {                                                               \
126           register const unsigned char *p;                              \
127           if (bytes_in_chunk >= 64)                                     \
128             {                                                           \
129               fputc ('\n', (FILE));                                     \
130               bytes_in_chunk = 0;                                       \
131             }                                                           \
132           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
133             continue;                                                   \
134           if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)   \
135             {                                                           \
136               if (bytes_in_chunk > 0)                                   \
137                 {                                                       \
138                   fputc ('\n', (FILE));                                 \
139                   bytes_in_chunk = 0;                                   \
140                 }                                                       \
141               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
142               _ascii_bytes = p;                                         \
143             }                                                           \
144           else                                                          \
145             {                                                           \
146               if (bytes_in_chunk == 0)                                  \
147                 fprintf ((FILE), "\t.byte\t");                          \
148               else                                                      \
149                 fputc (',', (FILE));                                    \
150               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
151               bytes_in_chunk += 5;                                      \
152             }                                                           \
153         }                                                               \
154       if (bytes_in_chunk > 0)                                           \
155         fprintf ((FILE), "\n");                                         \
156     }                                                                   \
157   while (0)
158
159 /* A C statement (sans semicolon) to output to the stdio stream
160    FILE the assembler definition of uninitialized global DECL named
161    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
162    Try to use asm_output_aligned_bss to implement this macro.  */
163
164 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
165   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
166
167 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
168    indirect are handled automatically.  */
169 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
170   do {                                                                  \
171     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
172       {                                                                 \
173         fputs (UNALIGNED_INT_ASM_OP, FILE);                             \
174         assemble_name (FILE, XSTR (ADDR, 0));                           \
175         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
176         goto DONE;                                                      \
177       }                                                                 \
178   } while (0)
179
180 /* Used by crtstuff.c to initialize the base of data-relative relocations.
181    These are GOT relative on x86, so return the pic register.  */
182 #ifdef __PIC__
183 #define CRT_GET_RFIB_DATA(BASE)                 \
184   {                                             \
185     register void *ebx_ __asm__("ebx");         \
186     BASE = ebx_;                                \
187   }
188 #else
189 #define CRT_GET_RFIB_DATA(BASE)                                         \
190   __asm__ ("call\t.LPR%=\n"                                             \
191            ".LPR%=:\n\t"                                                \
192            "popl\t%0\n\t"                                               \
193            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
194               smaller than the traditional EBX, which results in the    \
195               offset being off by one.  */                              \
196            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
197            : "=d"(BASE))
198 #endif