Replace "GNU CC" with "GCC"
[official-gcc.git] / gcc / config / rs6000 / linux.h
blobc8322bbfb901b65b7f87f76b14d1c9c01a7f0333
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 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 2, 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 COPYING. If not, write to the
21 Free Software Foundation, 59 Temple Place - Suite 330, Boston,
22 MA 02111-1307, USA. */
24 #undef MD_EXEC_PREFIX
25 #undef MD_STARTFILE_PREFIX
27 #undef TARGET_OS_CPP_BUILTINS
28 #define TARGET_OS_CPP_BUILTINS() \
29 do \
30 { \
31 builtin_define_std ("PPC"); \
32 builtin_define ("__ELF__"); \
33 builtin_define_std ("powerpc"); \
34 builtin_assert ("cpu=powerpc"); \
35 builtin_assert ("machine=powerpc"); \
36 } \
37 while (0)
39 #undef CPP_OS_DEFAULT_SPEC
40 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
42 /* The GNU C++ standard library currently requires _GNU_SOURCE being
43 defined on glibc-based systems. This temporary hack accomplishes this,
44 it should go away as soon as libstdc++-v3 has a real fix. */
45 #undef CPLUSPLUS_CPP_SPEC
46 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
48 #undef LINK_SHLIB_SPEC
49 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
51 #undef LIB_DEFAULT_SPEC
52 #define LIB_DEFAULT_SPEC "%(lib_linux)"
54 #undef STARTFILE_DEFAULT_SPEC
55 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
57 #undef ENDFILE_DEFAULT_SPEC
58 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
60 #undef LINK_START_DEFAULT_SPEC
61 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
63 #undef LINK_OS_DEFAULT_SPEC
64 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
66 #undef TARGET_VERSION
67 #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
69 /* Override rs6000.h definition. */
70 #undef ASM_APP_ON
71 #define ASM_APP_ON "#APP\n"
73 /* Override rs6000.h definition. */
74 #undef ASM_APP_OFF
75 #define ASM_APP_OFF "#NO_APP\n"
77 /* For backward compatibility, we must continue to use the AIX
78 structure return convention. */
79 #undef DRAFT_V4_STRUCT_RET
80 #define DRAFT_V4_STRUCT_RET 1
82 /* Do code reading to identify a signal frame, and set the frame
83 state data appropriately. See unwind-dw2.c for the structs. */
85 #ifdef IN_LIBGCC2
86 #include <signal.h>
87 #include <sys/ucontext.h>
89 enum { SIGNAL_FRAMESIZE = 64 };
90 #endif
92 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
93 do { \
94 unsigned char *pc_ = (CONTEXT)->ra; \
95 struct sigcontext *sc_; \
96 long new_cfa_; \
97 int i_; \
99 /* li r0, 0x7777; sc (sigreturn old) */ \
100 /* li r0, 0x0077; sc (sigreturn new) */ \
101 /* li r0, 0x6666; sc (rt_sigreturn old) */ \
102 /* li r0, 0x00AC; sc (rt_sigreturn new) */ \
103 if (*(unsigned int *) (pc_+4) != 0x44000002) \
104 break; \
105 if (*(unsigned int *) (pc_+0) == 0x38007777 \
106 || *(unsigned int *) (pc_+0) == 0x38000077) \
108 struct sigframe { \
109 char gap[SIGNAL_FRAMESIZE]; \
110 struct sigcontext sigctx; \
111 } *rt_ = (CONTEXT)->cfa; \
112 sc_ = &rt_->sigctx; \
114 else if (*(unsigned int *) (pc_+0) == 0x38006666 \
115 || *(unsigned int *) (pc_+0) == 0x380000AC) \
117 struct rt_sigframe { \
118 char gap[SIGNAL_FRAMESIZE]; \
119 unsigned long _unused[2]; \
120 struct siginfo *pinfo; \
121 void *puc; \
122 struct siginfo info; \
123 struct ucontext uc; \
124 } *rt_ = (CONTEXT)->cfa; \
125 sc_ = &rt_->uc.uc_mcontext; \
127 else \
128 break; \
130 new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \
131 (FS)->cfa_how = CFA_REG_OFFSET; \
132 (FS)->cfa_reg = STACK_POINTER_REGNUM; \
133 (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \
135 for (i_ = 0; i_ < 32; i_++) \
136 if (i_ != STACK_POINTER_REGNUM) \
138 (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
139 (FS)->regs.reg[i_].loc.offset \
140 = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \
143 (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \
144 (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \
145 = (long)&(sc_->regs->link) - new_cfa_; \
147 /* The unwinder expects the IP to point to the following insn, \
148 whereas the kernel returns the address of the actual \
149 faulting insn. We store NIP+4 in an unused register slot to \
150 get the same result for multiple evaluation of the same signal \
151 frame. */ \
152 sc_->regs->gpr[47] = sc_->regs->nip + 4; \
153 (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \
154 (FS)->regs.reg[CR0_REGNO].loc.offset \
155 = (long)&(sc_->regs->gpr[47]) - new_cfa_; \
156 (FS)->retaddr_column = CR0_REGNO; \
157 goto SUCCESS; \
158 } while (0)