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