190075Sobrien/* Definitions of target machine for GNU compiler,
2117395Skan   for PowerPC machines running Linux.
3169689Skan   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
4169689Skan   2004, 2005, 2006 Free Software Foundation, Inc.
590075Sobrien   Contributed by Michael Meissner (meissner@cygnus.com).
690075Sobrien
7132718Skan   This file is part of GCC.
890075Sobrien
9132718Skan   GCC is free software; you can redistribute it and/or modify it
10132718Skan   under the terms of the GNU General Public License as published
11132718Skan   by the Free Software Foundation; either version 2, or (at your
12132718Skan   option) any later version.
1390075Sobrien
14132718Skan   GCC is distributed in the hope that it will be useful, but WITHOUT
15132718Skan   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16132718Skan   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
17132718Skan   License for more details.
1890075Sobrien
19132718Skan   You should have received a copy of the GNU General Public License
20132718Skan   along with GCC; see the file COPYING.  If not, write to the
21169689Skan   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22169689Skan   MA 02110-1301, USA.  */
2390075Sobrien
2490075Sobrien#undef MD_EXEC_PREFIX
2590075Sobrien#undef MD_STARTFILE_PREFIX
2690075Sobrien
27146895Skan/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
28146895Skan   process.  */
29146895Skan#define OS_MISSING_POWERPC64 1
30146895Skan
31169689Skan/* We use glibc _mcount for profiling.  */
32169689Skan#define NO_PROFILE_COUNTERS 1
33169689Skan
34146895Skan/* glibc has float and long double forms of math functions.  */
35146895Skan#undef  TARGET_C99_FUNCTIONS
36169689Skan#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
37146895Skan
38132718Skan#undef  TARGET_OS_CPP_BUILTINS
39169689Skan#define TARGET_OS_CPP_BUILTINS()		\
40169689Skan  do						\
41169689Skan    {						\
42169689Skan      builtin_define_std ("PPC");		\
43169689Skan      builtin_define_std ("powerpc");		\
44169689Skan      builtin_assert ("cpu=powerpc");		\
45169689Skan      builtin_assert ("machine=powerpc");	\
46169689Skan      TARGET_OS_SYSV_CPP_BUILTINS ();		\
47169689Skan    }						\
48117395Skan  while (0)
4990075Sobrien
5090075Sobrien#undef	CPP_OS_DEFAULT_SPEC
5190075Sobrien#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
5290075Sobrien
5390075Sobrien/* The GNU C++ standard library currently requires _GNU_SOURCE being
5490075Sobrien   defined on glibc-based systems. This temporary hack accomplishes this,
5590075Sobrien   it should go away as soon as libstdc++-v3 has a real fix.  */
56132718Skan#undef  CPLUSPLUS_CPP_SPEC
5790075Sobrien#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
5890075Sobrien
59132718Skan#undef  LINK_SHLIB_SPEC
6090075Sobrien#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
6190075Sobrien
6290075Sobrien#undef	LIB_DEFAULT_SPEC
6390075Sobrien#define LIB_DEFAULT_SPEC "%(lib_linux)"
6490075Sobrien
6590075Sobrien#undef	STARTFILE_DEFAULT_SPEC
6690075Sobrien#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
6790075Sobrien
6890075Sobrien#undef	ENDFILE_DEFAULT_SPEC
6990075Sobrien#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
7090075Sobrien
7190075Sobrien#undef	LINK_START_DEFAULT_SPEC
7290075Sobrien#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
7390075Sobrien
7490075Sobrien#undef	LINK_OS_DEFAULT_SPEC
7590075Sobrien#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
7690075Sobrien
77132718Skan#define LINK_GCC_C_SEQUENCE_SPEC \
78132718Skan  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
79132718Skan
80169689Skan/* Use --as-needed -lgcc_s for eh support.  */
81169689Skan#ifdef HAVE_LD_AS_NEEDED
82169689Skan#define USE_LD_AS_NEEDED 1
83169689Skan#endif
84169689Skan
85132718Skan#undef  TARGET_VERSION
8690075Sobrien#define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
8790075Sobrien
8890075Sobrien/* Override rs6000.h definition.  */
89132718Skan#undef  ASM_APP_ON
9090075Sobrien#define ASM_APP_ON "#APP\n"
9190075Sobrien
9290075Sobrien/* Override rs6000.h definition.  */
93132718Skan#undef  ASM_APP_OFF
9490075Sobrien#define ASM_APP_OFF "#NO_APP\n"
9590075Sobrien
9690075Sobrien/* For backward compatibility, we must continue to use the AIX
9790075Sobrien   structure return convention.  */
98132718Skan#undef  DRAFT_V4_STRUCT_RET
9990075Sobrien#define DRAFT_V4_STRUCT_RET 1
10090075Sobrien
101132718Skan/* We are 32-bit all the time, so optimize a little.  */
102132718Skan#undef TARGET_64BIT
103132718Skan#define TARGET_64BIT 0
104132718Skan
105146895Skan/* We don't need to generate entries in .fixup, except when
106146895Skan   -mrelocatable or -mrelocatable-lib is given.  */
107132718Skan#undef RELOCATABLE_NEEDS_FIXUP
108146895Skan#define RELOCATABLE_NEEDS_FIXUP \
109146895Skan  (target_flags & target_flags_explicit & MASK_RELOCATABLE)
110132718Skan
111132718Skan#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
112132718Skan
113169689Skan#define TARGET_POSIX_IO
114132718Skan
115169689Skan#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
116169689Skan
117169689Skan#ifdef TARGET_LIBC_PROVIDES_SSP
118169689Skan/* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
119169689Skan#define TARGET_THREAD_SSP_OFFSET	-0x7008
12090075Sobrien#endif
121169689Skan
122169689Skan#define POWERPC_LINUX
123169689Skan
124169689Skan/* ppc linux has 128-bit long double support in glibc 2.4 and later.  */
125169689Skan#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
126169689Skan#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
127169689Skan#endif
128