]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/gnu-user.h
Update Copyright years for files modified in 2011 and/or 2012.
[thirdparty/gcc.git] / gcc / config / i386 / gnu-user.h
1 /* 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, 2012 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 #undef ASM_COMMENT_START
28 #define ASM_COMMENT_START "#"
29
30 #undef DBX_REGISTER_NUMBER
31 #define DBX_REGISTER_NUMBER(n) \
32 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
33
34 /* Output assembler code to FILE to call the profiler.
35 To the best of my knowledge, no GNU userspace libc has required the label
36 argument to mcount. */
37
38 #define NO_PROFILE_COUNTERS 1
39
40 #undef MCOUNT_NAME
41 #define MCOUNT_NAME "mcount"
42
43 /* The GLIBC version of mcount for the x86 assumes that there is a
44 frame, so we cannot allow profiling without a frame pointer. */
45
46 #undef SUBTARGET_FRAME_POINTER_REQUIRED
47 #define SUBTARGET_FRAME_POINTER_REQUIRED crtl->profile
48
49 #undef SIZE_TYPE
50 #define SIZE_TYPE "unsigned int"
51
52 #undef PTRDIFF_TYPE
53 #define PTRDIFF_TYPE "int"
54
55 #undef WCHAR_TYPE
56 #define WCHAR_TYPE "long int"
57
58 #undef WCHAR_TYPE_SIZE
59 #define WCHAR_TYPE_SIZE BITS_PER_WORD
60
61 /* Provide a LINK_SPEC appropriate for GNU userspace. Here we provide support
62 for the special GCC options -static and -shared, which allow us to
63 link things in one of these three modes by applying the appropriate
64 combinations of options at link-time.
65
66 When the -shared link option is used a final link is not being
67 done. */
68
69 #undef ASM_SPEC
70 #define ASM_SPEC \
71 "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
72
73 #undef SUBTARGET_EXTRA_SPECS
74 #define SUBTARGET_EXTRA_SPECS \
75 { "link_emulation", GNU_USER_LINK_EMULATION },\
76 { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
77
78 #define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
79 %{!shared: \
80 %{!static: \
81 %{rdynamic:-export-dynamic} \
82 -dynamic-linker %(dynamic_linker)} \
83 %{static:-static}}"
84
85 #undef LINK_SPEC
86 #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
87
88 /* A C statement (sans semicolon) to output to the stdio stream
89 FILE the assembler definition of uninitialized global DECL named
90 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
91 Try to use asm_output_aligned_bss to implement this macro. */
92
93 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
94 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
95
96 /* A C statement to output to the stdio stream FILE an assembler
97 command to advance the location counter to a multiple of 1<<LOG
98 bytes if it is within MAX_SKIP bytes.
99
100 This is used to align code labels according to Intel recommendations. */
101
102 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
103 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
104 do { \
105 if ((LOG) != 0) { \
106 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
107 else { \
108 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
109 /* Make sure that we have at least 8 byte alignment if > 8 byte \
110 alignment is preferred. */ \
111 if ((LOG) > 3 \
112 && (1 << (LOG)) > ((MAX_SKIP) + 1) \
113 && (MAX_SKIP) >= 7) \
114 fputs ("\t.p2align 3\n", (FILE)); \
115 } \
116 } \
117 } while (0)
118 #endif
119
120 /* Handle special EH pointer encodings. Absolute, pc-relative, and
121 indirect are handled automatically. */
122 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
123 do { \
124 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
125 { \
126 fputs (ASM_LONG, FILE); \
127 assemble_name (FILE, XSTR (ADDR, 0)); \
128 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
129 goto DONE; \
130 } \
131 } while (0)
132
133 /* Used by crtstuff.c to initialize the base of data-relative relocations.
134 These are GOT relative on x86, so return the pic register. */
135 #ifdef __PIC__
136 #define CRT_GET_RFIB_DATA(BASE) \
137 { \
138 register void *ebx_ __asm__("ebx"); \
139 BASE = ebx_; \
140 }
141 #else
142 #define CRT_GET_RFIB_DATA(BASE) \
143 __asm__ ("call\t.LPR%=\n" \
144 ".LPR%=:\n\t" \
145 "pop{l}\t%0\n\t" \
146 /* Due to a GAS bug, this cannot use EAX. That encodes \
147 smaller than the traditional EBX, which results in the \
148 offset being off by one. */ \
149 "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
150 "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
151 : "=d"(BASE))
152 #endif
153
154 #ifdef TARGET_LIBC_PROVIDES_SSP
155 /* i386 glibc provides __stack_chk_guard in %gs:0x14. */
156 #define TARGET_THREAD_SSP_OFFSET 0x14
157
158 /* We steal the last transactional memory word. */
159 #define TARGET_CAN_SPLIT_STACK
160 #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
161 #endif