Fix PR 47408 and 47385
[official-gcc.git] / gcc / config / rs6000 / linux.h
blobed1d09ec14d5b58456daefd9a8a8acd1d819d1bf
1 /* Definitions of target machine for GNU compiler,
2 for PowerPC machines running Linux.
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4 2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
5 Contributed by Michael Meissner (meissner@cygnus.com).
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
24 process. */
25 #define OS_MISSING_POWERPC64 1
27 /* We use glibc _mcount for profiling. */
28 #define NO_PROFILE_COUNTERS 1
30 #ifdef SINGLE_LIBC
31 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
32 #else
33 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
34 #endif
36 /* glibc has float and long double forms of math functions. */
37 #undef TARGET_C99_FUNCTIONS
38 #define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
40 /* Whether we have sincos that follows the GNU extension. */
41 #undef TARGET_HAS_SINCOS
42 #define TARGET_HAS_SINCOS (OPTION_GLIBC)
44 #undef TARGET_OS_CPP_BUILTINS
45 #define TARGET_OS_CPP_BUILTINS() \
46 do \
47 { \
48 builtin_define_std ("PPC"); \
49 builtin_define_std ("powerpc"); \
50 builtin_assert ("cpu=powerpc"); \
51 builtin_assert ("machine=powerpc"); \
52 TARGET_OS_SYSV_CPP_BUILTINS (); \
53 } \
54 while (0)
56 #undef CPP_OS_DEFAULT_SPEC
57 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
59 /* The GNU C++ standard library currently requires _GNU_SOURCE being
60 defined on glibc-based systems. This temporary hack accomplishes this,
61 it should go away as soon as libstdc++-v3 has a real fix. */
62 #undef CPLUSPLUS_CPP_SPEC
63 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
65 #undef LINK_SHLIB_SPEC
66 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
68 #undef LIB_DEFAULT_SPEC
69 #define LIB_DEFAULT_SPEC "%(lib_linux)"
71 #undef STARTFILE_DEFAULT_SPEC
72 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
74 #undef ENDFILE_DEFAULT_SPEC
75 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
77 #undef LINK_START_DEFAULT_SPEC
78 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
80 #undef LINK_OS_DEFAULT_SPEC
81 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
83 #define LINK_GCC_C_SEQUENCE_SPEC \
84 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
86 /* Use --as-needed -lgcc_s for eh support. */
87 #ifdef HAVE_LD_AS_NEEDED
88 #define USE_LD_AS_NEEDED 1
89 #endif
91 #undef TARGET_VERSION
92 #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
94 /* Override rs6000.h definition. */
95 #undef ASM_APP_ON
96 #define ASM_APP_ON "#APP\n"
98 /* Override rs6000.h definition. */
99 #undef ASM_APP_OFF
100 #define ASM_APP_OFF "#NO_APP\n"
102 /* For backward compatibility, we must continue to use the AIX
103 structure return convention. */
104 #undef DRAFT_V4_STRUCT_RET
105 #define DRAFT_V4_STRUCT_RET 1
107 /* We are 32-bit all the time, so optimize a little. */
108 #undef TARGET_64BIT
109 #define TARGET_64BIT 0
111 /* We don't need to generate entries in .fixup, except when
112 -mrelocatable or -mrelocatable-lib is given. */
113 #undef RELOCATABLE_NEEDS_FIXUP
114 #define RELOCATABLE_NEEDS_FIXUP \
115 (target_flags & target_flags_explicit & MASK_RELOCATABLE)
117 #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
119 #define TARGET_POSIX_IO
121 #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
123 #ifdef TARGET_LIBC_PROVIDES_SSP
124 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
125 #define TARGET_THREAD_SSP_OFFSET -0x7008
126 #endif
128 #define POWERPC_LINUX
130 /* ppc linux has 128-bit long double support in glibc 2.4 and later. */
131 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
132 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
133 #endif
135 /* Static stack checking is supported by means of probes. */
136 #define STACK_CHECK_STATIC_BUILTIN 1