* x86-tune-sched.c (ix86_adjust_cost): Fix Zen support.
[official-gcc.git] / gcc / config / i386 / gnu-user64.h
blob46434a84011ddbdcf290c7e3ae76788709211fa4
1 /* Definitions for AMD x86-64 using GNU userspace.
2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 /* Provide a LINK_SPEC. Here we provide support for the special GCC
27 options -static and -shared, which allow us to link things in one
28 of these three modes by applying the appropriate combinations of
29 options at link-time.
31 When the -shared link option is used a final link is not being
32 done. */
34 #if TARGET_64BIT_DEFAULT
35 #define SPEC_32 "m16|m32"
36 #if TARGET_BI_ARCH == 2
37 #define SPEC_64 "m64"
38 #define SPEC_X32 "m16|m32|m64:;"
39 #else
40 #define SPEC_64 "m16|m32|mx32:;"
41 #define SPEC_X32 "mx32"
42 #endif
43 #else
44 #define SPEC_32 "m64|mx32:;"
45 #define SPEC_64 "m64"
46 #define SPEC_X32 "mx32"
47 #endif
49 #undef ASM_SPEC
50 #define ASM_SPEC "%{" SPEC_32 ":--32} \
51 %{" SPEC_64 ":--64} \
52 %{" SPEC_X32 ":--x32} \
53 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
55 #define GNU_USER_TARGET_LINK_SPEC \
56 "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
57 %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
58 %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
59 %{shared:-shared} \
60 %{!shared: \
61 %{!static: \
62 %{!static-pie: \
63 %{rdynamic:-export-dynamic} \
64 %{" SPEC_32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
65 %{" SPEC_64 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
66 %{" SPEC_X32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}}} \
67 %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}"
69 #undef LINK_SPEC
70 #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
72 #if TARGET_64BIT_DEFAULT
73 #if TARGET_BI_ARCH == 2
74 #define MULTILIB_DEFAULTS { "mx32" }
75 #else
76 #define MULTILIB_DEFAULTS { "m64" }
77 #endif
78 #else
79 #define MULTILIB_DEFAULTS { "m32" }
80 #endif
82 #ifdef TARGET_LIBC_PROVIDES_SSP
83 /* i386 glibc provides __stack_chk_guard in %gs:0x14,
84 x32 glibc provides it in %fs:0x18.
85 x86_64 glibc provides it in %fs:0x28. */
86 #define TARGET_THREAD_SSP_OFFSET \
87 (TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14)
89 /* We steal the last transactional memory word. */
90 #define TARGET_THREAD_SPLIT_STACK_OFFSET \
91 (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
92 #endif
94 #undef WCHAR_TYPE
95 #define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")