OSDN Git Service

2002-04-02 David O'Brien <obrien@FreeBSD.org>
[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, 2002 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 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
25
26 /* The svr4 ABI for the i386 says that records and unions are returned
27    in memory.  */
28
29 #undef RETURN_IN_MEMORY
30 #define RETURN_IN_MEMORY(TYPE) \
31   (TYPE_MODE (TYPE) == BLKmode \
32    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
33
34 /* Define which macros to predefine.  __svr4__ is our extension.  */
35 /* This used to define X86, but james@bigtex.cactus.org says that
36    is supposed to be defined optionally by user programs--not by default.  */
37 #define CPP_PREDEFINES \
38   "-Dunix -D__svr4__ -Asystem=unix -Asystem=svr4"
39
40 /* Output at beginning of assembler file.  */
41 /* The .file command should always begin the output.  */
42
43 #undef ASM_FILE_START
44 #define ASM_FILE_START(FILE)                                            \
45   do {                                                                  \
46         output_file_directive (FILE, main_input_filename);              \
47         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
48   } while (0)
49
50 #undef DBX_REGISTER_NUMBER
51 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
52
53 /* The routine used to output sequences of byte values.  We use a special
54    version of this for most svr4 targets because doing so makes the
55    generated assembly code more compact (and thus faster to assemble)
56    as well as more readable.  Note that if we find subparts of the
57    character sequence which end with NUL (and which are shorter than
58    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
59
60 #undef ASM_OUTPUT_ASCII
61 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
62   do                                                                    \
63     {                                                                   \
64       register const unsigned char *_ascii_bytes =                      \
65         (const unsigned char *) (STR);                                  \
66       register const unsigned char *limit = _ascii_bytes + (LENGTH);    \
67       register unsigned bytes_in_chunk = 0;                             \
68       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
69         {                                                               \
70           register const unsigned char *p;                              \
71           if (bytes_in_chunk >= 64)                                     \
72             {                                                           \
73               fputc ('\n', (FILE));                                     \
74               bytes_in_chunk = 0;                                       \
75             }                                                           \
76           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
77             continue;                                                   \
78           if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)   \
79             {                                                           \
80               if (bytes_in_chunk > 0)                                   \
81                 {                                                       \
82                   fputc ('\n', (FILE));                                 \
83                   bytes_in_chunk = 0;                                   \
84                 }                                                       \
85               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
86               _ascii_bytes = p;                                         \
87             }                                                           \
88           else                                                          \
89             {                                                           \
90               if (bytes_in_chunk == 0)                                  \
91                 fprintf ((FILE), "\t.byte\t");                          \
92               else                                                      \
93                 fputc (',', (FILE));                                    \
94               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
95               bytes_in_chunk += 5;                                      \
96             }                                                           \
97         }                                                               \
98       if (bytes_in_chunk > 0)                                           \
99         fprintf ((FILE), "\n");                                         \
100     }                                                                   \
101   while (0)
102
103 /* A C statement (sans semicolon) to output to the stdio stream
104    FILE the assembler definition of uninitialized global DECL named
105    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
106    Try to use asm_output_aligned_bss to implement this macro.  */
107
108 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
109   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
110
111 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
112    indirect are handled automatically.  */
113 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
114   do {                                                                  \
115     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
116       {                                                                 \
117         fputs (ASM_LONG, FILE);                                         \
118         assemble_name (FILE, XSTR (ADDR, 0));                           \
119         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
120         goto DONE;                                                      \
121       }                                                                 \
122   } while (0)
123
124 /* Used by crtstuff.c to initialize the base of data-relative relocations.
125    These are GOT relative on x86, so return the pic register.  */
126 #ifdef __PIC__
127 #define CRT_GET_RFIB_DATA(BASE)                 \
128   {                                             \
129     register void *ebx_ __asm__("ebx");         \
130     BASE = ebx_;                                \
131   }
132 #else
133 #define CRT_GET_RFIB_DATA(BASE)                                         \
134   __asm__ ("call\t.LPR%=\n"                                             \
135            ".LPR%=:\n\t"                                                \
136            "popl\t%0\n\t"                                               \
137            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
138               smaller than the traditional EBX, which results in the    \
139               offset being off by one.  */                              \
140            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
141            : "=d"(BASE))
142 #endif
143
144 #undef CPP_SPEC
145 #define CPP_SPEC "%(cpp_cpu)"