Merge from trunk:
[official-gcc.git] / main / gcc / config / rs6000 / linux.h
blob7c83f1e78efc06e21e82e1ff519f08c7159b10b3
1 /* Definitions of target machine for GNU compiler,
2 for PowerPC machines running Linux.
3 Copyright (C) 1996-2014 Free Software Foundation, Inc.
4 Contributed by Michael Meissner (meissner@cygnus.com).
6 This file is part of GCC.
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.
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.
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/>. */
22 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
23 process. */
24 #define OS_MISSING_POWERPC64 1
26 /* We use glibc _mcount for profiling. */
27 #define NO_PROFILE_COUNTERS 1
29 #ifdef SINGLE_LIBC
30 #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
31 #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
32 #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
33 #else
34 #define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
35 #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
36 #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
37 #endif
39 /* Determine what functions are present at the runtime;
40 this includes full c99 runtime and sincos. */
41 #undef TARGET_LIBC_HAS_FUNCTION
42 #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
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 #undef LINK_SHLIB_SPEC
60 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
62 #undef LIB_DEFAULT_SPEC
63 #define LIB_DEFAULT_SPEC "%(lib_linux)"
65 #undef STARTFILE_DEFAULT_SPEC
66 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
68 #undef ENDFILE_DEFAULT_SPEC
69 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
71 #undef LINK_START_DEFAULT_SPEC
72 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
74 #undef LINK_OS_DEFAULT_SPEC
75 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
77 #undef DEFAULT_ASM_ENDIAN
78 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
79 #define DEFAULT_ASM_ENDIAN " -mlittle"
80 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux", \
81 " -m elf32lppclinux", \
82 " -m elf32lppclinux")
83 #else
84 #define DEFAULT_ASM_ENDIAN " -mbig"
85 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux", \
86 " -m elf32lppclinux", \
87 " -m elf32ppclinux")
88 #endif
90 #undef LINK_OS_LINUX_SPEC
91 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
92 %{rdynamic:-export-dynamic} \
93 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
95 /* For backward compatibility, we must continue to use the AIX
96 structure return convention. */
97 #undef DRAFT_V4_STRUCT_RET
98 #define DRAFT_V4_STRUCT_RET 1
100 /* We are 32-bit all the time, so optimize a little. */
101 #undef TARGET_64BIT
102 #define TARGET_64BIT 0
104 /* We don't need to generate entries in .fixup, except when
105 -mrelocatable or -mrelocatable-lib is given. */
106 #undef RELOCATABLE_NEEDS_FIXUP
107 #define RELOCATABLE_NEEDS_FIXUP \
108 (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
110 #ifdef TARGET_LIBC_PROVIDES_SSP
111 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */
112 #define TARGET_THREAD_SSP_OFFSET -0x7008
113 #endif
115 #define POWERPC_LINUX
117 /* ppc linux has 128-bit long double support in glibc 2.4 and later. */
118 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
119 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
120 #endif
122 /* Static stack checking is supported by means of probes. */
123 #define STACK_CHECK_STATIC_BUILTIN 1
125 /* Software floating point support for exceptions and rounding modes
126 depends on the C library in use. */
127 #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
128 #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
129 rs6000_linux_float_exceptions_rounding_supported_p