]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/rs6000/linux.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / rs6000 / linux.h
1 /* Definitions of target machine for GNU compiler,
2 for PowerPC machines running Linux.
3 Copyright (C) 1996-2024 Free Software Foundation, Inc.
4 Contributed by Michael Meissner (meissner@cygnus.com).
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published
10 by the Free Software Foundation; either version 3, or (at your
11 option) any later version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 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 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
23 process. */
24 #define OS_MISSING_POWERPC64 1
25
26 /* We use glibc _mcount for profiling. */
27 #define NO_PROFILE_COUNTERS 1
28
29 #ifdef SINGLE_LIBC
30 #define OPTION_GLIBC_P(opts) (DEFAULT_LIBC == LIBC_GLIBC)
31 #define OPTION_UCLIBC_P(opts) (DEFAULT_LIBC == LIBC_UCLIBC)
32 #define OPTION_BIONIC_P(opts) (DEFAULT_LIBC == LIBC_BIONIC)
33 #undef OPTION_MUSL_P
34 #define OPTION_MUSL_P(opts) (DEFAULT_LIBC == LIBC_MUSL)
35 #else
36 #define OPTION_GLIBC_P(opts) ((opts)->x_linux_libc == LIBC_GLIBC)
37 #define OPTION_UCLIBC_P(opts) ((opts)->x_linux_libc == LIBC_UCLIBC)
38 #define OPTION_BIONIC_P(opts) ((opts)->x_linux_libc == LIBC_BIONIC)
39 #undef OPTION_MUSL_P
40 #define OPTION_MUSL_P(opts) ((opts)->x_linux_libc == LIBC_MUSL)
41 #endif
42 #define OPTION_GLIBC OPTION_GLIBC_P (&global_options)
43 #define OPTION_UCLIBC OPTION_UCLIBC_P (&global_options)
44 #define OPTION_BIONIC OPTION_BIONIC_P (&global_options)
45 #undef OPTION_MUSL
46 #define OPTION_MUSL OPTION_MUSL_P (&global_options)
47
48 /* Determine what functions are present at the runtime;
49 this includes full c99 runtime and sincos. */
50 #undef TARGET_LIBC_HAS_FUNCTION
51 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
52
53 #undef TARGET_LIBM_FUNCTION_MAX_ERROR
54 #define TARGET_LIBM_FUNCTION_MAX_ERROR rs6000_linux_libm_function_max_error
55
56 #undef TARGET_OS_CPP_BUILTINS
57 #define TARGET_OS_CPP_BUILTINS() \
58 do \
59 { \
60 if (strcmp (rs6000_abi_name, "linux") == 0) \
61 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
62 builtin_define_std ("PPC"); \
63 builtin_define_std ("powerpc"); \
64 builtin_assert ("cpu=powerpc"); \
65 builtin_assert ("machine=powerpc"); \
66 TARGET_OS_SYSV_CPP_BUILTINS (); \
67 } \
68 while (0)
69
70 #undef CPP_OS_DEFAULT_SPEC
71 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
72
73 #undef LINK_SHLIB_SPEC
74 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
75 %{static-pie:-static -pie --no-dynamic-linker -z text}"
76
77 #undef LIB_DEFAULT_SPEC
78 #define LIB_DEFAULT_SPEC "%(lib_linux)"
79
80 #undef STARTFILE_DEFAULT_SPEC
81 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
82
83 #undef ENDFILE_DEFAULT_SPEC
84 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
85
86 #undef LINK_START_DEFAULT_SPEC
87 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
88
89 #undef LINK_OS_DEFAULT_SPEC
90 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
91
92 #undef DEFAULT_ASM_ENDIAN
93 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
94 #define DEFAULT_ASM_ENDIAN " -mlittle"
95 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux", \
96 " -m elf32lppclinux", \
97 " -m elf32lppclinux")
98 #else
99 #define DEFAULT_ASM_ENDIAN " -mbig"
100 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux", \
101 " -m elf32lppclinux", \
102 " -m elf32ppclinux")
103 #endif
104
105 #undef LINK_OS_LINUX_SPEC
106 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
107 %{!static-pie: \
108 %{rdynamic:-export-dynamic} \
109 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}}"
110
111 /* For backward compatibility, we must continue to use the AIX
112 structure return convention. */
113 #undef DRAFT_V4_STRUCT_RET
114 #define DRAFT_V4_STRUCT_RET 1
115
116 /* We are 32-bit all the time, so optimize a little. */
117 #undef TARGET_64BIT
118 #define TARGET_64BIT 0
119
120 /* We don't need to generate entries in .fixup, except when
121 -mrelocatable or -mrelocatable-lib is given. */
122 #undef RELOCATABLE_NEEDS_FIXUP
123 #define RELOCATABLE_NEEDS_FIXUP \
124 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
125
126 #undef RS6000_ABI_NAME
127 #define RS6000_ABI_NAME "linux"
128
129 #ifdef TARGET_LIBC_PROVIDES_SSP
130 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
131 #define TARGET_THREAD_SSP_OFFSET -0x7008
132 #endif
133
134 #define POWERPC_LINUX
135
136 /* ppc linux has 128-bit long double support in glibc 2.4 and later. */
137 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
138 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
139 #endif
140
141 /* Static stack checking is supported by means of probes. */
142 #define STACK_CHECK_STATIC_BUILTIN 1
143
144 /* Software floating point support for exceptions and rounding modes
145 depends on the C library in use. */
146 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
147 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
148 rs6000_linux_float_exceptions_rounding_supported_p
149
150 /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
151 on glibc 2.19 or greater. */
152 #if TARGET_GLIBC_MAJOR > 2 \
153 || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
154 #define RS6000_GLIBC_ATOMIC_FENV 1
155 #endif