diff options
Diffstat (limited to 'gcc/config/rs6000/linux64.h')
-rw-r--r-- | gcc/config/rs6000/linux64.h | 192 |
1 files changed, 11 insertions, 181 deletions
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index fd0eea58de8..3c920bb8cd5 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for 64 bit PowerPC linux. - Copyright (C) 2000, 2001, 2002, 2003, 2004 + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GCC. @@ -53,8 +53,11 @@ #undef PROCESSOR_DEFAULT64 #define PROCESSOR_DEFAULT64 PROCESSOR_PPC630 -#undef TARGET_RELOCATABLE -#define TARGET_RELOCATABLE (!TARGET_64BIT && (target_flags & MASK_RELOCATABLE)) +/* We don't need to generate entries in .fixup, except when + -mrelocatable or -mrelocatable-lib is given. */ +#undef RELOCATABLE_NEEDS_FIXUP +#define RELOCATABLE_NEEDS_FIXUP \ + (target_flags & target_flags_explicit & MASK_RELOCATABLE) #undef RS6000_ABI_NAME #define RS6000_ABI_NAME (TARGET_64BIT ? "aixdesc" : "sysv") @@ -188,6 +191,8 @@ #define TARGET_EABI 0 #undef TARGET_PROTOTYPE #define TARGET_PROTOTYPE 0 +#undef RELOCATABLE_NEEDS_FIXUP +#define RELOCATABLE_NEEDS_FIXUP 0 #endif @@ -212,9 +217,6 @@ #define PROFILE_HOOK(LABEL) \ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) -/* We don't need to generate entries in .fixup. */ -#undef RELOCATABLE_NEEDS_FIXUP - /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ @@ -549,187 +551,15 @@ while (0) #undef DRAFT_V4_STRUCT_RET #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack +#define TARGET_ASM_FILE_END rs6000_elf_end_indicate_exec_stack #define TARGET_HAS_F_SETLKW #define LINK_GCC_C_SEQUENCE_SPEC \ "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" -/* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -#if defined(IN_LIBGCC2) && !defined(inhibit_libc) -#include <signal.h> -#ifdef __powerpc64__ -#include <sys/ucontext.h> - -enum { SIGNAL_FRAMESIZE = 128 }; - -#else - -/* During the 2.5 kernel series the kernel ucontext was changed, but - the new layout is compatible with the old one, so we just define - and use the old one here for simplicity and compatibility. */ - -struct kernel_old_ucontext { - unsigned long uc_flags; - struct ucontext *uc_link; - stack_t uc_stack; - struct sigcontext_struct uc_mcontext; - sigset_t uc_sigmask; -}; -enum { SIGNAL_FRAMESIZE = 64 }; -#endif - -#ifdef __powerpc64__ - -/* If the current unwind info (FS) does not contain explicit info - saving R2, then we have to do a minor amount of code reading to - figure out if it was saved. The big problem here is that the - code that does the save/restore is generated by the linker, so - we have no good way to determine at compile time what to do. */ - -#define MD_FROB_UPDATE_CONTEXT(CTX, FS) \ - do { \ - if ((FS)->regs.reg[2].how == REG_UNSAVED) \ - { \ - unsigned int *insn \ - = (unsigned int *) \ - _Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \ - if (*insn == 0xE8410028) \ - _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \ - } \ - } while (0) - -#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ - do { \ - unsigned char *pc_ = (CONTEXT)->ra; \ - struct sigcontext *sc_; \ - long new_cfa_; \ - int i_; \ - \ - /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */ \ - /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */ \ - if (*(unsigned int *) (pc_+0) != 0x38210000 + SIGNAL_FRAMESIZE \ - || *(unsigned int *) (pc_+8) != 0x44000002) \ - break; \ - if (*(unsigned int *) (pc_+4) == 0x38000077) \ - { \ - struct sigframe { \ - char gap[SIGNAL_FRAMESIZE]; \ - struct sigcontext sigctx; \ - } *rt_ = (CONTEXT)->cfa; \ - sc_ = &rt_->sigctx; \ - } \ - else if (*(unsigned int *) (pc_+4) == 0x380000AC) \ - { \ - struct rt_sigframe { \ - int tramp[6]; \ - struct siginfo *pinfo; \ - struct ucontext *puc; \ - } *rt_ = (struct rt_sigframe *) pc_; \ - sc_ = &rt_->puc->uc_mcontext; \ - } \ - else \ - break; \ - \ - new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \ - (FS)->cfa_how = CFA_REG_OFFSET; \ - (FS)->cfa_reg = STACK_POINTER_REGNUM; \ - (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ - \ - for (i_ = 0; i_ < 32; i_++) \ - if (i_ != STACK_POINTER_REGNUM) \ - { \ - (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[i_].loc.offset \ - = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \ - } \ - \ - (FS)->regs.reg[CR2_REGNO].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[CR2_REGNO].loc.offset \ - = (long)&(sc_->regs->ccr) - new_cfa_; \ - \ - (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ - = (long)&(sc_->regs->link) - new_cfa_; \ - \ - (FS)->regs.reg[ARG_POINTER_REGNUM].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[ARG_POINTER_REGNUM].loc.offset \ - = (long)&(sc_->regs->nip) - new_cfa_; \ - (FS)->retaddr_column = ARG_POINTER_REGNUM; \ - goto SUCCESS; \ - } while (0) - -#else - -#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ - do { \ - unsigned char *pc_ = (CONTEXT)->ra; \ - struct sigcontext *sc_; \ - long new_cfa_; \ - int i_; \ - \ - /* li r0, 0x7777; sc (sigreturn old) */ \ - /* li r0, 0x0077; sc (sigreturn new) */ \ - /* li r0, 0x6666; sc (rt_sigreturn old) */ \ - /* li r0, 0x00AC; sc (rt_sigreturn new) */ \ - if (*(unsigned int *) (pc_+4) != 0x44000002) \ - break; \ - if (*(unsigned int *) (pc_+0) == 0x38007777 \ - || *(unsigned int *) (pc_+0) == 0x38000077) \ - { \ - struct sigframe { \ - char gap[SIGNAL_FRAMESIZE]; \ - struct sigcontext sigctx; \ - } *rt_ = (CONTEXT)->cfa; \ - sc_ = &rt_->sigctx; \ - } \ - else if (*(unsigned int *) (pc_+0) == 0x38006666 \ - || *(unsigned int *) (pc_+0) == 0x380000AC) \ - { \ - struct rt_sigframe { \ - char gap[SIGNAL_FRAMESIZE]; \ - unsigned long _unused[2]; \ - struct siginfo *pinfo; \ - void *puc; \ - struct siginfo info; \ - struct kernel_old_ucontext uc; \ - } *rt_ = (CONTEXT)->cfa; \ - sc_ = &rt_->uc.uc_mcontext; \ - } \ - else \ - break; \ - \ - new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \ - (FS)->cfa_how = CFA_REG_OFFSET; \ - (FS)->cfa_reg = STACK_POINTER_REGNUM; \ - (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ - \ - for (i_ = 0; i_ < 32; i_++) \ - if (i_ != STACK_POINTER_REGNUM) \ - { \ - (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[i_].loc.offset \ - = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \ - } \ - \ - (FS)->regs.reg[CR2_REGNO].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[CR2_REGNO].loc.offset \ - = (long)&(sc_->regs->ccr) - new_cfa_; \ - \ - (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ - = (long)&(sc_->regs->link) - new_cfa_; \ - \ - (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[CR0_REGNO].loc.offset \ - = (long)&(sc_->regs->nip) - new_cfa_; \ - (FS)->retaddr_column = CR0_REGNO; \ - goto SUCCESS; \ - } while (0) - +#ifdef IN_LIBGCC2 +#include "config/rs6000/linux-unwind.h" #endif #endif |