summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2013-09-17 16:04:35 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2013-09-17 16:04:35 +0200
commitf7397b4ca4094a7101db10708cd0023a0b2506e8 (patch)
tree02ae945ee46a9204a0e143beb6b6cb3dfeebbe1d
parent5be4c4567a4602d9a2c0445ffa1e5cb68c3a8a41 (diff)
fix gcc mips64el building with musl
-rw-r--r--toolchain/gcc/patches/4.7.3/musl-cross.patch48
-rw-r--r--toolchain/gcc/patches/4.7.3/musl-ppc.patch380
2 files changed, 24 insertions, 404 deletions
diff --git a/toolchain/gcc/patches/4.7.3/musl-cross.patch b/toolchain/gcc/patches/4.7.3/musl-cross.patch
index acbc39d36..bbba746b0 100644
--- a/toolchain/gcc/patches/4.7.3/musl-cross.patch
+++ b/toolchain/gcc/patches/4.7.3/musl-cross.patch
@@ -1,6 +1,6 @@
diff -Nur gcc-4.7.3.orig/config.sub gcc-4.7.3/config.sub
--- gcc-4.7.3.orig/config.sub 2012-08-06 16:34:27.000000000 +0200
-+++ gcc-4.7.3/config.sub 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/config.sub 2013-09-16 15:39:42.000000000 +0200
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc.
@@ -132,7 +132,7 @@ diff -Nur gcc-4.7.3.orig/config.sub gcc-4.7.3/config.sub
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
diff -Nur gcc-4.7.3.orig/fixincludes/mkfixinc.sh gcc-4.7.3/fixincludes/mkfixinc.sh
--- gcc-4.7.3.orig/fixincludes/mkfixinc.sh 2011-09-22 16:00:17.000000000 +0200
-+++ gcc-4.7.3/fixincludes/mkfixinc.sh 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/fixincludes/mkfixinc.sh 2013-09-16 15:39:42.000000000 +0200
@@ -20,7 +20,8 @@
powerpc-*-eabi* | \
powerpc-*-rtems* | \
@@ -145,7 +145,7 @@ diff -Nur gcc-4.7.3.orig/fixincludes/mkfixinc.sh gcc-4.7.3/fixincludes/mkfixinc.
(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
diff -Nur gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h gcc-4.7.3/gcc/config/arm/linux-eabi.h
--- gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h 2011-11-02 16:03:19.000000000 +0100
-+++ gcc-4.7.3/gcc/config/arm/linux-eabi.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/arm/linux-eabi.h 2013-09-16 15:39:42.000000000 +0200
@@ -64,6 +64,23 @@
#undef GLIBC_DYNAMIC_LINKER
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
@@ -172,7 +172,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h gcc-4.7.3/gcc/config/arm/li
#undef LINK_SPEC
diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/linux64.h
--- gcc-4.7.3.orig/gcc/config/i386/linux64.h 2011-07-07 17:38:34.000000000 +0200
-+++ gcc-4.7.3/gcc/config/i386/linux64.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/i386/linux64.h 2013-09-16 15:39:42.000000000 +0200
@@ -31,3 +31,7 @@
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
@@ -183,7 +183,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/lin
+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux.h gcc-4.7.3/gcc/config/i386/linux.h
--- gcc-4.7.3.orig/gcc/config/i386/linux.h 2011-06-03 20:30:39.000000000 +0200
-+++ gcc-4.7.3/gcc/config/i386/linux.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/i386/linux.h 2013-09-16 15:39:42.000000000 +0200
@@ -22,3 +22,4 @@
#define GNU_USER_LINK_EMULATION "elf_i386"
@@ -191,7 +191,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/i386/linux.h gcc-4.7.3/gcc/config/i386/linux
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
diff -Nur gcc-4.7.3.orig/gcc/config/linux.h gcc-4.7.3/gcc/config/linux.h
--- gcc-4.7.3.orig/gcc/config/linux.h 2012-08-14 15:59:04.000000000 +0200
-+++ gcc-4.7.3/gcc/config/linux.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/linux.h 2013-09-16 15:39:42.000000000 +0200
@@ -33,10 +33,12 @@
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
@@ -339,7 +339,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/linux.h gcc-4.7.3/gcc/config/linux.h
+#endif
diff -Nur gcc-4.7.3.orig/gcc/config/linux.opt gcc-4.7.3/gcc/config/linux.opt
--- gcc-4.7.3.orig/gcc/config/linux.opt 2010-09-29 16:51:52.000000000 +0200
-+++ gcc-4.7.3/gcc/config/linux.opt 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/linux.opt 2013-09-16 15:39:42.000000000 +0200
@@ -30,3 +30,7 @@
muclibc
Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
@@ -350,7 +350,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/linux.opt gcc-4.7.3/gcc/config/linux.opt
+Use musl C library
diff -Nur gcc-4.7.3.orig/gcc/config/mips/linux.h gcc-4.7.3/gcc/config/mips/linux.h
--- gcc-4.7.3.orig/gcc/config/mips/linux.h 2011-07-19 20:00:27.000000000 +0200
-+++ gcc-4.7.3/gcc/config/mips/linux.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/mips/linux.h 2013-09-16 15:39:43.000000000 +0200
@@ -19,3 +19,5 @@
<http://www.gnu.org/licenses/>. */
@@ -359,7 +359,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/mips/linux.h gcc-4.7.3/gcc/config/mips/linux
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h gcc-4.7.3/gcc/config/rs6000/linux64.h
--- gcc-4.7.3.orig/gcc/config/rs6000/linux64.h 2012-03-12 17:16:51.000000000 +0100
-+++ gcc-4.7.3/gcc/config/rs6000/linux64.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/rs6000/linux64.h 2013-09-16 15:39:43.000000000 +0200
@@ -362,17 +362,21 @@
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
@@ -388,7 +388,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h gcc-4.7.3/gcc/config/rs6000
#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/secureplt.h gcc-4.7.3/gcc/config/rs6000/secureplt.h
--- gcc-4.7.3.orig/gcc/config/rs6000/secureplt.h 2007-08-02 12:49:31.000000000 +0200
-+++ gcc-4.7.3/gcc/config/rs6000/secureplt.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/rs6000/secureplt.h 2013-09-16 15:39:43.000000000 +0200
@@ -18,3 +18,4 @@
<http://www.gnu.org/licenses/>. */
@@ -396,7 +396,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/secureplt.h gcc-4.7.3/gcc/config/rs60
+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h gcc-4.7.3/gcc/config/rs6000/sysv4.h
--- gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h 2012-04-30 19:39:01.000000000 +0200
-+++ gcc-4.7.3/gcc/config/rs6000/sysv4.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config/rs6000/sysv4.h 2013-09-16 15:39:43.000000000 +0200
@@ -566,6 +566,9 @@
#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
#define CC1_SECURE_PLT_DEFAULT_SPEC ""
@@ -449,7 +449,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config/rs6000/sysv4.h gcc-4.7.3/gcc/config/rs6000/s
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
diff -Nur gcc-4.7.3.orig/gcc/config.gcc gcc-4.7.3/gcc/config.gcc
--- gcc-4.7.3.orig/gcc/config.gcc 2013-03-06 23:54:11.000000000 +0100
-+++ gcc-4.7.3/gcc/config.gcc 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/config.gcc 2013-09-16 15:39:43.000000000 +0200
@@ -522,7 +522,7 @@
esac
@@ -482,7 +482,7 @@ diff -Nur gcc-4.7.3.orig/gcc/config.gcc gcc-4.7.3/gcc/config.gcc
fi
diff -Nur gcc-4.7.3.orig/gcc/configure gcc-4.7.3/gcc/configure
--- gcc-4.7.3.orig/gcc/configure 2013-02-06 16:23:55.000000000 +0100
-+++ gcc-4.7.3/gcc/configure 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/configure 2013-09-16 15:39:43.000000000 +0200
@@ -26815,7 +26815,8 @@
gcc_cv_libc_provides_ssp=yes
fi
@@ -505,7 +505,7 @@ diff -Nur gcc-4.7.3.orig/gcc/configure gcc-4.7.3/gcc/configure
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
diff -Nur gcc-4.7.3.orig/gcc/configure.ac gcc-4.7.3/gcc/configure.ac
--- gcc-4.7.3.orig/gcc/configure.ac 2013-02-06 16:23:55.000000000 +0100
-+++ gcc-4.7.3/gcc/configure.ac 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/configure.ac 2013-09-16 15:39:43.000000000 +0200
@@ -4692,7 +4692,8 @@
gcc_cv_libc_provides_ssp=yes
fi]
@@ -528,7 +528,7 @@ diff -Nur gcc-4.7.3.orig/gcc/configure.ac gcc-4.7.3/gcc/configure.ac
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
diff -Nur gcc-4.7.3.orig/gcc/ginclude/stddef.h gcc-4.7.3/gcc/ginclude/stddef.h
--- gcc-4.7.3.orig/gcc/ginclude/stddef.h 2012-02-12 02:06:04.000000000 +0100
-+++ gcc-4.7.3/gcc/ginclude/stddef.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/gcc/ginclude/stddef.h 2013-09-16 15:39:43.000000000 +0200
@@ -184,6 +184,7 @@
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
@@ -555,7 +555,7 @@ diff -Nur gcc-4.7.3.orig/gcc/ginclude/stddef.h gcc-4.7.3/gcc/ginclude/stddef.h
#endif /* _GCC_SIZE_T */
diff -Nur gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c
--- gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c 2012-10-06 23:55:06.000000000 +0200
-+++ gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libgcc/unwind-dw2-fde-dip.c 2013-09-16 15:39:43.000000000 +0200
@@ -47,28 +47,13 @@
#include "unwind-compat.h"
#include "gthr.h"
@@ -593,7 +593,7 @@ diff -Nur gcc-4.7.3.orig/libgcc/unwind-dw2-fde-dip.c gcc-4.7.3/libgcc/unwind-dw2
#if defined(USE_PT_GNU_EH_FRAME)
diff -Nur gcc-4.7.3.orig/libgomp/config/posix/time.c gcc-4.7.3/libgomp/config/posix/time.c
--- gcc-4.7.3.orig/libgomp/config/posix/time.c 2009-04-09 17:00:19.000000000 +0200
-+++ gcc-4.7.3/libgomp/config/posix/time.c 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libgomp/config/posix/time.c 2013-09-16 15:39:43.000000000 +0200
@@ -28,6 +28,8 @@
The following implementation uses the most simple POSIX routines.
If present, POSIX 4 clocks should be used instead. */
@@ -605,7 +605,7 @@ diff -Nur gcc-4.7.3.orig/libgomp/config/posix/time.c gcc-4.7.3/libgomp/config/po
#if TIME_WITH_SYS_TIME
diff -Nur gcc-4.7.3.orig/libitm/config/arm/hwcap.cc gcc-4.7.3/libitm/config/arm/hwcap.cc
--- gcc-4.7.3.orig/libitm/config/arm/hwcap.cc 2011-12-15 04:24:05.000000000 +0100
-+++ gcc-4.7.3/libitm/config/arm/hwcap.cc 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libitm/config/arm/hwcap.cc 2013-09-16 15:39:43.000000000 +0200
@@ -40,7 +40,11 @@
#ifdef __linux__
@@ -620,7 +620,7 @@ diff -Nur gcc-4.7.3.orig/libitm/config/arm/hwcap.cc gcc-4.7.3/libitm/config/arm/
static void __attribute__((constructor))
diff -Nur gcc-4.7.3.orig/libitm/config/linux/x86/tls.h gcc-4.7.3/libitm/config/linux/x86/tls.h
--- gcc-4.7.3.orig/libitm/config/linux/x86/tls.h 2011-11-08 12:13:41.000000000 +0100
-+++ gcc-4.7.3/libitm/config/linux/x86/tls.h 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libitm/config/linux/x86/tls.h 2013-09-16 15:39:43.000000000 +0200
@@ -25,16 +25,19 @@
#ifndef LIBITM_X86_TLS_H
#define LIBITM_X86_TLS_H 1
@@ -652,7 +652,7 @@ diff -Nur gcc-4.7.3.orig/libitm/config/linux/x86/tls.h gcc-4.7.3/libitm/config/l
#endif // LIBITM_X86_TLS_H
diff -Nur gcc-4.7.3.orig/libssp/configure gcc-4.7.3/libssp/configure
--- gcc-4.7.3.orig/libssp/configure 2012-08-06 16:34:27.000000000 +0200
-+++ gcc-4.7.3/libssp/configure 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libssp/configure 2013-09-16 15:39:43.000000000 +0200
@@ -626,6 +626,8 @@
ssp_have_usable_vsnprintf
EGREP
@@ -746,7 +746,7 @@ diff -Nur gcc-4.7.3.orig/libssp/configure gcc-4.7.3/libssp/configure
ac_write_fail=0
diff -Nur gcc-4.7.3.orig/libssp/configure.ac gcc-4.7.3/libssp/configure.ac
--- gcc-4.7.3.orig/libssp/configure.ac 2012-05-31 20:59:34.000000000 +0200
-+++ gcc-4.7.3/libssp/configure.ac 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libssp/configure.ac 2013-09-16 15:39:43.000000000 +0200
@@ -114,6 +114,26 @@
AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu])
AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun])
@@ -776,7 +776,7 @@ diff -Nur gcc-4.7.3.orig/libssp/configure.ac gcc-4.7.3/libssp/configure.ac
if test x$gcc_no_link = xyes; then
diff -Nur gcc-4.7.3.orig/libssp/Makefile.am gcc-4.7.3/libssp/Makefile.am
--- gcc-4.7.3.orig/libssp/Makefile.am 2010-12-06 01:50:04.000000000 +0100
-+++ gcc-4.7.3/libssp/Makefile.am 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libssp/Makefile.am 2013-09-16 15:39:43.000000000 +0200
@@ -36,7 +36,11 @@
AM_CFLAGS = -Wall
@@ -791,7 +791,7 @@ diff -Nur gcc-4.7.3.orig/libssp/Makefile.am gcc-4.7.3/libssp/Makefile.am
libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
diff -Nur gcc-4.7.3.orig/libssp/Makefile.in gcc-4.7.3/libssp/Makefile.in
--- gcc-4.7.3.orig/libssp/Makefile.in 2011-02-13 12:45:53.000000000 +0100
-+++ gcc-4.7.3/libssp/Makefile.in 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libssp/Makefile.in 2013-09-16 15:39:43.000000000 +0200
@@ -93,12 +93,17 @@
libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -834,7 +834,7 @@ diff -Nur gcc-4.7.3.orig/libssp/Makefile.in gcc-4.7.3/libssp/Makefile.in
-rm -f *.$(OBJEXT)
diff -Nur gcc-4.7.3.orig/libstdc++-v3/configure.host gcc-4.7.3/libstdc++-v3/configure.host
--- gcc-4.7.3.orig/libstdc++-v3/configure.host 2012-12-18 15:27:14.000000000 +0100
-+++ gcc-4.7.3/libstdc++-v3/configure.host 2013-09-14 15:51:23.000000000 +0200
++++ gcc-4.7.3/libstdc++-v3/configure.host 2013-09-16 15:39:43.000000000 +0200
@@ -243,6 +243,13 @@
os_include_dir="os/bsd/freebsd"
;;
diff --git a/toolchain/gcc/patches/4.7.3/musl-ppc.patch b/toolchain/gcc/patches/4.7.3/musl-ppc.patch
index ed84a76f0..f4211ee73 100644
--- a/toolchain/gcc/patches/4.7.3/musl-ppc.patch
+++ b/toolchain/gcc/patches/4.7.3/musl-ppc.patch
@@ -153,383 +153,3 @@ diff -Nur gcc-4.7.3.orig/libgcc/config/rs6000/linux-unwind.h gcc-4.7.3/libgcc/co
{
fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset
-diff -Nur gcc-4.7.3.orig/libgcc/config/rs6000/linux-unwind.h.orig gcc-4.7.3/libgcc/config/rs6000/linux-unwind.h.orig
---- gcc-4.7.3.orig/libgcc/config/rs6000/linux-unwind.h.orig 1970-01-01 01:00:00.000000000 +0100
-+++ gcc-4.7.3/libgcc/config/rs6000/linux-unwind.h.orig 2011-11-12 18:20:58.000000000 +0100
-@@ -0,0 +1,376 @@
-+/* DWARF2 EH unwinding support for PowerPC and PowerPC64 Linux.
-+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011
-+ Free Software Foundation, Inc.
-+
-+ This file is part of GCC.
-+
-+ GCC is free software; you can redistribute it and/or modify it
-+ under the terms of the GNU General Public License as published
-+ by the Free Software Foundation; either version 3, or (at your
-+ option) any later version.
-+
-+ GCC is distributed in the hope that it will be useful, but WITHOUT
-+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-+ License for more details.
-+
-+ Under Section 7 of GPL version 3, you are granted additional
-+ permissions described in the GCC Runtime Library Exception, version
-+ 3.1, as published by the Free Software Foundation.
-+
-+ You should have received a copy of the GNU General Public License and
-+ a copy of the GCC Runtime Library Exception along with this program;
-+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-+ <http://www.gnu.org/licenses/>. */
-+
-+#define R_LR 65
-+#define R_CR2 70
-+#define R_VR0 77
-+#define R_VRSAVE 109
-+#define R_VSCR 110
-+
-+struct gcc_vregs
-+{
-+ __attribute__ ((vector_size (16))) int vr[32];
-+#ifdef __powerpc64__
-+ unsigned int pad1[3];
-+ unsigned int vscr;
-+ unsigned int vsave;
-+ unsigned int pad2[3];
-+#else
-+ unsigned int vsave;
-+ unsigned int pad[2];
-+ unsigned int vscr;
-+#endif
-+};
-+
-+struct gcc_regs
-+{
-+ unsigned long gpr[32];
-+ unsigned long nip;
-+ unsigned long msr;
-+ unsigned long orig_gpr3;
-+ unsigned long ctr;
-+ unsigned long link;
-+ unsigned long xer;
-+ unsigned long ccr;
-+ unsigned long softe;
-+ unsigned long trap;
-+ unsigned long dar;
-+ unsigned long dsisr;
-+ unsigned long result;
-+ unsigned long pad1[4];
-+ double fpr[32];
-+ unsigned int pad2;
-+ unsigned int fpscr;
-+#ifdef __powerpc64__
-+ struct gcc_vregs *vp;
-+#else
-+ unsigned int pad3[2];
-+#endif
-+ struct gcc_vregs vregs;
-+};
-+
-+struct gcc_ucontext
-+{
-+#ifdef __powerpc64__
-+ unsigned long pad[28];
-+#else
-+ unsigned long pad[12];
-+#endif
-+ struct gcc_regs *regs;
-+ struct gcc_regs rsave;
-+};
-+
-+#ifdef __powerpc64__
-+
-+enum { SIGNAL_FRAMESIZE = 128 };
-+
-+/* If PC is at a sigreturn trampoline, return a pointer to the
-+ regs. Otherwise return NULL. */
-+
-+static struct gcc_regs *
-+get_regs (struct _Unwind_Context *context)
-+{
-+ const unsigned int *pc = context->ra;
-+
-+ /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */
-+ /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */
-+ if (pc[0] != 0x38210000 + SIGNAL_FRAMESIZE || pc[2] != 0x44000002)
-+ return NULL;
-+ if (pc[1] == 0x38000077)
-+ {
-+ struct sigframe {
-+ char gap[SIGNAL_FRAMESIZE];
-+ unsigned long pad[7];
-+ struct gcc_regs *regs;
-+ } *frame = (struct sigframe *) context->cfa;
-+ return frame->regs;
-+ }
-+ else if (pc[1] == 0x380000AC)
-+ {
-+ /* This works for 2.4 kernels, but not for 2.6 kernels with vdso
-+ because pc isn't pointing into the stack. Can be removed when
-+ no one is running 2.4.19 or 2.4.20, the first two ppc64
-+ kernels released. */
-+ const struct rt_sigframe_24 {
-+ int tramp[6];
-+ void *pinfo;
-+ struct gcc_ucontext *puc;
-+ } *frame24 = (const struct rt_sigframe_24 *) context->ra;
-+
-+ /* Test for magic value in *puc of vdso. */
-+ if ((long) frame24->puc != -21 * 8)
-+ return frame24->puc->regs;
-+ else
-+ {
-+ /* This works for 2.4.21 and later kernels. */
-+ struct rt_sigframe {
-+ char gap[SIGNAL_FRAMESIZE];
-+ struct gcc_ucontext uc;
-+ unsigned long pad[2];
-+ int tramp[6];
-+ void *pinfo;
-+ struct gcc_ucontext *puc;
-+ } *frame = (struct rt_sigframe *) context->cfa;
-+ return frame->uc.regs;
-+ }
-+ }
-+ return NULL;
-+}
-+
-+#else /* !__powerpc64__ */
-+
-+enum { SIGNAL_FRAMESIZE = 64 };
-+
-+static struct gcc_regs *
-+get_regs (struct _Unwind_Context *context)
-+{
-+ const unsigned int *pc = context->ra;
-+
-+ /* 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 (pc[1] != 0x44000002)
-+ return NULL;
-+ if (pc[0] == 0x38007777 || pc[0] == 0x38000077)
-+ {
-+ struct sigframe {
-+ char gap[SIGNAL_FRAMESIZE];
-+ unsigned long pad[7];
-+ struct gcc_regs *regs;
-+ } *frame = (struct sigframe *) context->cfa;
-+ return frame->regs;
-+ }
-+ else if (pc[0] == 0x38006666 || pc[0] == 0x380000AC)
-+ {
-+ struct rt_sigframe {
-+ char gap[SIGNAL_FRAMESIZE + 16];
-+ char siginfo[128];
-+ struct gcc_ucontext uc;
-+ } *frame = (struct rt_sigframe *) context->cfa;
-+ return frame->uc.regs;
-+ }
-+ return NULL;
-+}
-+#endif
-+
-+/* Find an entry in the process auxiliary vector. The canonical way to
-+ test for VMX is to look at AT_HWCAP. */
-+
-+static long
-+ppc_linux_aux_vector (long which)
-+{
-+ /* __libc_stack_end holds the original stack passed to a process. */
-+ extern long *__libc_stack_end;
-+ long argc;
-+ char **argv;
-+ char **envp;
-+ struct auxv
-+ {
-+ long a_type;
-+ long a_val;
-+ } *auxp;
-+
-+ /* The Linux kernel puts argc first on the stack. */
-+ argc = __libc_stack_end[0];
-+ /* Followed by argv, NULL terminated. */
-+ argv = (char **) __libc_stack_end + 1;
-+ /* Followed by environment string pointers, NULL terminated. */
-+ envp = argv + argc + 1;
-+ while (*envp++)
-+ continue;
-+ /* Followed by the aux vector, zero terminated. */
-+ for (auxp = (struct auxv *) envp; auxp->a_type != 0; ++auxp)
-+ if (auxp->a_type == which)
-+ return auxp->a_val;
-+ return 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 ppc_fallback_frame_state
-+
-+static _Unwind_Reason_Code
-+ppc_fallback_frame_state (struct _Unwind_Context *context,
-+ _Unwind_FrameState *fs)
-+{
-+ static long hwcap = 0;
-+ struct gcc_regs *regs = get_regs (context);
-+ long new_cfa;
-+ int i;
-+
-+ if (regs == NULL)
-+ return _URC_END_OF_STACK;
-+
-+ new_cfa = regs->gpr[STACK_POINTER_REGNUM];
-+ fs->regs.cfa_how = CFA_REG_OFFSET;
-+ fs->regs.cfa_reg = STACK_POINTER_REGNUM;
-+ fs->regs.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) &regs->gpr[i] - new_cfa;
-+ }
-+
-+ fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
-+ /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit
-+ libgcc loc.offset needs to point to the low 32 bits of regs->ccr. */
-+ fs->regs.reg[R_CR2].loc.offset = (long) &regs->ccr - new_cfa
-+ + sizeof (long) - 4;
-+
-+ fs->regs.reg[R_LR].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[R_LR].loc.offset = (long) &regs->link - new_cfa;
-+
-+ fs->regs.reg[ARG_POINTER_REGNUM].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[ARG_POINTER_REGNUM].loc.offset = (long) &regs->nip - new_cfa;
-+ fs->retaddr_column = ARG_POINTER_REGNUM;
-+ fs->signal_frame = 1;
-+
-+ if (hwcap == 0)
-+ {
-+ hwcap = ppc_linux_aux_vector (16);
-+ /* These will already be set if we found AT_HWCAP. A nonzero
-+ value stops us looking again if for some reason we couldn't
-+ find AT_HWCAP. */
-+#ifdef __powerpc64__
-+ hwcap |= 0xc0000000;
-+#else
-+ hwcap |= 0x80000000;
-+#endif
-+ }
-+
-+ /* If we have a FPU... */
-+ if (hwcap & 0x08000000)
-+ for (i = 0; i < 32; i++)
-+ {
-+ fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
-+ }
-+
-+ /* If we have a VMX unit... */
-+ if (hwcap & 0x10000000)
-+ {
-+ struct gcc_vregs *vregs;
-+#ifdef __powerpc64__
-+ vregs = regs->vp;
-+#else
-+ vregs = &regs->vregs;
-+#endif
-+ if (regs->msr & (1 << 25))
-+ {
-+ for (i = 0; i < 32; i++)
-+ {
-+ fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i + R_VR0].loc.offset
-+ = (long) &vregs->vr[i] - new_cfa;
-+ }
-+
-+ fs->regs.reg[R_VSCR].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[R_VSCR].loc.offset = (long) &vregs->vscr - new_cfa;
-+ }
-+
-+ fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
-+ }
-+
-+ /* If we have SPE register high-parts... we check at compile-time to
-+ avoid expanding the code for all other PowerPC. */
-+#ifdef __SPE__
-+ for (i = 0; i < 32; i++)
-+ {
-+ fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset
-+ = (long) &regs->vregs - new_cfa + 4 * i;
-+ }
-+#endif
-+
-+ return _URC_NO_REASON;
-+}
-+
-+#define MD_FROB_UPDATE_CONTEXT frob_update_context
-+
-+static void
-+frob_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs ATTRIBUTE_UNUSED)
-+{
-+ const unsigned int *pc = (const unsigned int *) context->ra;
-+
-+ /* Fix up for 2.6.12 - 2.6.16 Linux kernels that have vDSO, but don't
-+ have S flag in it. */
-+#ifdef __powerpc64__
-+ /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */
-+ /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */
-+ if (pc[0] == 0x38210000 + SIGNAL_FRAMESIZE
-+ && (pc[1] == 0x38000077 || pc[1] == 0x380000AC)
-+ && pc[2] == 0x44000002)
-+ _Unwind_SetSignalFrame (context, 1);
-+#else
-+ /* 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 ((pc[0] == 0x38007777 || pc[0] == 0x38000077
-+ || pc[0] == 0x38006666 || pc[0] == 0x380000AC)
-+ && pc[1] == 0x44000002)
-+ _Unwind_SetSignalFrame (context, 1);
-+#endif
-+
-+#ifdef __powerpc64__
-+ if (fs->regs.reg[2].how == REG_UNSAVED)
-+ {
-+ /* 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. */
-+ if (pc[0] == 0xF8410028
-+ || ((pc[0] & 0xFFFF0000) == 0x3D820000
-+ && pc[1] == 0xF8410028))
-+ {
-+ /* We are in a plt call stub or r2 adjusting long branch stub,
-+ before r2 has been saved. Keep REG_UNSAVED. */
-+ }
-+ else
-+ {
-+ unsigned int *insn
-+ = (unsigned int *) _Unwind_GetGR (context, R_LR);
-+ if (insn && *insn == 0xE8410028)
-+ _Unwind_SetGRPtr (context, 2, context->cfa + 40);
-+ else if (pc[0] == 0x4E800421
-+ && pc[1] == 0xE8410028)
-+ {
-+ /* We are at the bctrl instruction in a call via function
-+ pointer. gcc always emits the load of the new R2 just
-+ before the bctrl so this is the first and only place
-+ we need to use the stored R2. */
-+ _Unwind_Word sp = _Unwind_GetGR (context, 1);
-+ _Unwind_SetGRPtr (context, 2, (void *)(sp + 40));
-+ }
-+ }
-+ }
-+#endif
-+}