#! /bin/sh -e

# DP: Use siginfo_t instead of struct siginfo on i386.

dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

--- gcc/config/i386/linux.h.orig	2013-11-17 00:36:59.840138782 +0100
+++ gcc/config/i386/linux.h	2013-11-17 00:37:27.135196753 +0100
@@ -257,9 +257,9 @@
       {									\
 	struct rt_sigframe {						\
 	  int sig;							\
-	  struct siginfo *pinfo;					\
+	  siginfo_t *pinfo;					\
 	  void *puc;							\
-	  struct siginfo info;						\
+	  siginfo_t info;						\
 	  struct ucontext uc;						\
 	} *rt_ = (CONTEXT)->cfa;					\
 	sc_ = (struct sigcontext *) &rt_->uc.uc_mcontext;		\
--- gcc/config/rs6000/linux.h.orig	2013-11-17 00:37:33.338978202 +0100
+++ gcc/config/rs6000/linux.h	2013-11-17 00:37:53.906242261 +0100
@@ -138,9 +138,9 @@
 	struct rt_sigframe {						\
 	  char gap[SIGNAL_FRAMESIZE];					\
 	  unsigned long _unused[2];					\
-	  struct siginfo *pinfo;					\
+	  siginfo_t *pinfo;					\
 	  void *puc;							\
-	  struct siginfo info;						\
+	  siginfo_t info;						\
 	  struct kernel_old_ucontext uc;				\
 	} *rt_ = (CONTEXT)->cfa;					\
 	sc_ = &rt_->uc.uc_mcontext;					\
