linux.h revision 169689
1139749Simp/* Definitions of target machine for GNU compiler,
284059Swpaul   for PowerPC machines running Linux.
384059Swpaul   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
484059Swpaul   2004, 2005, 2006 Free Software Foundation, Inc.
584059Swpaul   Contributed by Michael Meissner (meissner@cygnus.com).
684059Swpaul
784059Swpaul   This file is part of GCC.
884059Swpaul
984059Swpaul   GCC is free software; you can redistribute it and/or modify it
1084059Swpaul   under the terms of the GNU General Public License as published
1184059Swpaul   by the Free Software Foundation; either version 2, or (at your
1284059Swpaul   option) any later version.
1384059Swpaul
1484059Swpaul   GCC is distributed in the hope that it will be useful, but WITHOUT
1584059Swpaul   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1684059Swpaul   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
1784059Swpaul   License for more details.
1884059Swpaul
1984059Swpaul   You should have received a copy of the GNU General Public License
2084059Swpaul   along with GCC; see the file COPYING.  If not, write to the
2184059Swpaul   Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
2284059Swpaul   MA 02110-1301, USA.  */
2384059Swpaul
2484059Swpaul#undef MD_EXEC_PREFIX
2584059Swpaul#undef MD_STARTFILE_PREFIX
2684059Swpaul
2784059Swpaul/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
2884059Swpaul   process.  */
2984059Swpaul#define OS_MISSING_POWERPC64 1
3084059Swpaul
3184059Swpaul/* We use glibc _mcount for profiling.  */
3284059Swpaul#define NO_PROFILE_COUNTERS 1
3384059Swpaul
3484059Swpaul/* glibc has float and long double forms of math functions.  */
3584059Swpaul#undef  TARGET_C99_FUNCTIONS
3684059Swpaul#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
3784059Swpaul
3884059Swpaul#undef  TARGET_OS_CPP_BUILTINS
3984059Swpaul#define TARGET_OS_CPP_BUILTINS()		\
4084059Swpaul  do						\
4184059Swpaul    {						\
4284059Swpaul      builtin_define_std ("PPC");		\
4384059Swpaul      builtin_define_std ("powerpc");		\
4484059Swpaul      builtin_assert ("cpu=powerpc");		\
4584059Swpaul      builtin_assert ("machine=powerpc");	\
4684059Swpaul      TARGET_OS_SYSV_CPP_BUILTINS ();		\
4784059Swpaul    }						\
4884059Swpaul  while (0)
4984059Swpaul
5084059Swpaul#undef	CPP_OS_DEFAULT_SPEC
5184059Swpaul#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
5284059Swpaul
5384059Swpaul/* The GNU C++ standard library currently requires _GNU_SOURCE being
5484059Swpaul   defined on glibc-based systems. This temporary hack accomplishes this,
5584059Swpaul   it should go away as soon as libstdc++-v3 has a real fix.  */
5684059Swpaul#undef  CPLUSPLUS_CPP_SPEC
5784059Swpaul#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
5884059Swpaul
5984059Swpaul#undef  LINK_SHLIB_SPEC
6084059Swpaul#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
6184059Swpaul
6284059Swpaul#undef	LIB_DEFAULT_SPEC
6384059Swpaul#define LIB_DEFAULT_SPEC "%(lib_linux)"
64166676Sjkim
65166676Sjkim#undef	STARTFILE_DEFAULT_SPEC
66166676Sjkim#define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
67166676Sjkim
68166676Sjkim#undef	ENDFILE_DEFAULT_SPEC
69166676Sjkim#define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
70166676Sjkim
71166676Sjkim#undef	LINK_START_DEFAULT_SPEC
72166676Sjkim#define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
73166676Sjkim
74166676Sjkim#undef	LINK_OS_DEFAULT_SPEC
75166676Sjkim#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
76166676Sjkim
77166676Sjkim#define LINK_GCC_C_SEQUENCE_SPEC \
78166676Sjkim  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
79166676Sjkim
80166676Sjkim/* Use --as-needed -lgcc_s for eh support.  */
81166676Sjkim#ifdef HAVE_LD_AS_NEEDED
82166676Sjkim#define USE_LD_AS_NEEDED 1
83166676Sjkim#endif
84166676Sjkim
85214428Syongari#undef  TARGET_VERSION
86166676Sjkim#define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
87166676Sjkim
8884059Swpaul/* Override rs6000.h definition.  */
89166676Sjkim#undef  ASM_APP_ON
90166676Sjkim#define ASM_APP_ON "#APP\n"
91166676Sjkim
92166676Sjkim/* Override rs6000.h definition.  */
9384059Swpaul#undef  ASM_APP_OFF
94166676Sjkim#define ASM_APP_OFF "#NO_APP\n"
95166676Sjkim
96166676Sjkim/* For backward compatibility, we must continue to use the AIX
97166676Sjkim   structure return convention.  */
98166676Sjkim#undef  DRAFT_V4_STRUCT_RET
99166676Sjkim#define DRAFT_V4_STRUCT_RET 1
100166676Sjkim
101166676Sjkim/* We are 32-bit all the time, so optimize a little.  */
102166676Sjkim#undef TARGET_64BIT
103166676Sjkim#define TARGET_64BIT 0
104214428Syongari
105214428Syongari/* We don't need to generate entries in .fixup, except when
10684059Swpaul   -mrelocatable or -mrelocatable-lib is given.  */
10784059Swpaul#undef RELOCATABLE_NEEDS_FIXUP
108166676Sjkim#define RELOCATABLE_NEEDS_FIXUP \
109166676Sjkim  (target_flags & target_flags_explicit & MASK_RELOCATABLE)
110166676Sjkim
111166676Sjkim#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
112166676Sjkim
113166676Sjkim#define TARGET_POSIX_IO
114166676Sjkim
115166676Sjkim#define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h"
116166676Sjkim
117166676Sjkim#ifdef TARGET_LIBC_PROVIDES_SSP
118166676Sjkim/* ppc32 glibc provides __stack_chk_guard in -0x7008(2).  */
119166676Sjkim#define TARGET_THREAD_SSP_OFFSET	-0x7008
120166676Sjkim#endif
121166676Sjkim
122166676Sjkim#define POWERPC_LINUX
123166676Sjkim
124166676Sjkim/* ppc linux has 128-bit long double support in glibc 2.4 and later.  */
125166676Sjkim#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
12684059Swpaul#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
12784059Swpaul#endif
12884059Swpaul