1 /* Definitions for Linux for S/390.
2    Copyright (C) 1999-2018 Free Software Foundation, Inc.
3    Contributed by Hartmut Penner (hpenner@de.ibm.com) and
4                   Ulrich Weigand (uweigand@de.ibm.com).
5 
6 This file is part of GCC.
7 
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12 
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 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 #ifndef _LINUX_H
23 #define _LINUX_H
24 
25 /* Target specific type definitions.  */
26 
27 /* For 31 bit our size type differs from most other targets (where it
28    is "unsigned int").  The difference tends to cause trouble e.g.:
29    Glibc BZ #16712, GCC BZ #79358 but cannot be changed due to ABI
30    issues.  */
31 #undef  SIZE_TYPE
32 #define SIZE_TYPE "long unsigned int"
33 #undef  PTRDIFF_TYPE
34 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
35 
36 #undef  WCHAR_TYPE
37 #define WCHAR_TYPE "int"
38 #undef  WCHAR_TYPE_SIZE
39 #define WCHAR_TYPE_SIZE 32
40 
41 
42 /* Target specific preprocessor settings.  */
43 
44 #define TARGET_OS_CPP_BUILTINS()		\
45   do						\
46     {						\
47       GNU_USER_TARGET_OS_CPP_BUILTINS();	\
48     }						\
49   while (0)
50 
51 
52 /* Target specific assembler settings.  */
53 /* Rewrite -march=arch* options to the original CPU name in order to
54    make it work with older binutils.  */
55 #undef  ASM_SPEC
56 #define ASM_SPEC					\
57   "%{m31&m64}%{mesa&mzarch}%{march=z*}"			\
58   "%{march=arch3:-march=g5}"				\
59   "%{march=arch5:-march=z900}"				\
60   "%{march=arch6:-march=z990}"				\
61   "%{march=arch7:-march=z9-ec}"				\
62   "%{march=arch8:-march=z10}"				\
63   "%{march=arch9:-march=z196}"				\
64   "%{march=arch10:-march=zEC12}"			\
65   "%{march=arch11:-march=z13}"
66 
67 
68 /* Target specific linker settings.  */
69 
70 #ifdef DEFAULT_TARGET_64BIT
71 #define MULTILIB_DEFAULTS { "m64" }
72 #else
73 #define MULTILIB_DEFAULTS { "m31" }
74 #endif
75 
76 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
77 #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
78 
79 #undef  LINK_SPEC
80 #define LINK_SPEC \
81   "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
82    %{shared:-shared} \
83    %{!shared: \
84       %{static:-static} \
85       %{!static:%{!static-pie: \
86 	%{rdynamic:-export-dynamic} \
87 	%{m31:-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
88 	%{m64:-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}}} \
89    %{static-pie:-static -pie --no-dynamic-linker -z text}"
90 
91 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
92 
93 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
94 
95 #ifdef TARGET_LIBC_PROVIDES_SSP
96 /* s390 glibc provides __stack_chk_guard in 0x14(tp),
97    s390x glibc provides it at 0x28(tp).  */
98 #define TARGET_THREAD_SSP_OFFSET        (TARGET_64BIT ? 0x28 : 0x14)
99 #endif
100 
101 /* Define if long doubles should be mangled as 'g'.  */
102 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
103 
104 #undef TARGET_LIBC_HAS_FUNCTION
105 #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
106 
107 /* Uninitialized common symbols in non-PIE executables, even with
108    strong definitions in dependent shared libraries, will resolve
109    to COPY relocated symbol in the executable.  See PR65780.  */
110 #undef TARGET_BINDS_LOCAL_P
111 #define TARGET_BINDS_LOCAL_P default_binds_local_p_2
112 
113 #endif
114