1 /* Definitions of target machine for GNU compiler,
2 for IBM RS/6000 running AIX version 3.1.
3 Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
4 Contributed by Michael Meissner (meissner@cygnus.com).
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Don't assume anything about the header files. */
24 #define NO_IMPLICIT_EXTERN_C
27 #undef MD_STARTFILE_PREFIX
30 #define CPP_PREDEFINES \
31 "-DPPC -D__ELF__ -Dpowerpc -Acpu=powerpc -Amachine=powerpc"
33 #undef CPP_OS_DEFAULT_SPEC
34 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
36 #undef LINK_SHLIB_SPEC
37 #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
39 #undef LIB_DEFAULT_SPEC
40 #define LIB_DEFAULT_SPEC "%(lib_linux)"
42 #undef STARTFILE_DEFAULT_SPEC
43 #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
45 #undef ENDFILE_DEFAULT_SPEC
46 #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
48 #undef LINK_START_DEFAULT_SPEC
49 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
51 #undef LINK_OS_DEFAULT_SPEC
52 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
55 #define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
57 /* Override rs6000.h definition. */
59 #define ASM_APP_ON "#APP\n"
61 /* Override rs6000.h definition. */
63 #define ASM_APP_OFF "#NO_APP\n"
65 #undef DEFAULT_VTABLE_THUNKS
67 #define DEFAULT_VTABLE_THUNKS 1
70 /* Do code reading to identify a signal frame, and set the frame
71 state data appropriately. See unwind-dw2.c for the structs. */
75 #include <sys/ucontext.h>
78 #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
80 unsigned char *pc_ = (CONTEXT)->ra; \
81 struct sigcontext *sc_; \
85 /* li r0, 0x7777; sc (rt_sigreturn) */ \
86 /* li r0, 0x6666; sc (sigreturn) */ \
87 if (((*(unsigned int *) (pc_+0) == 0x38007777) \
88 || (*(unsigned int *) (pc_+0) == 0x38006666)) \
89 && (*(unsigned int *) (pc_+4) == 0x44000002)) \
90 sc_ = (CONTEXT)->cfa + __SIGNAL_FRAMESIZE; \
94 new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \
95 (FS)->cfa_how = CFA_REG_OFFSET; \
96 (FS)->cfa_reg = STACK_POINTER_REGNUM; \
97 (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \
99 for (i_ = 0; i_ < 32; i_++) \
100 if (i_ != STACK_POINTER_REGNUM) \
102 (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
103 (FS)->regs.reg[i_].loc.offset \
104 = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \
107 (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \
108 (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \
109 = (long)&(sc_->regs->link) - new_cfa_; \
111 /* The unwinder expects the IP to point to the following insn, \
112 whereas the kernel returns the address of the actual \
114 sc_->regs->nip += 4; \
115 (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \
116 (FS)->regs.reg[CR0_REGNO].loc.offset \
117 = (long)&(sc_->regs->nip) - new_cfa_; \
118 (FS)->retaddr_column = CR0_REGNO; \