PR target/16201
[official-gcc.git] / gcc / config / i386 / linux.h
blobbbdfef6b1ba06cf81e142ad70b96b7d94f417006
1 /* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
2 Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2004
3 Free Software Foundation, Inc.
4 Contributed by Eric Youngdale.
5 Modified for stabs-in-ELF by H.J. Lu.
7 This file is part of GCC.
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 2, or (at your option)
12 any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to
21 the Free Software Foundation, 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
24 /* Output at beginning of assembler file. */
25 /* The .file command should always begin the output. */
26 #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
28 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
30 /* The svr4 ABI for the i386 says that records and unions are returned
31 in memory. */
32 #undef DEFAULT_PCC_STRUCT_RETURN
33 #define DEFAULT_PCC_STRUCT_RETURN 1
35 /* We arrange for the whole %gs segment to map the tls area. */
36 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
37 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
39 #undef ASM_COMMENT_START
40 #define ASM_COMMENT_START "#"
42 #undef DBX_REGISTER_NUMBER
43 #define DBX_REGISTER_NUMBER(n) \
44 (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
46 /* Output assembler code to FILE to call the profiler.
47 To the best of my knowledge, no Linux libc has required the label
48 argument to mcount. */
50 #define NO_PROFILE_COUNTERS 1
52 #undef MCOUNT_NAME
53 #define MCOUNT_NAME "mcount"
55 /* The GLIBC version of mcount for the x86 assumes that there is a
56 frame, so we cannot allow profiling without a frame pointer. */
58 #undef SUBTARGET_FRAME_POINTER_REQUIRED
59 #define SUBTARGET_FRAME_POINTER_REQUIRED current_function_profile
61 #undef SIZE_TYPE
62 #define SIZE_TYPE "unsigned int"
64 #undef PTRDIFF_TYPE
65 #define PTRDIFF_TYPE "int"
67 #undef WCHAR_TYPE
68 #define WCHAR_TYPE "long int"
70 #undef WCHAR_TYPE_SIZE
71 #define WCHAR_TYPE_SIZE BITS_PER_WORD
73 #define TARGET_OS_CPP_BUILTINS() \
74 do \
75 { \
76 LINUX_TARGET_OS_CPP_BUILTINS(); \
77 if (flag_pic) \
78 { \
79 builtin_define ("__PIC__"); \
80 builtin_define ("__pic__"); \
81 } \
82 } \
83 while (0)
85 #undef CPP_SPEC
86 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
88 #undef CC1_SPEC
89 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
91 /* Provide a LINK_SPEC appropriate for Linux. Here we provide support
92 for the special GCC options -static and -shared, which allow us to
93 link things in one of these three modes by applying the appropriate
94 combinations of options at link-time. We like to support here for
95 as many of the other GNU linker options as possible. But I don't
96 have the time to search for those flags. I am sure how to add
97 support for -soname shared_object_name. H.J.
99 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
100 -Wl,-V.
102 When the -shared link option is used a final link is not being
103 done. */
105 /* If ELF is the default format, we should not use /lib/elf. */
107 #define LINK_EMULATION "elf_i386"
108 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
110 #undef SUBTARGET_EXTRA_SPECS
111 #define SUBTARGET_EXTRA_SPECS \
112 { "link_emulation", LINK_EMULATION },\
113 { "dynamic_linker", DYNAMIC_LINKER }
115 #undef LINK_SPEC
116 #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
117 %{!shared: \
118 %{!ibcs: \
119 %{!static: \
120 %{rdynamic:-export-dynamic} \
121 %{!dynamic-linker:-dynamic-linker %(dynamic_linker)}} \
122 %{static:-static}}}"
124 /* A C statement (sans semicolon) to output to the stdio stream
125 FILE the assembler definition of uninitialized global DECL named
126 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
127 Try to use asm_output_aligned_bss to implement this macro. */
129 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
130 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
132 /* A C statement to output to the stdio stream FILE an assembler
133 command to advance the location counter to a multiple of 1<<LOG
134 bytes if it is within MAX_SKIP bytes.
136 This is used to align code labels according to Intel recommendations. */
138 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
139 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
140 do { \
141 if ((LOG) != 0) { \
142 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
143 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
145 } while (0)
146 #endif
148 /* Handle special EH pointer encodings. Absolute, pc-relative, and
149 indirect are handled automatically. */
150 #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \
151 do { \
152 if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
154 fputs (ASM_LONG, FILE); \
155 assemble_name (FILE, XSTR (ADDR, 0)); \
156 fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
157 goto DONE; \
159 } while (0)
161 /* Used by crtstuff.c to initialize the base of data-relative relocations.
162 These are GOT relative on x86, so return the pic register. */
163 #ifdef __PIC__
164 #define CRT_GET_RFIB_DATA(BASE) \
166 register void *ebx_ __asm__("ebx"); \
167 BASE = ebx_; \
169 #else
170 #define CRT_GET_RFIB_DATA(BASE) \
171 __asm__ ("call\t.LPR%=\n" \
172 ".LPR%=:\n\t" \
173 "popl\t%0\n\t" \
174 /* Due to a GAS bug, this cannot use EAX. That encodes \
175 smaller than the traditional EBX, which results in the \
176 offset being off by one. */ \
177 "addl\t$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
178 : "=d"(BASE))
179 #endif
181 #undef NEED_INDICATE_EXEC_STACK
182 #define NEED_INDICATE_EXEC_STACK 1
184 #define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
186 /* This macro may be overridden in i386/k*bsd-gnu.h. */
187 #define REG_NAME(reg) reg