OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / sysv4.h
1 /* Target definitions for GCC for Intel 80386 running System V.4
2    Copyright (C) 1991, 2001, 2002, 2007 Free Software Foundation, Inc.
3
4    Written by Ron Guilmette (rfg@netcom.com).
5
6 This file is part of GCC.
7
8 GCC 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 3, or (at your option)
11 any later version.
12
13 GCC 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 GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22
23 #define TARGET_VERSION fprintf (stderr, " (i386 System V Release 4)");
24
25 /* The svr4 ABI for the i386 says that records and unions are returned
26    in memory.  */
27
28 #undef RETURN_IN_MEMORY
29 #define RETURN_IN_MEMORY(TYPE) \
30   (TYPE_MODE (TYPE) == BLKmode \
31    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
32
33 /* Output at beginning of assembler file.  */
34 /* The .file command should always begin the output.  */
35
36 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
37 #undef X86_FILE_START_VERSION_DIRECTIVE
38 #define X86_FILE_START_VERSION_DIRECTIVE true
39
40 #undef DBX_REGISTER_NUMBER
41 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
42
43 /* The routine used to output sequences of byte values.  We use a special
44    version of this for most svr4 targets because doing so makes the
45    generated assembly code more compact (and thus faster to assemble)
46    as well as more readable.  Note that if we find subparts of the
47    character sequence which end with NUL (and which are shorter than
48    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
49
50 #undef ASM_OUTPUT_ASCII
51 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
52   do                                                                    \
53     {                                                                   \
54       const unsigned char *_ascii_bytes =                               \
55         (const unsigned char *) (STR);                                  \
56       const unsigned char *limit = _ascii_bytes + (LENGTH);             \
57       unsigned bytes_in_chunk = 0;                                      \
58       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
59         {                                                               \
60           const unsigned char *p;                                       \
61           if (bytes_in_chunk >= 64)                                     \
62             {                                                           \
63               fputc ('\n', (FILE));                                     \
64               bytes_in_chunk = 0;                                       \
65             }                                                           \
66           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
67             continue;                                                   \
68           if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)   \
69             {                                                           \
70               if (bytes_in_chunk > 0)                                   \
71                 {                                                       \
72                   fputc ('\n', (FILE));                                 \
73                   bytes_in_chunk = 0;                                   \
74                 }                                                       \
75               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
76               _ascii_bytes = p;                                         \
77             }                                                           \
78           else                                                          \
79             {                                                           \
80               if (bytes_in_chunk == 0)                                  \
81                 fprintf ((FILE), "\t.byte\t");                          \
82               else                                                      \
83                 fputc (',', (FILE));                                    \
84               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
85               bytes_in_chunk += 5;                                      \
86             }                                                           \
87         }                                                               \
88       if (bytes_in_chunk > 0)                                           \
89         fprintf ((FILE), "\n");                                         \
90     }                                                                   \
91   while (0)
92
93 /* A C statement (sans semicolon) to output to the stdio stream
94    FILE the assembler definition of uninitialized global DECL named
95    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
96    Try to use asm_output_aligned_bss to implement this macro.  */
97
98 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
99   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
100
101 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
102    indirect are handled automatically.  */
103 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
104   do {                                                                  \
105     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
106       {                                                                 \
107         fputs (ASM_LONG, FILE);                                         \
108         assemble_name (FILE, XSTR (ADDR, 0));                           \
109         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
110         goto DONE;                                                      \
111       }                                                                 \
112   } while (0)
113
114 /* Used by crtstuff.c to initialize the base of data-relative relocations.
115    These are GOT relative on x86, so return the pic register.  */
116 #ifdef __PIC__
117 #define CRT_GET_RFIB_DATA(BASE)                 \
118   {                                             \
119     register void *ebx_ __asm__("ebx");         \
120     BASE = ebx_;                                \
121   }
122 #else
123 #define CRT_GET_RFIB_DATA(BASE)                                         \
124   __asm__ ("call\t.LPR%=\n"                                             \
125            ".LPR%=:\n\t"                                                \
126            "popl\t%0\n\t"                                               \
127            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
128               smaller than the traditional EBX, which results in the    \
129               offset being off by one.  */                              \
130            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
131            : "=d"(BASE))
132 #endif