Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / config / i386 / linux64.h
blobb68c40fec58fe72228048a7eb43b3a8808163bd2
1 /* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
2 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
6 This file is part of GCC.
8 GCC 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 3, or (at your option)
11 any later version.
13 GCC 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.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 #if TARGET_64BIT_DEFAULT
28 #define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
29 #else
30 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
31 #endif
33 #define TARGET_OS_CPP_BUILTINS() \
34 do \
35 { \
36 LINUX_TARGET_OS_CPP_BUILTINS(); \
37 } \
38 while (0)
40 #undef CPP_SPEC
41 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
43 /* The svr4 ABI for the i386 says that records and unions are returned
44 in memory. In the 64bit compilation we will turn this flag off in
45 ix86_option_override_internal, as we never do pcc_struct_return
46 scheme on this target. */
47 #undef DEFAULT_PCC_STRUCT_RETURN
48 #define DEFAULT_PCC_STRUCT_RETURN 1
50 /* We arrange for the whole %fs segment to map the tls area. */
51 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
52 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
54 /* Provide a LINK_SPEC. Here we provide support for the special GCC
55 options -static and -shared, which allow us to link things in one
56 of these three modes by applying the appropriate combinations of
57 options at link-time.
59 When the -shared link option is used a final link is not being
60 done. */
62 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
63 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
65 #if TARGET_64BIT_DEFAULT
66 #define SPEC_32 "m32"
67 #define SPEC_64 "!m32"
68 #else
69 #define SPEC_32 "!m64"
70 #define SPEC_64 "m64"
71 #endif
73 #undef ASM_SPEC
74 #define ASM_SPEC "%{" SPEC_32 ":--32} %{" SPEC_64 ":--64} \
75 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
77 #undef LINK_SPEC
78 #define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
79 %{shared:-shared} \
80 %{!shared: \
81 %{!static: \
82 %{rdynamic:-export-dynamic} \
83 %{" SPEC_32 ":-dynamic-linker " LINUX_DYNAMIC_LINKER32 "} \
84 %{" SPEC_64 ":-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}} \
85 %{static:-static}}"
87 /* Similar to standard Linux, but adding -ffast-math support. */
88 #undef ENDFILE_SPEC
89 #define ENDFILE_SPEC \
90 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
91 %{mpc32:crtprec32.o%s} \
92 %{mpc64:crtprec64.o%s} \
93 %{mpc80:crtprec80.o%s} \
94 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
96 #if TARGET_64BIT_DEFAULT
97 #define MULTILIB_DEFAULTS { "m64" }
98 #else
99 #define MULTILIB_DEFAULTS { "m32" }
100 #endif
102 /* Put all *tf routines in libgcc. */
103 #undef LIBGCC2_HAS_TF_MODE
104 #define LIBGCC2_HAS_TF_MODE 1
105 #define LIBGCC2_TF_CEXT q
106 #define TF_SIZE 113
108 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
110 #define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
112 /* The stack pointer needs to be moved while checking the stack. */
113 #define STACK_CHECK_MOVING_SP 1
115 /* Static stack checking is supported by means of probes. */
116 #define STACK_CHECK_STATIC_BUILTIN 1
118 /* This macro may be overridden in i386/k*bsd-gnu.h. */
119 #define REG_NAME(reg) reg
121 #ifdef TARGET_LIBC_PROVIDES_SSP
122 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
123 x86_64 glibc provides it in %fs:0x28. */
124 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
126 /* We steal the last transactional memory word. */
127 #define TARGET_CAN_SPLIT_STACK
128 #define TARGET_THREAD_SPLIT_STACK_OFFSET (TARGET_64BIT ? 0x70 : 0x30)
129 #endif