1 |
709 |
jeremybenn |
/* Definitions for Intel 386 systems using GNU userspace.
|
2 |
|
|
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
|
3 |
|
|
2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Eric Youngdale.
|
5 |
|
|
Modified for stabs-in-ELF by H.J. Lu.
|
6 |
|
|
|
7 |
|
|
This file is part of GCC.
|
8 |
|
|
|
9 |
|
|
GCC is free software; you can redistribute it and/or modify
|
10 |
|
|
it under the terms of the GNU General Public License as published by
|
11 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
12 |
|
|
any later version.
|
13 |
|
|
|
14 |
|
|
GCC is distributed in the hope that it will be useful,
|
15 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
GNU General Public License for more details.
|
18 |
|
|
|
19 |
|
|
You should have received a copy of the GNU General Public License
|
20 |
|
|
along with GCC; see the file COPYING3. If not see
|
21 |
|
|
<http://www.gnu.org/licenses/>. */
|
22 |
|
|
|
23 |
|
|
/* Output at beginning of assembler file. */
|
24 |
|
|
/* The .file command should always begin the output. */
|
25 |
|
|
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
|
26 |
|
|
|
27 |
|
|
/* The svr4 ABI for the i386 says that records and unions are returned
|
28 |
|
|
in memory. */
|
29 |
|
|
#undef DEFAULT_PCC_STRUCT_RETURN
|
30 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 1
|
31 |
|
|
|
32 |
|
|
/* We arrange for the whole %gs segment to map the tls area. */
|
33 |
|
|
#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
|
34 |
|
|
#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
|
35 |
|
|
|
36 |
|
|
#undef ASM_COMMENT_START
|
37 |
|
|
#define ASM_COMMENT_START "#"
|
38 |
|
|
|
39 |
|
|
#undef DBX_REGISTER_NUMBER
|
40 |
|
|
#define DBX_REGISTER_NUMBER(n) \
|
41 |
|
|
(TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
|
42 |
|
|
|
43 |
|
|
/* Output assembler code to FILE to call the profiler.
|
44 |
|
|
To the best of my knowledge, no GNU userspace libc has required the label
|
45 |
|
|
argument to mcount. */
|
46 |
|
|
|
47 |
|
|
#define NO_PROFILE_COUNTERS 1
|
48 |
|
|
|
49 |
|
|
#undef MCOUNT_NAME
|
50 |
|
|
#define MCOUNT_NAME "mcount"
|
51 |
|
|
|
52 |
|
|
/* The GLIBC version of mcount for the x86 assumes that there is a
|
53 |
|
|
frame, so we cannot allow profiling without a frame pointer. */
|
54 |
|
|
|
55 |
|
|
#undef SUBTARGET_FRAME_POINTER_REQUIRED
|
56 |
|
|
#define SUBTARGET_FRAME_POINTER_REQUIRED crtl->profile
|
57 |
|
|
|
58 |
|
|
#undef SIZE_TYPE
|
59 |
|
|
#define SIZE_TYPE "unsigned int"
|
60 |
|
|
|
61 |
|
|
#undef PTRDIFF_TYPE
|
62 |
|
|
#define PTRDIFF_TYPE "int"
|
63 |
|
|
|
64 |
|
|
#undef WCHAR_TYPE
|
65 |
|
|
#define WCHAR_TYPE "long int"
|
66 |
|
|
|
67 |
|
|
#undef WCHAR_TYPE_SIZE
|
68 |
|
|
#define WCHAR_TYPE_SIZE BITS_PER_WORD
|
69 |
|
|
|
70 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
71 |
|
|
do \
|
72 |
|
|
{ \
|
73 |
|
|
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
|
74 |
|
|
} \
|
75 |
|
|
while (0)
|
76 |
|
|
|
77 |
|
|
#undef CPP_SPEC
|
78 |
|
|
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
|
79 |
|
|
|
80 |
|
|
#undef CC1_SPEC
|
81 |
|
|
#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
|
82 |
|
|
|
83 |
|
|
/* Provide a LINK_SPEC appropriate for GNU userspace. Here we provide support
|
84 |
|
|
for the special GCC options -static and -shared, which allow us to
|
85 |
|
|
link things in one of these three modes by applying the appropriate
|
86 |
|
|
combinations of options at link-time.
|
87 |
|
|
|
88 |
|
|
When the -shared link option is used a final link is not being
|
89 |
|
|
done. */
|
90 |
|
|
|
91 |
|
|
#undef ASM_SPEC
|
92 |
|
|
#define ASM_SPEC \
|
93 |
|
|
"--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
|
94 |
|
|
|
95 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
96 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
97 |
|
|
{ "link_emulation", GNU_USER_LINK_EMULATION },\
|
98 |
|
|
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
|
99 |
|
|
|
100 |
|
|
#undef LINK_SPEC
|
101 |
|
|
#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
|
102 |
|
|
%{!shared: \
|
103 |
|
|
%{!static: \
|
104 |
|
|
%{rdynamic:-export-dynamic} \
|
105 |
|
|
-dynamic-linker %(dynamic_linker)} \
|
106 |
|
|
%{static:-static}}"
|
107 |
|
|
|
108 |
|
|
/* Similar to standard GNU userspace, but adding -ffast-math support. */
|
109 |
|
|
#undef ENDFILE_SPEC
|
110 |
|
|
#define ENDFILE_SPEC \
|
111 |
|
|
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
|
112 |
|
|
%{mpc32:crtprec32.o%s} \
|
113 |
|
|
%{mpc64:crtprec64.o%s} \
|
114 |
|
|
%{mpc80:crtprec80.o%s} \
|
115 |
|
|
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
|
116 |
|
|
|
117 |
|
|
/* A C statement (sans semicolon) to output to the stdio stream
|
118 |
|
|
FILE the assembler definition of uninitialized global DECL named
|
119 |
|
|
NAME whose size is SIZE bytes and alignment is ALIGN bytes.
|
120 |
|
|
Try to use asm_output_aligned_bss to implement this macro. */
|
121 |
|
|
|
122 |
|
|
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
123 |
|
|
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
124 |
|
|
|
125 |
|
|
/* A C statement to output to the stdio stream FILE an assembler
|
126 |
|
|
command to advance the location counter to a multiple of 1<<LOG
|
127 |
|
|
bytes if it is within MAX_SKIP bytes.
|
128 |
|
|
|
129 |
|
|
This is used to align code labels according to Intel recommendations. */
|
130 |
|
|
|
131 |
|
|
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
|
132 |
|
|
#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
|
133 |
|
|
do { \
|
134 |
|
|
if ((LOG) != 0) { \
|
135 |
|
|
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
|
136 |
|
|
else { \
|
137 |
|
|
fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
|
138 |
|
|
/* Make sure that we have at least 8 byte alignment if > 8 byte \
|
139 |
|
|
alignment is preferred. */ \
|
140 |
|
|
if ((LOG) > 3 \
|
141 |
|
|
&& (1 << (LOG)) > ((MAX_SKIP) + 1) \
|
142 |
|
|
&& (MAX_SKIP) >= 7) \
|
143 |
|
|
fputs ("\t.p2align 3\n", (FILE)); \
|
144 |
|
|
} \
|
145 |
|
|
} \
|
146 |
|
|
} while (0)
|
147 |
|
|
#endif
|
148 |
|
|
|
149 |
|
|
/* Handle special EH pointer encodings. Absolute, pc-relative, and
|
150 |
|
|
indirect are handled automatically. */
|
151 |
|
|
#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
|
152 |
|
|
do { \
|
153 |
|
|
if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
|
154 |
|
|
{ \
|
155 |
|
|
fputs (ASM_LONG, FILE); \
|
156 |
|
|
assemble_name (FILE, XSTR (ADDR, 0)); \
|
157 |
|
|
fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
|
158 |
|
|
goto DONE; \
|
159 |
|
|
} \
|
160 |
|
|
} while (0)
|
161 |
|
|
|
162 |
|
|
/* Used by crtstuff.c to initialize the base of data-relative relocations.
|
163 |
|
|
These are GOT relative on x86, so return the pic register. */
|
164 |
|
|
#ifdef __PIC__
|
165 |
|
|
#define CRT_GET_RFIB_DATA(BASE) \
|
166 |
|
|
{ \
|
167 |
|
|
register void *ebx_ __asm__("ebx"); \
|
168 |
|
|
BASE = ebx_; \
|
169 |
|
|
}
|
170 |
|
|
#else
|
171 |
|
|
#define CRT_GET_RFIB_DATA(BASE) \
|
172 |
|
|
__asm__ ("call\t.LPR%=\n" \
|
173 |
|
|
".LPR%=:\n\t" \
|
174 |
|
|
"pop{l}\t%0\n\t" \
|
175 |
|
|
/* Due to a GAS bug, this cannot use EAX. That encodes \
|
176 |
|
|
smaller than the traditional EBX, which results in the \
|
177 |
|
|
offset being off by one. */ \
|
178 |
|
|
"add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
|
179 |
|
|
"|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
|
180 |
|
|
: "=d"(BASE))
|
181 |
|
|
#endif
|
182 |
|
|
|
183 |
|
|
/* Put all *tf routines in libgcc. */
|
184 |
|
|
#undef LIBGCC2_HAS_TF_MODE
|
185 |
|
|
#define LIBGCC2_HAS_TF_MODE 1
|
186 |
|
|
#define LIBGCC2_TF_CEXT q
|
187 |
|
|
#define TF_SIZE 113
|
188 |
|
|
|
189 |
|
|
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
|
190 |
|
|
|
191 |
|
|
/* The stack pointer needs to be moved while checking the stack. */
|
192 |
|
|
#define STACK_CHECK_MOVING_SP 1
|
193 |
|
|
|
194 |
|
|
/* Static stack checking is supported by means of probes. */
|
195 |
|
|
#define STACK_CHECK_STATIC_BUILTIN 1
|
196 |
|
|
|
197 |
|
|
#ifdef TARGET_LIBC_PROVIDES_SSP
|
198 |
|
|
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
|
199 |
|
|
#define TARGET_THREAD_SSP_OFFSET 0x14
|
200 |
|
|
|
201 |
|
|
/* We steal the last transactional memory word. */
|
202 |
|
|
#define TARGET_CAN_SPLIT_STACK
|
203 |
|
|
#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
|
204 |
|
|
#endif
|