]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/linux.h
host-hpux.c: Change copyright header to refer to version 3 of the GNU General Public...
[thirdparty/gcc.git] / gcc / config / i386 / linux.h
CommitLineData
9ec36da5 1/* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
7bd85ce0 2 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004, 2005,
2f83c7d6 3 2006, 2007 Free Software Foundation, Inc.
bb1835d2
RK
4 Contributed by Eric Youngdale.
5 Modified for stabs-in-ELF by H.J. Lu.
4a86a6d2 6
188fc5b5 7This file is part of GCC.
4a86a6d2 8
188fc5b5 9GCC is free software; you can redistribute it and/or modify
4a86a6d2 10it under the terms of the GNU General Public License as published by
2f83c7d6 11the Free Software Foundation; either version 3, or (at your option)
4a86a6d2
RK
12any later version.
13
188fc5b5 14GCC is distributed in the hope that it will be useful,
4a86a6d2
RK
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
2f83c7d6
NC
20along with GCC; see the file COPYING3. If not see
21<http://www.gnu.org/licenses/>. */
1cf549b1 22
d984704d
DN
23/* Output at beginning of assembler file. */
24/* The .file command should always begin the output. */
1bc7c5b6 25#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
d984704d 26
c3b11311 27#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
bb1835d2
RK
28
29/* The svr4 ABI for the i386 says that records and unions are returned
30 in memory. */
31#undef DEFAULT_PCC_STRUCT_RETURN
32#define DEFAULT_PCC_STRUCT_RETURN 1
33
74dc3e94
RH
34/* We arrange for the whole %gs segment to map the tls area. */
35#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
36#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
37
bebc4663
JL
38#undef ASM_COMMENT_START
39#define ASM_COMMENT_START "#"
40
bb1835d2 41#undef DBX_REGISTER_NUMBER
0f7fa3d0
JH
42#define DBX_REGISTER_NUMBER(n) \
43 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
bb1835d2 44
dcacfa04
ZW
45/* Output assembler code to FILE to call the profiler.
46 To the best of my knowledge, no Linux libc has required the label
47 argument to mcount. */
48
9739c90c 49#define NO_PROFILE_COUNTERS 1
bb1835d2 50
a5fa1ecd
JH
51#undef MCOUNT_NAME
52#define MCOUNT_NAME "mcount"
d345a981 53
a7943381 54/* The GLIBC version of mcount for the x86 assumes that there is a
4da5f005
MM
55 frame, so we cannot allow profiling without a frame pointer. */
56
a7943381
RH
57#undef SUBTARGET_FRAME_POINTER_REQUIRED
58#define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
4da5f005 59
1cf549b1
RS
60#undef SIZE_TYPE
61#define SIZE_TYPE "unsigned int"
bb1835d2 62
1cf549b1
RS
63#undef PTRDIFF_TYPE
64#define PTRDIFF_TYPE "int"
bb1835d2 65
1cf549b1
RS
66#undef WCHAR_TYPE
67#define WCHAR_TYPE "long int"
bb1835d2 68
1cf549b1
RS
69#undef WCHAR_TYPE_SIZE
70#define WCHAR_TYPE_SIZE BITS_PER_WORD
bb1835d2 71
f23a084d
NB
72#define TARGET_OS_CPP_BUILTINS() \
73 do \
74 { \
26b0ad13 75 LINUX_TARGET_OS_CPP_BUILTINS(); \
f23a084d
NB
76 } \
77 while (0)
1cf549b1 78
bb1835d2 79#undef CPP_SPEC
f23a084d 80#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
1cf549b1 81
b52fbc26
RK
82#undef CC1_SPEC
83#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
84
c3b11311 85/* Provide a LINK_SPEC appropriate for Linux. Here we provide support
bb1835d2
RK
86 for the special GCC options -static and -shared, which allow us to
87 link things in one of these three modes by applying the appropriate
88 combinations of options at link-time. We like to support here for
89 as many of the other GNU linker options as possible. But I don't
90 have the time to search for those flags. I am sure how to add
91 support for -soname shared_object_name. H.J.
92
93 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
94 -Wl,-V.
95
96 When the -shared link option is used a final link is not being
97 done. */
98
892a2d68 99/* If ELF is the default format, we should not use /lib/elf. */
bb1835d2 100
8224ee20 101/* These macros may be overridden in k*bsd-gnu.h and i386/k*bsd-gnu.h. */
cfafe973 102#define LINK_EMULATION "elf_i386"
7bd85ce0 103#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
cfafe973
RM
104
105#undef SUBTARGET_EXTRA_SPECS
106#define SUBTARGET_EXTRA_SPECS \
107 { "link_emulation", LINK_EMULATION },\
7bd85ce0 108 { "dynamic_linker", LINUX_DYNAMIC_LINKER }
cfafe973
RM
109
110#undef LINK_SPEC
111#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
5f62d4e1
RK
112 %{!shared: \
113 %{!ibcs: \
114 %{!static: \
115 %{rdynamic:-export-dynamic} \
cfafe973 116 %{!dynamic-linker:-dynamic-linker %(dynamic_linker)}} \
5f62d4e1 117 %{static:-static}}}"
6c2afd82 118
d75e02d6
L
119/* Similar to standard Linux, but adding -ffast-math support. */
120#undef ENDFILE_SPEC
121#define ENDFILE_SPEC \
122 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
577565f9
UB
123 %{mpc32:crtprec32.o%s} \
124 %{mpc64:crtprec64.o%s} \
125 %{mpc80:crtprec80.o%s} \
d75e02d6
L
126 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
127
17d6fedc 128/* A C statement (sans semicolon) to output to the stdio stream
ca4fca3e 129 FILE the assembler definition of uninitialized global DECL named
17d6fedc
JM
130 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
131 Try to use asm_output_aligned_bss to implement this macro. */
132
ca4fca3e
DE
133#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
134 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
de3eb7b7
L
135
136/* A C statement to output to the stdio stream FILE an assembler
137 command to advance the location counter to a multiple of 1<<LOG
138 bytes if it is within MAX_SKIP bytes.
139
140 This is used to align code labels according to Intel recommendations. */
141
80de1662 142#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
8c8a9717
JM
143#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
144 do { \
0385ba57 145 if ((LOG) != 0) { \
8401285e 146 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
461a73b5
L
147 else { \
148 fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
149 /* Make sure that we have at least 8 byte alignment if > 8 byte \
150 alignment is preferred. */ \
151 if ((LOG) > 3 && (1 << (LOG)) > ((MAX_SKIP) + 1)) \
152 fprintf ((FILE), "\t.p2align 3\n"); \
153 } \
0385ba57 154 } \
8c8a9717 155 } while (0)
80de1662 156#endif
373368fd 157
1066e2b5
RH
158/* Handle special EH pointer encodings. Absolute, pc-relative, and
159 indirect are handled automatically. */
160#define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
161 do { \
162 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
163 { \
301d03af 164 fputs (ASM_LONG, FILE); \
1066e2b5
RH
165 assemble_name (FILE, XSTR (ADDR, 0)); \
166 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
167 goto DONE; \
168 } \
169 } while (0)
170
171/* Used by crtstuff.c to initialize the base of data-relative relocations.
172 These are GOT relative on x86, so return the pic register. */
173#ifdef __PIC__
174#define CRT_GET_RFIB_DATA(BASE) \
175 { \
176 register void *ebx_ __asm__("ebx"); \
177 BASE = ebx_; \
178 }
179#else
180#define CRT_GET_RFIB_DATA(BASE) \
181 __asm__ ("call\t.LPR%=\n" \
182 ".LPR%=:\n\t" \
183 "popl\t%0\n\t" \
184 /* Due to a GAS bug, this cannot use EAX. That encodes \
185 smaller than the traditional EBX, which results in the \
186 offset being off by one. */ \
187 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
188 : "=d"(BASE))
189#endif
190
a5fe455b
ZW
191#undef NEED_INDICATE_EXEC_STACK
192#define NEED_INDICATE_EXEC_STACK 1
3edc56a9 193
8662eb14 194#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
44379973 195
2fd13506 196/* This macro may be overridden in i386/k*bsd-gnu.h. */
44379973 197#define REG_NAME(reg) reg
77008252
JJ
198
199#ifdef TARGET_LIBC_PROVIDES_SSP
200/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
201#define TARGET_THREAD_SSP_OFFSET 0x14
202#endif