re PR target/36669 (Wrong versioning for __float128)
[gcc.git] / gcc / config / i386 / linux64.h
1 /* Definitions for AMD x86-64 running Linux-based GNU systems with ELF format.
2 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007
3 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
5
6 This file is part of GCC.
7
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.
12
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.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 #if TARGET_64BIT_DEFAULT
23 #define TARGET_VERSION fprintf (stderr, " (x86-64 Linux/ELF)");
24 #else
25 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
26 #endif
27
28 #define TARGET_OS_CPP_BUILTINS() \
29 do \
30 { \
31 LINUX_TARGET_OS_CPP_BUILTINS(); \
32 } \
33 while (0)
34
35 #undef CPP_SPEC
36 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
37
38 /* The svr4 ABI for the i386 says that records and unions are returned
39 in memory. In the 64bit compilation we will turn this flag off in
40 override_options, as we never do pcc_struct_return scheme on this target. */
41 #undef DEFAULT_PCC_STRUCT_RETURN
42 #define DEFAULT_PCC_STRUCT_RETURN 1
43
44 /* We arrange for the whole %fs segment to map the tls area. */
45 #undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT
46 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS
47
48 /* Provide a LINK_SPEC. Here we provide support for the special GCC
49 options -static and -shared, which allow us to link things in one
50 of these three modes by applying the appropriate combinations of
51 options at link-time.
52
53 When the -shared link option is used a final link is not being
54 done. */
55
56 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
57 #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
58
59 #if TARGET_64BIT_DEFAULT
60 #define SPEC_32 "m32"
61 #define SPEC_64 "!m32"
62 #else
63 #define SPEC_32 "!m64"
64 #define SPEC_64 "m64"
65 #endif
66
67 #undef LINK_SPEC
68 #define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
69 %{shared:-shared} \
70 %{!shared: \
71 %{!static: \
72 %{rdynamic:-export-dynamic} \
73 %{" SPEC_32 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
74 %{" SPEC_64 ":%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}} \
75 %{static:-static}}"
76
77 /* Similar to standard Linux, but adding -ffast-math support. */
78 #undef ENDFILE_SPEC
79 #define ENDFILE_SPEC \
80 "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
81 %{mpc32:crtprec32.o%s} \
82 %{mpc64:crtprec64.o%s} \
83 %{mpc80:crtprec80.o%s} \
84 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
85
86 #if TARGET_64BIT_DEFAULT
87 #define MULTILIB_DEFAULTS { "m64" }
88 #else
89 #define MULTILIB_DEFAULTS { "m32" }
90 #endif
91
92 /* Put all *tf routines in libgcc. */
93 #undef LIBGCC2_HAS_TF_MODE
94 #define LIBGCC2_HAS_TF_MODE 1
95 #define LIBGCC2_TF_CEXT q
96 #define TF_SIZE 113
97
98 #undef NEED_INDICATE_EXEC_STACK
99 #define NEED_INDICATE_EXEC_STACK 1
100
101 #define MD_UNWIND_SUPPORT "config/i386/linux-unwind.h"
102
103 /* This macro may be overridden in i386/k*bsd-gnu.h. */
104 #define REG_NAME(reg) reg
105
106 #ifdef TARGET_LIBC_PROVIDES_SSP
107 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
108 x86_64 glibc provides it in %fs:0x28. */
109 #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14)
110 #endif