From: Alan Modra Date: Thu, 2 Sep 2004 12:46:27 +0000 (+0000) Subject: linux64.h: Don't include signal.h or sys/ucontext.h. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d86c1b91730b2710a4042ee6972c513f939015a6;p=gcc.git linux64.h: Don't include signal.h or sys/ucontext.h. * config/rs6000/linux64.h: Don't include signal.h or sys/ucontext.h. (struct kernel_old_ucontext): Delete. (struct gcc_pt_regs, gcc_sigcontext, gcc_ucontext): New. (MD_FALLBACK_FRAME_STATE_FOR): Use gcc_* structs. Only define when IN_LIGGCC2. From-SVN: r86962 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2081c5ddf99..5137c8ce031 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-02 Alan Modra + + * config/rs6000/linux64.h: Don't include signal.h or sys/ucontext.h. + (struct kernel_old_ucontext): Delete. + (struct gcc_pt_regs, gcc_sigcontext, gcc_ucontext): New. + (MD_FALLBACK_FRAME_STATE_FOR): Use gcc_* structs. Only define + when IN_LIGGCC2. + 2004-09-02 Richard Sandiford * toplev.c (process_options): Fix typo. diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index f87f10ebfb1..e7b57d4f570 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -557,36 +557,44 @@ while (0) #define USE_LD_AS_NEEDED 1 #endif -/* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - #ifdef IN_LIBGCC2 -#include -#ifdef __powerpc64__ -#include - -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. */ +/* This file defines our own versions of various kernel and user + structs, so that system headers are not needed, which otherwise + can make bootstrapping a new toolchain difficult. Do not use + these structs elsewhere; Many fields are missing, particularly + from the end of the structures. */ + +struct gcc_pt_regs +{ + unsigned long gpr[32]; + unsigned long nip; + unsigned long msr; + unsigned long orig_gpr3; + unsigned long ctr; + unsigned long link; +}; -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; +struct gcc_sigcontext +{ + unsigned long pad[7]; + struct gcc_pt_regs *regs; }; -enum { SIGNAL_FRAMESIZE = 64 }; -#endif +struct gcc_ucontext +{ +#ifdef __powerpc64__ + unsigned long pad[21]; +#else + unsigned long pad[5]; #endif + struct gcc_sigcontext uc_mcontext; +}; #ifdef __powerpc64__ +enum { SIGNAL_FRAMESIZE = 128 }; + /* 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 @@ -605,10 +613,13 @@ enum { SIGNAL_FRAMESIZE = 64 }; } \ } while (0) +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ do { \ unsigned char *pc_ = (CONTEXT)->ra; \ - struct sigcontext *sc_; \ + struct gcc_sigcontext *sc_; \ long new_cfa_; \ int i_; \ \ @@ -621,7 +632,7 @@ enum { SIGNAL_FRAMESIZE = 64 }; { \ struct sigframe { \ char gap[SIGNAL_FRAMESIZE]; \ - struct sigcontext sigctx; \ + struct gcc_sigcontext sigctx; \ } *rt_ = (CONTEXT)->cfa; \ sc_ = &rt_->sigctx; \ } \ @@ -629,8 +640,8 @@ enum { SIGNAL_FRAMESIZE = 64 }; { \ struct rt_sigframe { \ int tramp[6]; \ - struct siginfo *pinfo; \ - struct ucontext *puc; \ + void *pinfo; \ + struct gcc_ucontext *puc; \ } *rt_ = (struct rt_sigframe *) pc_; \ sc_ = &rt_->puc->uc_mcontext; \ } \ @@ -661,12 +672,14 @@ enum { SIGNAL_FRAMESIZE = 64 }; goto SUCCESS; \ } while (0) -#else +#else /* !__powerpc64__ */ + +enum { SIGNAL_FRAMESIZE = 64 }; #define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ do { \ unsigned char *pc_ = (CONTEXT)->ra; \ - struct sigcontext *sc_; \ + struct gcc_sigcontext *sc_; \ long new_cfa_; \ int i_; \ \ @@ -681,7 +694,7 @@ enum { SIGNAL_FRAMESIZE = 64 }; { \ struct sigframe { \ char gap[SIGNAL_FRAMESIZE]; \ - struct sigcontext sigctx; \ + struct gcc_sigcontext sigctx; \ } *rt_ = (CONTEXT)->cfa; \ sc_ = &rt_->sigctx; \ } \ @@ -689,12 +702,9 @@ enum { SIGNAL_FRAMESIZE = 64 }; || *(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; \ + char gap[SIGNAL_FRAMESIZE + 16]; \ + char siginfo[128]; \ + struct gcc_ucontext uc; \ } *rt_ = (CONTEXT)->cfa; \ sc_ = &rt_->uc.uc_mcontext; \ } \ @@ -726,6 +736,6 @@ enum { SIGNAL_FRAMESIZE = 64 }; } while (0) #endif - +#endif /* LIBGCC2 */ #define OS_MISSING_POWERPC64 !TARGET_64BIT