]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/i386/gnu-user64.h
Linux/x86: Update TARGET_THREAD_SPLIT_STACK_OFFSET comments
[thirdparty/gcc.git] / gcc / config / i386 / gnu-user64.h
CommitLineData
e24609cf 1/* Definitions for AMD x86-64 using GNU userspace.
85ec4feb 2 Copyright (C) 2001-2018 Free Software Foundation, Inc.
e24609cf
JM
3 Contributed by Jan Hubicka <jh@suse.cz>, based on linux.h.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17Under Section 7 of GPL version 3, you are granted additional
18permissions described in the GCC Runtime Library Exception, version
193.1, as published by the Free Software Foundation.
20
21You should have received a copy of the GNU General Public License and
22a copy of the GCC Runtime Library Exception along with this program;
23see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24<http://www.gnu.org/licenses/>. */
25
e24609cf
JM
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.
30
31 When the -shared link option is used a final link is not being
32 done. */
33
34#if TARGET_64BIT_DEFAULT
d5d618b5 35#define SPEC_32 "m16|m32"
1ab8b791
L
36#if TARGET_BI_ARCH == 2
37#define SPEC_64 "m64"
d5d618b5 38#define SPEC_X32 "m16|m32|m64:;"
1ab8b791 39#else
d5d618b5 40#define SPEC_64 "m16|m32|mx32:;"
f0ea7581 41#define SPEC_X32 "mx32"
1ab8b791 42#endif
e24609cf 43#else
f0ea7581 44#define SPEC_32 "m64|mx32:;"
e24609cf 45#define SPEC_64 "m64"
f0ea7581 46#define SPEC_X32 "mx32"
e24609cf
JM
47#endif
48
49#undef ASM_SPEC
f0ea7581
L
50#define ASM_SPEC "%{" SPEC_32 ":--32} \
51 %{" SPEC_64 ":--64} \
52 %{" SPEC_X32 ":--x32} \
e24609cf
JM
53 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
54
6acc8a3c
EI
55#define GNU_USER_TARGET_LINK_SPEC \
56 "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
7d8d16c3 57 %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
f0ea7581 58 %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
e24609cf
JM
59 %{shared:-shared} \
60 %{!shared: \
61 %{!static: \
8c6562e1 62 %{!static-pie: \
b4fed890
L
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}}"
e24609cf 68
6acc8a3c
EI
69#undef LINK_SPEC
70#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
71
e24609cf 72#if TARGET_64BIT_DEFAULT
1ab8b791
L
73#if TARGET_BI_ARCH == 2
74#define MULTILIB_DEFAULTS { "mx32" }
75#else
e24609cf 76#define MULTILIB_DEFAULTS { "m64" }
1ab8b791 77#endif
e24609cf
JM
78#else
79#define MULTILIB_DEFAULTS { "m32" }
80#endif
81
e24609cf
JM
82#ifdef TARGET_LIBC_PROVIDES_SSP
83/* i386 glibc provides __stack_chk_guard in %gs:0x14,
70a69509 84 x32 glibc provides it in %fs:0x18.
e24609cf 85 x86_64 glibc provides it in %fs:0x28. */
f0ea7581
L
86#define TARGET_THREAD_SSP_OFFSET \
87 (TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14)
e24609cf 88
a25eadc8
L
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. */
f0ea7581
L
92#define TARGET_THREAD_SPLIT_STACK_OFFSET \
93 (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
e24609cf 94#endif
dc726735
L
95
96#undef WCHAR_TYPE
97#define WCHAR_TYPE (TARGET_LP64 ? "int" : "long int")