]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/i386elf.h
clix.h (ASM_OUTPUT_ASCII): Avoid signed/unsigned warnings.
[thirdparty/gcc.git] / gcc / config / i386 / i386elf.h
1 /* Target definitions for GNU compiler for Intel 80386 using ELF
2 Copyright (C) 1988, 1991, 1995, 2000, 2001 Free Software Foundation, Inc.
3
4 Derived from sysv4.h 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 /* Use stabs instead of DWARF debug format. */
24 #undef PREFERRED_DEBUGGING_TYPE
25 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
26
27 #undef TARGET_VERSION
28 #define TARGET_VERSION fprintf (stderr, " (i386 bare ELF target)");
29
30 /* By default, target has a 80387, uses IEEE compatible arithmetic,
31 and returns float values in the 387. */
32
33 #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
34
35 /* The ELF ABI for the i386 says that records and unions are returned
36 in memory. */
37
38 #undef RETURN_IN_MEMORY
39 #define RETURN_IN_MEMORY(TYPE) \
40 (TYPE_MODE (TYPE) == BLKmode \
41 || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
42
43 /* This used to define X86, but james@bigtex.cactus.org says that
44 is supposed to be defined optionally by user programs--not by default. */
45 #define CPP_PREDEFINES ""
46
47 #undef CPP_SPEC
48 #define CPP_SPEC "%(cpp_cpu)"
49
50 #define ENDFILE_SPEC "crtend.o%s"
51
52 #define STARTFILE_SPEC "%{!shared: \
53 %{!symbolic: \
54 %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
55 crtbegin.o%s"
56
57 /* This is how to output assembly code to define a `float' constant.
58 We always have to use a .long pseudo-op to do this because the native
59 SVR4 ELF assembler is buggy and it generates incorrect values when we
60 try to use the .float pseudo-op instead. */
61
62 #undef ASM_OUTPUT_FLOAT
63 #define ASM_OUTPUT_FLOAT(FILE,VALUE) \
64 do { long value; \
65 REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value); \
66 if (sizeof (int) == sizeof (long)) \
67 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value); \
68 else \
69 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value); \
70 } while (0)
71
72 /* This is how to output assembly code to define a `double' constant.
73 We always have to use a pair of .long pseudo-ops to do this because
74 the native SVR4 ELF assembler is buggy and it generates incorrect
75 values when we try to use the the .double pseudo-op instead. */
76
77 #undef ASM_OUTPUT_DOUBLE
78 #define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
79 do { long value[2]; \
80 REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value); \
81 if (sizeof (int) == sizeof (long)) \
82 { \
83 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]); \
84 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]); \
85 } \
86 else \
87 { \
88 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]); \
89 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]); \
90 } \
91 } while (0)
92
93
94 #undef ASM_OUTPUT_LONG_DOUBLE
95 #define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE) \
96 do { long value[3]; \
97 REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), value); \
98 if (sizeof (int) == sizeof (long)) \
99 { \
100 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[0]); \
101 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[1]); \
102 fprintf((FILE), "%s0x%x\n", ASM_LONG, (int) value[2]); \
103 } \
104 else \
105 { \
106 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[0]); \
107 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[1]); \
108 fprintf((FILE), "%s0x%lx\n", ASM_LONG, value[2]); \
109 } \
110 } while (0)
111
112 #undef DBX_REGISTER_NUMBER
113 #define DBX_REGISTER_NUMBER(n) \
114 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
115
116 /* The routine used to output sequences of byte values. We use a special
117 version of this for most svr4 targets because doing so makes the
118 generated assembly code more compact (and thus faster to assemble)
119 as well as more readable. Note that if we find subparts of the
120 character sequence which end with NUL (and which are shorter than
121 STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
122
123 #undef ASM_OUTPUT_ASCII
124 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \
125 do \
126 { \
127 register const unsigned char *_ascii_bytes = \
128 (const unsigned char *) (STR); \
129 register const unsigned char *limit = _ascii_bytes + (LENGTH); \
130 register unsigned bytes_in_chunk = 0; \
131 for (; _ascii_bytes < limit; _ascii_bytes++) \
132 { \
133 register const unsigned char *p; \
134 if (bytes_in_chunk >= 64) \
135 { \
136 fputc ('\n', (FILE)); \
137 bytes_in_chunk = 0; \
138 } \
139 for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \
140 continue; \
141 if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \
142 { \
143 if (bytes_in_chunk > 0) \
144 { \
145 fputc ('\n', (FILE)); \
146 bytes_in_chunk = 0; \
147 } \
148 ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \
149 _ascii_bytes = p; \
150 } \
151 else \
152 { \
153 if (bytes_in_chunk == 0) \
154 fprintf ((FILE), "\t.byte\t"); \
155 else \
156 fputc (',', (FILE)); \
157 fprintf ((FILE), "0x%02x", *_ascii_bytes); \
158 bytes_in_chunk += 5; \
159 } \
160 } \
161 if (bytes_in_chunk > 0) \
162 fprintf ((FILE), "\n"); \
163 } \
164 while (0)
165
166 #define LOCAL_LABEL_PREFIX "."
167
168 /* Switch into a generic section. */
169 #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
170
171 /* If defined, a C expression whose value is a string containing the
172 assembler operation to identify the following data as
173 uninitialized global data. If not defined, and neither
174 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
175 uninitialized global data will be output in the data section if
176 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
177 used. */
178 #undef BSS_SECTION_ASM_OP
179 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
180
181 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
182 separate, explicit argument. If you define this macro, it is used
183 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
184 handling the required alignment of the variable. The alignment is
185 specified as the number of bits.
186
187 Try to use function `asm_output_aligned_bss' defined in file
188 `varasm.c' when defining this macro. */
189 #undef ASM_OUTPUT_ALIGNED_BSS
190 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
191 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)