]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/gcc/config/i386/sysv4.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / gcc / config / i386 / sysv4.h
1 /* Target definitions for GCC 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 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 2, 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 COPYING.  If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, 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 /* Output at beginning of assembler file.  */
35 /* The .file command should always begin the output.  */
36
37 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
38 #undef X86_FILE_START_VERSION_DIRECTIVE
39 #define X86_FILE_START_VERSION_DIRECTIVE true
40
41 #undef DBX_REGISTER_NUMBER
42 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
43
44 /* The routine used to output sequences of byte values.  We use a special
45    version of this for most svr4 targets because doing so makes the
46    generated assembly code more compact (and thus faster to assemble)
47    as well as more readable.  Note that if we find subparts of the
48    character sequence which end with NUL (and which are shorter than
49    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
50
51 #undef ASM_OUTPUT_ASCII
52 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
53   do                                                                    \
54     {                                                                   \
55       const unsigned char *_ascii_bytes =                               \
56         (const unsigned char *) (STR);                                  \
57       const unsigned char *limit = _ascii_bytes + (LENGTH);             \
58       unsigned bytes_in_chunk = 0;                                      \
59       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
60         {                                                               \
61           const unsigned char *p;                                       \
62           if (bytes_in_chunk >= 64)                                     \
63             {                                                           \
64               fputc ('\n', (FILE));                                     \
65               bytes_in_chunk = 0;                                       \
66             }                                                           \
67           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
68             continue;                                                   \
69           if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)   \
70             {                                                           \
71               if (bytes_in_chunk > 0)                                   \
72                 {                                                       \
73                   fputc ('\n', (FILE));                                 \
74                   bytes_in_chunk = 0;                                   \
75                 }                                                       \
76               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
77               _ascii_bytes = p;                                         \
78             }                                                           \
79           else                                                          \
80             {                                                           \
81               if (bytes_in_chunk == 0)                                  \
82                 fprintf ((FILE), "\t.byte\t");                          \
83               else                                                      \
84                 fputc (',', (FILE));                                    \
85               fprintf ((FILE), "0x%02x", *_ascii_bytes);                \
86               bytes_in_chunk += 5;                                      \
87             }                                                           \
88         }                                                               \
89       if (bytes_in_chunk > 0)                                           \
90         fprintf ((FILE), "\n");                                         \
91     }                                                                   \
92   while (0)
93
94 /* A C statement (sans semicolon) to output to the stdio stream
95    FILE the assembler definition of uninitialized global DECL named
96    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
97    Try to use asm_output_aligned_bss to implement this macro.  */
98
99 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
100   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
101
102 /* Handle special EH pointer encodings.  Absolute, pc-relative, and
103    indirect are handled automatically.  */
104 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
105   do {                                                                  \
106     if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel)         \
107       {                                                                 \
108         fputs (ASM_LONG, FILE);                                         \
109         assemble_name (FILE, XSTR (ADDR, 0));                           \
110         fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
111         goto DONE;                                                      \
112       }                                                                 \
113   } while (0)
114
115 /* Used by crtstuff.c to initialize the base of data-relative relocations.
116    These are GOT relative on x86, so return the pic register.  */
117 #ifdef __PIC__
118 #define CRT_GET_RFIB_DATA(BASE)                 \
119   {                                             \
120     register void *ebx_ __asm__("ebx");         \
121     BASE = ebx_;                                \
122   }
123 #else
124 #define CRT_GET_RFIB_DATA(BASE)                                         \
125   __asm__ ("call\t.LPR%=\n"                                             \
126            ".LPR%=:\n\t"                                                \
127            "popl\t%0\n\t"                                               \
128            /* Due to a GAS bug, this cannot use EAX.  That encodes      \
129               smaller than the traditional EBX, which results in the    \
130               offset being off by one.  */                              \
131            "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0"                 \
132            : "=d"(BASE))
133 #endif