xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/config/rs6000/linux.h (revision a24efa7dea9f1f56c3bdb15a927d3516792ace1c)
1 /* Definitions of target machine for GNU compiler,
2    for PowerPC machines running Linux.
3    Copyright (C) 1996-2013 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  (DEFAULT_LIBC == LIBC_GLIBC)
31 #else
32 #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
33 #endif
34 
35 /* glibc has float and long double forms of math functions.  */
36 #undef  TARGET_C99_FUNCTIONS
37 #define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
38 
39 /* Whether we have sincos that follows the GNU extension.  */
40 #undef  TARGET_HAS_SINCOS
41 #define TARGET_HAS_SINCOS (OPTION_GLIBC)
42 
43 #undef  TARGET_OS_CPP_BUILTINS
44 #define TARGET_OS_CPP_BUILTINS()		\
45   do						\
46     {						\
47       builtin_define_std ("PPC");		\
48       builtin_define_std ("powerpc");		\
49       builtin_assert ("cpu=powerpc");		\
50       builtin_assert ("machine=powerpc");	\
51       TARGET_OS_SYSV_CPP_BUILTINS ();		\
52     }						\
53   while (0)
54 
55 #undef	CPP_OS_DEFAULT_SPEC
56 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
57 
58 /* The GNU C++ standard library currently requires _GNU_SOURCE being
59    defined on glibc-based systems. This temporary hack accomplishes this,
60    it should go away as soon as libstdc++-v3 has a real fix.  */
61 #undef  CPLUSPLUS_CPP_SPEC
62 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
63 
64 #undef  LINK_SHLIB_SPEC
65 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
66 
67 #undef	LIB_DEFAULT_SPEC
68 #define LIB_DEFAULT_SPEC "%(lib_linux)"
69 
70 #undef	STARTFILE_DEFAULT_SPEC
71 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
72 
73 #undef	ENDFILE_DEFAULT_SPEC
74 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
75 
76 #undef	LINK_START_DEFAULT_SPEC
77 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
78 
79 #undef	LINK_OS_DEFAULT_SPEC
80 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
81 
82 #undef  DEFAULT_ASM_ENDIAN
83 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
84 #define DEFAULT_ASM_ENDIAN " -mlittle"
85 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux",	\
86 					 " -m elf32lppclinux",	\
87 					 " -m elf32lppclinux")
88 #else
89 #define DEFAULT_ASM_ENDIAN " -mbig"
90 #define LINK_OS_LINUX_EMUL ENDIAN_SELECT(" -m elf32ppclinux",	\
91 					 " -m elf32lppclinux",	\
92 					 " -m elf32ppclinux")
93 #endif
94 
95 #undef LINK_OS_LINUX_SPEC
96 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
97   %{rdynamic:-export-dynamic} \
98   -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
99 
100 #define LINK_GCC_C_SEQUENCE_SPEC \
101   "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
102 
103 /* Use --as-needed -lgcc_s for eh support.  */
104 #ifdef HAVE_LD_AS_NEEDED
105 #define USE_LD_AS_NEEDED 1
106 #endif
107 
108 /* Override rs6000.h definition.  */
109 #undef  ASM_APP_ON
110 #define ASM_APP_ON "#APP\n"
111 
112 /* Override rs6000.h definition.  */
113 #undef  ASM_APP_OFF
114 #define ASM_APP_OFF "#NO_APP\n"
115 
116 /* For backward compatibility, we must continue to use the AIX
117    structure return convention.  */
118 #undef  DRAFT_V4_STRUCT_RET
119 #define DRAFT_V4_STRUCT_RET 1
120 
121 /* We are 32-bit all the time, so optimize a little.  */
122 #undef TARGET_64BIT
123 #define TARGET_64BIT 0
124 
125 /* We don't need to generate entries in .fixup, except when
126    -mrelocatable or -mrelocatable-lib is given.  */
127 #undef RELOCATABLE_NEEDS_FIXUP
128 #define RELOCATABLE_NEEDS_FIXUP \
129   (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
130 
131 #define TARGET_POSIX_IO
132 
133 #ifdef TARGET_LIBC_PROVIDES_SSP
134 /* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
135 #define TARGET_THREAD_SSP_OFFSET	-0x7008
136 #endif
137 
138 #define POWERPC_LINUX
139 
140 /* ppc linux has 128-bit long double support in glibc 2.4 and later.  */
141 #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
142 #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
143 #endif
144 
145 /* Static stack checking is supported by means of probes.  */
146 #define STACK_CHECK_STATIC_BUILTIN 1
147