]>
Commit | Line | Data |
---|---|---|
9a57586f | 1 | /* Definitions of target machine for GNU compiler, |
a0a843c7 GK |
2 | for powerpc machines running Linux. |
3 | Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, | |
4 | Inc. | |
9a57586f MM |
5 | Contributed by Michael Meissner (meissner@cygnus.com). |
6 | ||
7 | This file is part of GNU CC. | |
8 | ||
9 | GNU CC is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU CC is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GNU CC; see the file COPYING. If not, write to | |
5f38fdda JL |
21 | the Free Software Foundation, 59 Temple Place - Suite 330, |
22 | Boston, MA 02111-1307, USA. */ | |
9a57586f | 23 | |
82e41834 | 24 | /* Don't assume anything about the header files. */ |
bd227acc FS |
25 | #define NO_IMPLICIT_EXTERN_C |
26 | ||
27 | #undef MD_EXEC_PREFIX | |
28 | #undef MD_STARTFILE_PREFIX | |
29 | ||
7990b46f MK |
30 | #undef TARGET_OS_CPP_BUILTINS |
31 | #define TARGET_OS_CPP_BUILTINS() \ | |
32 | do \ | |
33 | { \ | |
34 | builtin_define_std ("PPC"); \ | |
35 | builtin_define ("__ELF__"); \ | |
36 | builtin_define_std ("powerpc"); \ | |
37 | builtin_assert ("cpu=powerpc"); \ | |
38 | builtin_assert ("machine=powerpc"); \ | |
39 | } \ | |
40 | while (0) | |
9a57586f | 41 | |
373107aa FS |
42 | #undef CPP_OS_DEFAULT_SPEC |
43 | #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" | |
44 | ||
437558e8 FS |
45 | /* The GNU C++ standard library currently requires _GNU_SOURCE being |
46 | defined on glibc-based systems. This temporary hack accomplishes this, | |
47 | it should go away as soon as libstdc++-v3 has a real fix. */ | |
48 | #undef CPLUSPLUS_CPP_SPEC | |
49 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
50 | ||
362c63a5 GK |
51 | #undef LINK_SHLIB_SPEC |
52 | #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" | |
9a57586f MM |
53 | |
54 | #undef LIB_DEFAULT_SPEC | |
0bc25b2b | 55 | #define LIB_DEFAULT_SPEC "%(lib_linux)" |
9a57586f MM |
56 | |
57 | #undef STARTFILE_DEFAULT_SPEC | |
0bc25b2b | 58 | #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)" |
9a57586f MM |
59 | |
60 | #undef ENDFILE_DEFAULT_SPEC | |
0bc25b2b | 61 | #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)" |
9a57586f | 62 | |
362c63a5 GK |
63 | #undef LINK_START_DEFAULT_SPEC |
64 | #define LINK_START_DEFAULT_SPEC "%(link_start_linux)" | |
65 | ||
66 | #undef LINK_OS_DEFAULT_SPEC | |
67 | #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" | |
68 | ||
9a57586f | 69 | #undef TARGET_VERSION |
956d6950 | 70 | #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)"); |
3807773b | 71 | |
832ea3b3 FS |
72 | /* Override rs6000.h definition. */ |
73 | #undef ASM_APP_ON | |
74 | #define ASM_APP_ON "#APP\n" | |
75 | ||
76 | /* Override rs6000.h definition. */ | |
77 | #undef ASM_APP_OFF | |
78 | #define ASM_APP_OFF "#NO_APP\n" | |
79 | ||
6fa3f289 ZW |
80 | /* For backward compatibility, we must continue to use the AIX |
81 | structure return convention. */ | |
82 | #undef DRAFT_V4_STRUCT_RET | |
83 | #define DRAFT_V4_STRUCT_RET 1 | |
84 | ||
da502956 AH |
85 | /* Do code reading to identify a signal frame, and set the frame |
86 | state data appropriately. See unwind-dw2.c for the structs. */ | |
87 | ||
88 | #ifdef IN_LIBGCC2 | |
89 | #include <signal.h> | |
90 | #include <sys/ucontext.h> | |
a0a843c7 GK |
91 | |
92 | enum { SIGNAL_FRAMESIZE = 64 }; | |
da502956 AH |
93 | #endif |
94 | ||
95 | #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ | |
96 | do { \ | |
97 | unsigned char *pc_ = (CONTEXT)->ra; \ | |
98 | struct sigcontext *sc_; \ | |
99 | long new_cfa_; \ | |
100 | int i_; \ | |
101 | \ | |
102 | /* li r0, 0x7777; sc (rt_sigreturn) */ \ | |
103 | /* li r0, 0x6666; sc (sigreturn) */ \ | |
104 | if (((*(unsigned int *) (pc_+0) == 0x38007777) \ | |
105 | || (*(unsigned int *) (pc_+0) == 0x38006666)) \ | |
106 | && (*(unsigned int *) (pc_+4) == 0x44000002)) \ | |
a0a843c7 | 107 | sc_ = (CONTEXT)->cfa + SIGNAL_FRAMESIZE; \ |
da502956 AH |
108 | else \ |
109 | break; \ | |
110 | \ | |
111 | new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \ | |
112 | (FS)->cfa_how = CFA_REG_OFFSET; \ | |
113 | (FS)->cfa_reg = STACK_POINTER_REGNUM; \ | |
114 | (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ | |
115 | \ | |
116 | for (i_ = 0; i_ < 32; i_++) \ | |
117 | if (i_ != STACK_POINTER_REGNUM) \ | |
118 | { \ | |
119 | (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ | |
120 | (FS)->regs.reg[i_].loc.offset \ | |
121 | = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \ | |
122 | } \ | |
123 | \ | |
124 | (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \ | |
125 | (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ | |
126 | = (long)&(sc_->regs->link) - new_cfa_; \ | |
127 | \ | |
128 | /* The unwinder expects the IP to point to the following insn, \ | |
129 | whereas the kernel returns the address of the actual \ | |
130 | faulting insn. */ \ | |
131 | sc_->regs->nip += 4; \ | |
132 | (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \ | |
133 | (FS)->regs.reg[CR0_REGNO].loc.offset \ | |
134 | = (long)&(sc_->regs->nip) - new_cfa_; \ | |
135 | (FS)->retaddr_column = CR0_REGNO; \ | |
136 | goto SUCCESS; \ | |
137 | } while (0) | |
138 |