]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/linux64.h
Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.
[thirdparty/gcc.git] / gcc / config / i386 / linux64.h
CommitLineData
14f73b5a 1/* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
748086b7 2 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
3353afbe 3 Free Software Foundation, Inc.
14f73b5a
JH
4 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
5
188fc5b5 6This file is part of GCC.
14f73b5a 7
188fc5b5 8GCC is free software; you can redistribute it and/or modify
14f73b5a 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
14f73b5a
JH
11any later version.
12
188fc5b5 13GCC is distributed in the hope that it will be useful,
14f73b5a
JH
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
748086b7
JJ
18Under Section 7 of GPL version 3, you are granted additional
19permissions described in the GCC Runtime Library Exception, version
203.1, as published by the Free Software Foundation.
21
22You should have received a copy of the GNU General Public License and
23a copy of the GCC Runtime Library Exception along with this program;
24see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2f83c7d6 25<http://www.gnu.org/licenses/>. */
14f73b5a 26
0f45f0f5 27#if TARGET_64BIT_DEFAULT
14f73b5a 28#define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
0f45f0f5
JM
29#else
30#define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
31#endif
14f73b5a 32
3d05b15f
NB
33#define TARGET_OS_CPP_BUILTINS() \
34 do \
35 { \
26b0ad13 36 LINUX_TARGET_OS_CPP_BUILTINS(); \
3d05b15f
NB
37 } \
38 while (0)
14f73b5a
JH
39
40#undef CPP_SPEC
3d05b15f 41#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
14f73b5a 42
a0ba837e
JH
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 override_options, as we never do pcc_struct_return scheme on this target. */
46#undef DEFAULT_PCC_STRUCT_RETURN
47#define DEFAULT_PCC_STRUCT_RETURN 1
48
74dc3e94
RH
49/* We arrange for the whole %fs segment to map the tls area. */
50#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
51#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
52
14f73b5a
JH
53/* Provide a LINK_SPEC. Here we provide support for the special GCC
54 options -static and -shared, which allow us to link things in one
55 of these three modes by applying the appropriate combinations of
56 options at link-time.
57
58 When the -shared link option is used a final link is not being
59 done. */
60
7bd85ce0
JM
61#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
62#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
63
bd459cb6
L
64#undef ASM_SPEC
65#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} \
66 %{Wa,*:%*} %{m32:--32} %{m64:--64} \
67 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
68
0f45f0f5
JM
69#if TARGET_64BIT_DEFAULT
70#define SPEC_32 "m32"
71#define SPEC_64 "!m32"
72#else
73#define SPEC_32 "!m64"
74#define SPEC_64 "m64"
75#endif
76
14f73b5a 77#undef LINK_SPEC
0f45f0f5 78#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
9b420a6a 79 %{shared:-shared} \
14f73b5a
JH
80 %{!shared: \
81 %{!static: \
82 %{rdynamic:-export-dynamic} \
0f45f0f5
JM
83 %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
84 %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
9b420a6a 85 %{static:-static}}"
14f73b5a 86
d75e02d6
L
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} \
577565f9
UB
91 %{mpc32:crtprec32.o%s} \
92 %{mpc64:crtprec64.o%s} \
93 %{mpc80:crtprec80.o%s} \
d75e02d6
L
94 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
95
0f45f0f5 96#if TARGET_64BIT_DEFAULT
96842bcd 97#define MULTILIB_DEFAULTS { "m64" }
0f45f0f5
JM
98#else
99#define MULTILIB_DEFAULTS { "m32" }
100#endif
96842bcd 101
3353afbe
UB
102/* Put all *tf routines in libgcc. */
103#undef LIBGCC2_HAS_TF_MODE
ff473280 104#define LIBGCC2_HAS_TF_MODE 1
3353afbe
UB
105#define LIBGCC2_TF_CEXT q
106#define TF_SIZE 113
107
a5fe455b
ZW
108#undef NEED_INDICATE_EXEC_STACK
109#define NEED_INDICATE_EXEC_STACK 1
3edc56a9 110
8662eb14 111#define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
02a854f9 112
51dd24d7 113/* This macro may be overridden in i386/k*bsd-gnu.h. */
02a854f9 114#define REG_NAME(reg) reg
77008252
JJ
115
116#ifdef TARGET_LIBC_PROVIDES_SSP
117/* i386 glibc provides __stack_chk_guard in %gs:0x14,
118 x86_64 glibc provides it in %fs:0x28. */
119#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
120#endif