1 /* Definitions for AMD x86-64 using GNU userspace.
2 Copyright (C) 2001-2018 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)
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
31 When the -shared link option is used a final link is not being
34 #if TARGET_64BIT_DEFAULT
35 #define SPEC_32 "m16|m32"
36 #if TARGET_BI_ARCH == 2
38 #define SPEC_X32 "m16|m32|m64:;"
40 #define SPEC_64 "m16|m32|mx32:;"
41 #define SPEC_X32 "mx32"
44 #define SPEC_32 "m64|mx32:;"
46 #define SPEC_X32 "mx32"
50 #define ASM_SPEC "%{" SPEC_32 ":--32} \
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 "} \
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}}"
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" }
76 #define MULTILIB_DEFAULTS { "m64" }
79 #define MULTILIB_DEFAULTS { "m32" }
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 /* i386 glibc provides __private_ss in %gs:0x30.
90 x32 glibc provides it in %fs:0x40.
91 x86_64 glibc provides it in %fs:0x70. */
92 #define TARGET_THREAD_SPLIT_STACK_OFFSET \
93 (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
97 #define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")