aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-09-23 11:47:08 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-09-23 11:57:24 +0000
commit0dceb86c0b230eb083bc86711a57e9abd1b459f3 (patch)
tree6bb1372ca2fe1912861cea0b54bcc37952c3ab96
parentd61fa697f573aeec58efbebee57c4654ffc4750a (diff)
downloadaports-0dceb86c0b230eb083bc86711a57e9abd1b459f3.tar.bz2
aports-0dceb86c0b230eb083bc86711a57e9abd1b459f3.tar.xz
main/gcc: implement crosscompiler creation and crossbuilding, musl fixes
-rw-r--r--main/gcc/APKBUILD329
-rw-r--r--main/gcc/ada-crossbuild.patch49
-rw-r--r--main/gcc/ada-fixes.patch47
-rw-r--r--main/gcc/ada-musl.patch118
-rw-r--r--main/gcc/ada-no-pie.patch22
-rw-r--r--main/gcc/ada-shared.patch30
-rw-r--r--main/gcc/boehm-gc-musl.patch11
-rw-r--r--main/gcc/boehm-gc-uclibc.patch (renamed from main/gcc/boehem-gc-uclibc.patch)0
-rw-r--r--main/gcc/fix-cxxflags-for-target.patch5
-rw-r--r--main/gcc/gcc-4.8-musl.patch461
-rw-r--r--main/gcc/gcc-ice-hack.patch304
-rw-r--r--main/gcc/pr49423.patch103
-rw-r--r--main/gcc/pr57748.patch295
13 files changed, 1651 insertions, 123 deletions
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index 03d48edaed..634adba7a4 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -4,28 +4,68 @@ pkgver=4.8.1
_piepatchver=0.5.6
_specs_ver=0.2.0
_specs_gcc_ver=4.4.3
-
_uclibc_abiver=0.9.32
-
-pkgrel=2
+_cross=""
+[ "$BOOTSTRAP" = "noheaders" ] && pkgname="gcc-pass1"
+[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2"
+[ "$CHOST" != "$CTARGET" ] && [ -n "$CHOST" -a -n "$CTARGET" ] \
+ && _cross="-$CTARGET"
+
+pkgname="$pkgname$_cross"
+pkgrel=3
pkgdesc="The GNU Compiler Collection"
url="http://gcc.gnu.org"
arch="all"
license="GPL LGPL"
_gccrel=$pkgver-r$pkgrel
-depends="binutils libgomp=$_gccrel"
-makedepends="bison flex gmp-dev mpfr-dev texinfo mpc1-dev gawk zlib-dev zip
- cloog-dev !libiconv-dev !gettext-dev"
-subpackages="$pkgname-doc libgcc libgomp libstdc++:libcxx g++:gpp"
+depends="binutils$_cross"
+makedepends_build="bison flex texinfo gawk zip"
+makedepends_host="gmp-dev mpfr-dev mpc1-dev zlib-dev cloog-dev !libiconv-dev !gettext-dev"
+makedepends="$makedepends_build $makedepends_host"
+subpackages=" "
+[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-doc$_cross"
replaces="libstdc++"
+: ${LANG_CXX:=true}
: ${LANG_OBJC:=true}
: ${LANG_JAVA:=true}
: ${LANG_GO:=true}
: ${LANG_FORTRAN:=true}
: ${LANG_ADA:=true}
-if [ "$CBUILD" != "$CHOST" ]; then
+LIBGOMP=true
+LIBGCC=true
+LIBATOMIC=true
+LIBITM=true
+if [ "$CHOST" != "$CTARGET" ] && [ -n "$CHOST" -a -n "$CTARGET" ]; then
+ if [ "$BOOTSTRAP" ]; then
+ LANG_CXX=false
+ LANG_ADA=false
+ LIBGCC=false
+ _builddir="$srcdir/build-cross-pass2"
+ else
+ _builddir="$srcdir/build-cross-final"
+ fi
+ LANG_OBJC=false
+ LANG_JAVA=false
+ LANG_GO=false
+ LANG_FORTRAN=false
+ LIBGOMP=false
+ LIBATOMIC=false
+ LIBITM=false
+
+ # reset target flags (should be set in crosscreate abuild)
+ # fixup flags. seems gcc treats CPPFLAGS as global without
+ # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
+ export CFLAGS="$CPPFLAGS $CFLAGS"
+ export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
+ unset CPPFLAGS
+ [ -z "$CFLAGS_FOR_TARGET" ] && export CFLAGS_FOR_TARGET=" "
+ [ -z "$CXXFLAGS_FOR_TARGET" ] && export CXXFLAGS_FOR_TARGET=" "
+ [ -z "$LDFLAGS_FOR_TARGET" ] && export LDFLAGS_FOR_TARGET=" "
+
+ STRIP_FOR_TARGET="$CTARGET-strip"
+elif [ "$CBUILD" != "$CHOST" ] && [ -n "$CBUILD" -a -n "$CHOST" ]; then
# fixup flags. seems gcc treats CPPFLAGS as global without
# _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS.
export CFLAGS="$CPPFLAGS $CFLAGS"
@@ -39,34 +79,66 @@ if [ "$CBUILD" != "$CHOST" ]; then
export CXXFLAGS_FOR_BUILD=" "
export LDFLAGS_FOR_BUILD=" "
+ # Languages that do not need bootstrapping
LANG_OBJC=false
LANG_JAVA=false
LANG_GO=false
LANG_FORTRAN=false
- # ada needs bootstrapping
- LANG_ADA=true
+
+ STRIP_FOR_TARGET=${CROSS_COMPILE}strip
+ _builddir="$srcdir/build-cross-native"
+else
+ STRIP_FOR_TARGET=${CROSS_COMPILE}strip
+ _builddir="$srcdir/build"
+fi
+
+# Go needs {set,make,swap}context, unimplemented in musl
+[ "$CTARGET_LIBC" = musl ] && LANG_GO=false
+
+# libitm has TEXTRELs in ARM build, so disable for now
+case "$CTARGET_ARCH" in
+arm*) LIBITM=false ;;
+esac
+
+# Fortran uses libquadmath if toolchain has __float128
+# currently on x86, x86_64 and ia64
+LIBQUADMATH=$LANG_FORTRAN
+case "$CTARGET_ARCH" in
+x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;;
+*) LIBQUADMATH=false ;;
+esac
+
+$LIBGCC && subpackages="$subpackages libgcc"
+$LIBQUADMATH && subpackages="$subpackages libquadmath"
+if $LIBGOMP; then
+ depends="$depends libgomp=$_gccrel"
+ subpackages="$subpackages libgomp"
fi
-_languages=c,c++
+_languages=c
+if $LANG_CXX; then
+ subpackages="$subpackages libstdc++:libcxx g++$_cross:gpp"
+ _languages="$_languages,c++"
+fi
if $LANG_OBJC; then
- subpackages="$subpackages libobjc $pkgname-objc"
+ subpackages="$subpackages libobjc gcc-objc$_cross:objc"
_languages="$_languages,objc"
fi
if $LANG_JAVA; then
- subpackages="$subpackages libgcj $pkgname-java"
+ subpackages="$subpackages libgcj gcc-java$_cross:java"
makedepends="$makedepends paxctl"
_languages="$_languages,java"
fi
if $LANG_GO; then
- subpackages="$subpackages libgo $pkgname-go"
+ subpackages="$subpackages libgo gcc-go$_cross:go"
_languages="$_languages,go"
fi
if $LANG_FORTRAN; then
- subpackages="$subpackages libgfortran libquadmath gfortran"
+ subpackages="$subpackages libgfortran gfortran$_cross:gfortran"
_languages="$_languages,fortran"
fi
if $LANG_ADA; then
- subpackages="$subpackages libgnat $pkgname-gnat"
+ subpackages="$subpackages libgnat gcc-gnat$_cross:gnat"
_languages="$_languages,ada"
makedepends="$makedepends gcc-gnat"
fi
@@ -85,28 +157,36 @@ source="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.bz2
67_all_gcc-poison-system-directories.patch
74_all_gcc48_cloog-dl.patch
+ gcc-ice-hack.patch
gcc-spec-env.patch
- gcc-4.8-musl.patch
libgcc-always-build-gcceh.a.patch
pt_gnu_eh_frame.patch
uclibc-getipinfo.patch
gcc-4.6-pr32219.patch
gcc-4.8-dynamic-linker.patch
- boehem-gc-uclibc.patch
+ gcc-4.8-musl.patch
+ boehm-gc-uclibc.patch
+ boehm-gc-musl.patch
gcc-pure64.patch
+ pr49423.patch
+ pr57748.patch
gcc-4.8-build-args.patch
fix-cxxflags-passing.patch
+ fix-cxxflags-for-target.patch
ada-no-pie.patch
+ ada-fixes.patch
+ ada-crossbuild.patch
+ ada-shared.patch
+ ada-musl.patch
"
# gcc-go.patch
# we build out-of-tree
_gccdir="$srcdir"/gcc-$pkgver
-_builddir="$srcdir/build"
-_gcclibdir=/usr/lib/gcc/${CHOST:-$_chost}/$pkgver
-_gcclibexec=/usr/libexec/gcc/${CHOST:-$_chost}/$pkgver
+_gcclibdir=/usr/lib/gcc/${CTARGET}/$pkgver
+_gcclibexec=/usr/libexec/gcc/${CTARGET}/$pkgver
prepare() {
cd "$_gccdir"
@@ -123,6 +203,9 @@ prepare() {
patch -t -p0 -i $i || patch -t -p1 -i $i || return 1
done
+ sed -i -e 's/stage1_cflags="$stage1_cflags -fno-stack-protector"/stage1_cflags="$stage1_cflags -fno-stack-protector -fno-stack-check"/g' \
+ configure
+
# Gentoo and uclibc patches
_err=
for i in $source; do
@@ -161,65 +244,77 @@ prepare() {
build() {
local _dynamic_linker=
local _arch_configure=
+ local _libc_configure=
+ local _cross_configure=
+ local _bootstrap_configure=
local _symvers=
+
cd "$_gccdir"
- export CFLAGS="-fno-stack-protector $CFLAGS"
- [ -z "$CBUILD" ] && CBUILD="$CHOST"
- [ -z "$CTARGET" ] && CTARGET="$CHOST"
- case "$CHOST" in
- x86_64-*-uclibc)
- _dynamic_linker="--with-dynamic-linker=ld64-uClibc.so.$_uclibc_abiver"
- ;;
- *-uclibc)
- _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver"
- ;;
- x86_64-*-gnu)
- _dynamic_linker="--with-dynamic-linker=ld-linux-x86-64.so.2"
- ;;
- *-gnu)
- _dynamic_linker="--with-dynamic-linker=ld-linux.so.2"
- ;;
- *) _dynamic_linker=
- _symvers="--disable-symvers"
- ;;
+ case "$CTARGET" in
+ x86_64-*-uclibc) _dynamic_linker="--with-dynamic-linker=ld64-uClibc.so.$_uclibc_abiver" ;;
+ *-uclibc) _dynamic_linker="--with-dynamic-linker=ld-uClibc.so.$_uclibc_abiver" ;;
+ x86_64-*-gnu) _dynamic_linker="--with-dynamic-linker=ld-linux-x86-64.so.2" ;;
+ *-gnu) _dynamic_linker="--with-dynamic-linker=ld-linux.so.2" ;;
esac
+ [ -n "$_dynamic_linker" ] && _dynamic_linker="--with-dynamic-linker-prefix=/lib $_dynamic_linker"
- # disable symvers for non-glibc (uclibc/musl)
- # ifunc attributes detection is broke in configure script so force
- # disable it for non-glibc. It is used heavily by Go lang.
- case "$CHOST" in
- *-gnu) ;;
- *) export libat_cv_have_ifunc=no
- ;;
+ case "$CTARGET" in
+ armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=cortex-a15 --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux";;
+ armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6zk --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=hard --with-abi=aapcs-linux";;
+ i486-*-*-*) _arch_configure="--with-arch=i486 --enable-cld";;
esac
- # --enable-target-optspace is broken on powerpc
- if [ "$CARCH" != "powerpc" ]; then
- _arch_configure="$_arch_configure --enable-target-optspace"
+ case "$CTARGET_LIBC" in
+ musl)
+ # musl does not support mudflap
+ _libc_configure="--disable-libssp --disable-libmudflap --disable-libsanitizer"
+ _symvers="--disable-symvers"
+ export gcc_cv_libc_provides_ssp=yes
+ export libat_cv_have_ifunc=no
+ ;;
+ uclibc)
+ _libc_configure="--disable-libssp --without-system-libunwind"
+ export gcc_cv_libc_provides_ssp=yes
+ export libat_cv_have_ifunc=no
+ ;;
+ esac
+
+ if [ "$CHOST" != "$CTARGET" ]; then
+ _cross_configure="--disable-bootstrap --enable-clocale=gnu"
+ _cross_configure="$_cross_configure --with-sysroot=$CBUILDROOT"
fi
- case "$CARCH" in
- arm*) _arch_configure="$_arch_configure --with-float=hard";;
+ case "$BOOTSTRAP" in
+ noheaders)
+ _bootstrap_configure="--with-newlib --without-headers --disable-shared --enable-threads=no"
+ ;;
+ nolibc)
+ _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no"
+ ;;
+ *)
+ _bootstrap_configure="--enable-shared --enable-threads --enable-tls"
+ ;;
esac
- if [ "${CHOST#*musl}" != "$CHOST" ]; then
- # musl does not support mudflap
- _arch_configure="$_arch_configure --disable-mudflap --disable-libmudflap"
- # gcc does not detect musl's ssp support, force it
- export gcc_cv_libc_provides_ssp=yes
- else
- _arch_configure="$_arch_configure --without-system-libunwind"
- fi
+ $LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp"
+ $LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
+ $LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
+ $LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
msg "Building the following:"
echo ""
echo " CBUILD=$CBUILD"
echo " CHOST=$CHOST"
echo " CTARGET=$CTARGET"
+ echo " CTARGET_ARCH=$CTARGET_ARCH"
+ echo " CTARGET_LIBC=$CTARGET_LIBC"
echo " languages=$_languages"
echo " dynamic_linker=$_dynamic_linker"
echo " arch_configure=$_arch_configure"
+ echo " libc_configure=$_libc_configure"
+ echo " cross_configure=$_cross_configure"
+ echo " bootstrap_configure=$_bootstrap_configure"
echo ""
mkdir -p "$_builddir"
@@ -231,27 +326,22 @@ build() {
--host=${CHOST} \
--target=${CTARGET} \
--with-pkgversion="Alpine ${pkgver}" \
- --disable-altivec \
- --disable-build-with-cxx \
- --disable-checking \
+ --enable-checking=release \
--disable-fixed-point \
- --disable-libssp \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-nls \
--disable-werror \
$_symvers \
--enable-__cxa_atexit \
- --enable-cld \
--enable-esp \
--enable-cloog-backend \
--enable-languages=$_languages \
- --enable-shared \
$_arch_configure \
- --enable-tls \
- --enable-threads \
+ $_libc_configure \
+ $_cross_configure \
+ $_bootstrap_configure \
$_dynamic_linker \
- --with-dynamic-linker-prefix=/lib \
--with-system-zlib \
|| return 1
@@ -285,7 +375,7 @@ package() {
|| return 1
# strip debug info from some statib libs
- ${CROSS_COMPILE}strip -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
+ ${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \
-o -name libmudflap.a -o -name libmudflapth.a \
-o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \
-o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \
@@ -314,13 +404,23 @@ package() {
ln -s ../../../../${i##*/} $i || return 1
done
fi
+
+ if [ "$CHOST" != "$CTARGET" ]; then
+ # cross-gcc: remove any files that would conflict with the
+ # native gcc package
+ rm -rf "$pkgdir"/usr/bin/cc "$pkgdir"/usr/include "$pkgdir"/usr/share
+ fi
}
libcxx() {
pkgdesc="GNU C++ standard runtime library"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
- mv "$pkgdir"/usr/lib/libstdc++.so.* "$subpkgdir"/usr/lib/
+ mv "$pkgdir"/usr/lib/libstdc++.so.* "$subpkgdir"/usr/lib/ || \
+ cp "$pkgdir"/usr/$CTARGET/lib/libstdc++.so.* "$subpkgdir"/usr/lib/ || \
+ return 1
}
gpp() {
@@ -351,6 +451,7 @@ objc() {
pkgdesc="GNU Objective-C"
replaces="gcc"
depends="libc-dev gcc=$_gccrel libobjc=$_gccrel"
+
mkdir -p "$subpkgdir"/$_gcclibdir/include \
"$subpkgdir"/usr/lib \
|| return 1
@@ -363,14 +464,20 @@ objc() {
libgcc() {
pkgdesc="GNU C compiler runtime libraries"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
- mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || return 1
+ mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || \
+ cp "$pkgdir"/usr/$CTARGET/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/ || \
+ return 1
}
libgomp() {
pkgdesc="GCC shared-memory parallel programming API library"
depends=
replaces="gcc"
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgomp.so.* "$subpkgdir"/usr/lib/
}
@@ -378,6 +485,7 @@ libgomp() {
java() {
pkgdesc="Java support for GCC"
depends="zlib-dev gcc=$_gccrel libgcj=$_gccrel"
+
paxctl -c -pm "$pkgdir"/$_gcclibexec/ecj1 || return 1
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib
cd "$pkgdir"/usr/bin
@@ -403,6 +511,8 @@ libgcj() {
# libgcj_bc.so moved from gcc-java to libgcj
replaces="gcc-java"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/bin
cd "$pkgdir"/usr/bin
paxctl -c -pmse "$pkgdir"/usr/bin/gij || return 1
@@ -433,6 +543,8 @@ libgcj() {
libgo() {
pkgdesc="Go runtime library for GCC"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgo.so.* "$subpkgdir"/usr/lib/
}
@@ -440,6 +552,7 @@ libgo() {
go() {
pkgdesc="Go support for GCC"
depends="gcc=$_gccrel libgo=$_gccrel"
+
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/usr/lib \
"$subpkgdir"/usr/bin || return 1
@@ -455,6 +568,8 @@ go() {
libgfortran() {
pkgdesc="Fortran runtime library for GCC"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgfortran.so.* "$subpkgdir"/usr/lib/
}
@@ -463,14 +578,18 @@ libquadmath() {
replaces="gcc"
pkgdesc="128-bit math library for GCC"
depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libquadmath.so.* "$subpkgdir"/usr/lib/
}
gfortran() {
pkgdesc="GNU Fortran Compiler"
- depends="gcc=$_gccrel libgfortran=$_gccrel libquadmath=$_gccrel"
+ depends="gcc=$_gccrel libgfortran=$_gccrel"
+ $LIBQUADMATH && depends="$depends libquadmath=$_gccrel"
replaces="gcc"
+
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/$_gcclibdir \
"$subpkgdir"/usr/lib \
@@ -478,9 +597,12 @@ gfortran() {
mv "$pkgdir"/usr/bin/*gfortran "$subpkgdir"/usr/bin/ || return 1
mv "$pkgdir"/usr/lib/libgfortran.a \
"$pkgdir"/usr/lib/libgfortran.so \
- "$pkgdir"/usr/lib/libquadmath.a \
- "$pkgdir"/usr/lib/libquadmath.so \
"$subpkgdir"/usr/lib/ || return 1
+ if $LIBQUADMATH; then
+ mv "$pkgdir"/usr/lib/libquadmath.a \
+ "$pkgdir"/usr/lib/libquadmath.so \
+ "$subpkgdir"/usr/lib/ || return 1
+ fi
mv "$pkgdir"/$_gcclibexec/f951 \
"$subpkgdir"/$_gcclibexec
mv "$pkgdir"/$_gcclibdir/libgfortranbegin.a \
@@ -489,20 +611,26 @@ gfortran() {
libgnat() {
pkgdesc="GNU Ada 95 runtime shared libraries"
+ depends=
+ CARCH="$CTARGET_ARCH"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libgna*.so "$subpkgdir"/usr/lib/
}
gnat() {
pkgdesc="Ada 95 support for GCC"
+ depends="gcc=$_gccrel"
+ [ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel"
+
mkdir -p "$subpkgdir"/$_gcclibexec \
"$subpkgdir"/$_gcclibdir \
"$subpkgdir"/usr/bin \
|| return 1
- mv "$pkgdir"/$_gcclibexec/gnat* "$subpkgdir"/$_gcclibexec/ \
+ mv "$pkgdir"/$_gcclibexec/*gnat* "$subpkgdir"/$_gcclibexec/ \
|| return 1
- mv "$pkgdir"/$_gcclibdir/ada* "$subpkgdir"/$_gcclibdir/ || return 1
- mv "$pkgdir"/usr/bin/gnat* "$subpkgdir"/usr/bin/ || return 1
+ mv "$pkgdir"/$_gcclibdir/*ada* "$subpkgdir"/$_gcclibdir/ || return 1
+ mv "$pkgdir"/usr/bin/*gnat* "$subpkgdir"/usr/bin/ || return 1
}
md5sums="3b2386c114cd74185aa3754b58a79304 gcc-4.8.1.tar.bz2
@@ -517,18 +645,27 @@ f28e9334c58ce14f69a9e988026bc772 12_all_default-warn-trampolines.patch
d8692c56f04b92667096f59d843e95c5 51_all_libiberty-pic.patch
ca4f395856bbb80d23398246572c30fa 67_all_gcc-poison-system-directories.patch
9c443d9d0fba2ce97b12f674b7d14c7e 74_all_gcc48_cloog-dl.patch
+ea0fdebab6c660635736d27f4ea2f113 gcc-ice-hack.patch
a695d7648509b4f8e18b389a19e6037c gcc-spec-env.patch
-cd8ef37289815c939adc954ba95e9294 gcc-4.8-musl.patch
504c7dd8651c5d98229892c4cd9ea591 libgcc-always-build-gcceh.a.patch
ab83248e10b2bf4b3d9240de0fefb52b pt_gnu_eh_frame.patch
6cc2385c5bbd6d0da6eaedd53c8bf547 uclibc-getipinfo.patch
32e8e4c0e23ed8f5de95a591cb30f1da gcc-4.6-pr32219.patch
79d00ee1284fac5192456f7f7d3908aa gcc-4.8-dynamic-linker.patch
-2c6cb49bb9bfd8b6e690222e66ccc901 boehem-gc-uclibc.patch
+b389ecd3b46ab2142c7b0cf113f31097 gcc-4.8-musl.patch
+2c6cb49bb9bfd8b6e690222e66ccc901 boehm-gc-uclibc.patch
+ea2749b1337a5d850a8f463071cc4747 boehm-gc-musl.patch
2e2b787bb988d9007c9f7ce42178dfe6 gcc-pure64.patch
+762a7134017fe1056aaa6388b9b3a2d5 pr49423.patch
+fb28fd941c110627b7b9ca523d66b8d6 pr57748.patch
0a2041bbf83648e6c4f6d3484f7249ca gcc-4.8-build-args.patch
4aea37d334ab00bb6bba37cd8c481367 fix-cxxflags-passing.patch
-ac802687c02ca78687c8e612277e566a ada-no-pie.patch"
+87684048ecaaf0e046983bc2782292dd fix-cxxflags-for-target.patch
+750e903d5a53ba32618c2142cdd914e1 ada-no-pie.patch
+2e946abc09924d91988a9b7fd5824ef3 ada-fixes.patch
+d77c99bf7c03d082a540aaba1193be40 ada-crossbuild.patch
+20e2731c02ce50739ebdead2795f9c41 ada-shared.patch
+4e47bdae120129462244da0d89a573b3 ada-musl.patch"
sha256sums="545b44be3ad9f2c4e90e6880f5c9d4f0a8f0e5f67e1ffb0d45da9fa01bb05813 gcc-4.8.1.tar.bz2
4aa0ab0f114b0ff8af5d0c19c18930e3fcd5e5b0956f56ca24e58e5a243964b1 gcc-4.8.1-piepatches-v0.5.6.tar.bz2
f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -541,18 +678,27 @@ cead5b092ab4881e8b830d51c0037a8fb149bab632e7661aa505ba574295e0e4 48_all_x86_pr5
da6bbb5dc654d5e1df8ecae5c9ebb56265426c405931f14f5878248b8c79f78d 51_all_libiberty-pic.patch
8ba9dec0ecc2620c8ab1dfbeb0708dd4c29021e57d2e0ea23720108b1db3462e 67_all_gcc-poison-system-directories.patch
7d129093a6682418da9313611a90e3052855d8af4505d401f7b8b6a64e8f7b17 74_all_gcc48_cloog-dl.patch
+8f7efd182fd7517fdcd8b78de11b75bfd9f2fa623ffec3d762ae6ff9ab77a476 gcc-ice-hack.patch
64b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a gcc-spec-env.patch
-8b85ebc6603a1b3488e1eb800fdb00168515ae154006398a1a08af57c1d3b5b5 gcc-4.8-musl.patch
1975189156d70f5428cb7f1516533965d1c8734f3009fc89a9b8e289b72326f1 libgcc-always-build-gcceh.a.patch
78e75cb378bdfe870c98ab3cffef37f54be729d3912979191f27ca00651ad6c4 pt_gnu_eh_frame.patch
53184f842477569973c232dac7c85e71b0018cbe5c4962f95dd9e0273f42083e uclibc-getipinfo.patch
89207a8b62137a857ee2c43499d6b5247d37b530d1338844dbb330a6846b2ad2 gcc-4.6-pr32219.patch
f3863b997acf8fdf5ad1d3626b41a8a0670b896505e9b7afb517916c7599fb1c gcc-4.8-dynamic-linker.patch
-02751ccf223dcfc898c0ce2214cd0859d275e90b742f1a66e38db5c50f94b38c boehem-gc-uclibc.patch
+a92e782e38a691c8a2042ac14d7501fd6df54e917c2daa65b6e7a98adcda0323 gcc-4.8-musl.patch
+02751ccf223dcfc898c0ce2214cd0859d275e90b742f1a66e38db5c50f94b38c boehm-gc-uclibc.patch
+6adcddbc9d52b4e39878155bc7ff0114c322e0f05c0c82dff8c06c7278313f73 boehm-gc-musl.patch
f5473c6aea96d5137defd68898ba31042944a3f3ed26c05b964a40bd876c6f47 gcc-pure64.patch
+d68d6680b3ab996b4b8dde2ddc351cecb46b560dc743d112e682c596696b67bb pr49423.patch
+999fdf60b3a51435e7485a57e12c1110a2af3965e14528f77d5dd0917115011d pr57748.patch
bd7a6f514fcc457f29e5fda157203f3bcd013aeba5d53b3459196eef3ce752ab gcc-4.8-build-args.patch
a395ba4cf047c48cac56985726fddf0948f4425c9f1a0c9ddba1812b2b3d8300 fix-cxxflags-passing.patch
-a20f8ba10f6ee94c6af44752d9c43faf1c1ff3c631f18e3d85e2a7f2ca7f1e0d ada-no-pie.patch"
+a5678380e887dbf600c59273d382e81c10f89d28e422238a617d0a43ad5c5a69 fix-cxxflags-for-target.patch
+de3c8606015ebda0dc574f904aa4d23c44c5e261b34dce2ef4d08eed21cb99b9 ada-no-pie.patch
+556fcc3937d067e177acee7bbeeff80b0c5d445280c82e5af590db0f68143ebb ada-fixes.patch
+324524490c60d84ef040f79589e0f93fbaeb253dbe031484afaf963b881047e9 ada-crossbuild.patch
+d6c7fc1820a4fa285297c299c255fe2f19ce1695486f20edd098252a97545e6a ada-shared.patch
+f20c34f3e0a1bf717f5e22fd66b57c8b69f0411d063203c017ed8209f349e1d4 ada-musl.patch"
sha512sums="1becc874aad77a469069b6d9da4158aae9e013e24afa9364fe4feff9a5094d0673ee7694b3840e892c860f73a56b3ece6174338a8214438c42b9f86dd6c35ea7 gcc-4.8.1.tar.bz2
274e16ef5136348415898d4e5a3bc71763078de8ae7c18645e8b07f54d705609b08c0efadbdb55117fdfb5f6490529b446d09def448174c2747372829d029a9d gcc-4.8.1-piepatches-v0.5.6.tar.bz2
779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 gcc-4.4.3-specs-0.2.0.tar.bz2
@@ -565,15 +711,24 @@ c6c314a2d24531b4286436dec7189f83e443c4cfa9b88339a4c324c2d40812d766ed44dcfd4a0c3b
0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 51_all_libiberty-pic.patch
47331f034e44aea16f1cbb67d9176f8ce8832d6cb7c13a8d3b438efaa3269cee177bd1dd8a9f353ac19cc6b3db436a995de9ae66d493d2772188630b09fbff51 67_all_gcc-poison-system-directories.patch
6e19b2dc43cff03a6b3ca4e18f76dcfd5b0682c15aac493e94f5c679f5b0a585fbaa09345d200182c0f47541ced2d714b78d65da130bc7d2e9f810362e07037d 74_all_gcc48_cloog-dl.patch
+7242876e4bba34235f6f3ea960d72439638bd31547284ca96cb94c97a2d46dd7b38a3709fd159cf86efa1e8a44e3e9125fe82bc3a1cc71153591755827d6c9fd gcc-ice-hack.patch
ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48 gcc-spec-env.patch
-86ffdd09993004bc093233fcb1ea77d3a17965ccc0e09c59276b8f9e8ad79ae90eb6c6a3942472c638e9de31d2c83a25a46eee0903877033b46447e9f90258f8 gcc-4.8-musl.patch
d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch
8464197f01d107872dfa6b47e86e95ae8d75c053527bafbdb7a86bcc7aff4bc5b20a8ec40d6e48d1ad455b0187a3cba9db337cff6c0a6245507c4533e4832d99 pt_gnu_eh_frame.patch
e3edf75df1f27af8771bd263e1bd607f6207c4eb5b2a5e11032577deba43ea201825e3b5008a720105f24e49d2821dd77a61c7ceba7ed91b3621c0dbd9292fc6 uclibc-getipinfo.patch
9fc5e32f2573ae67b6cf22119d636d10a47c42718635bceff7d457a93a3f664ae1ed10e154f70964ba2d26b0de04f879a8c05de6411112760d40433373dd0a80 gcc-4.6-pr32219.patch
db84b6582950378116723116be4f277881f7bdd05add216c58c2b86c0fb3a70abeb7798507a74a64b9b949d5b311167bd4df84a048d2d2d32f5836ea1d34c42e gcc-4.8-dynamic-linker.patch
-e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehem-gc-uclibc.patch
+9923851779c860fb204ec9f2833a3cbd364d0675486b8de60f0191778955ff01f35d3754009021634c3e0ea8e32470cc39f4b18b6b6d4d7c687846a8b635672d gcc-4.8-musl.patch
+e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehm-gc-uclibc.patch
+7db904f83546edb4f7e54d3eaa0a8ab3235bca69e03a35000f083d26626bff92713f73150935c89f51e47c952bf29c36ec7d2fc8fedcde38048975e3e590faf9 boehm-gc-musl.patch
4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch
+b01ec5b2718e74048102d4a8e0a851f63524c9b9a70631ec93467b2e6080e8db2c500040572f64dce8161ef2c955bc1a7abd77d0e7970143967f9c8e0e3de948 pr49423.patch
+018a9f2b7b490066a02671be38e1a4f18caeff98210027e68a1d4bd3d78ff810aa45a5cca163f4c46ee0d120715541a95a6e2487e17f4bb923459dec8edf8f8f pr57748.patch
abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch
35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch
-f00e0d57154fd7c0e121fa862b85b86943874edab8bc10e27a8b2bf363e55ea8690c091d8a07695493721a0185d52723e9f02279f7e618ece655e29b4e52b930 ada-no-pie.patch"
+c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch
+4938a38d6ffebebcd8b07a60e7d300935ef57056e5820145c6668dd5141e272d73a67a1bfe84dafda77212058eee768a03aba4356e52867b40a9ba9216a96714 ada-no-pie.patch
+0541b4e31164d3fed653e811c1ededcf0dc578220f11f4ca3d8a293b2cf1ebc62b4259afd103a5d24092cc738a5760efdd5310a6383d0d8152309562d04b0525 ada-fixes.patch
+4d411563f6a3ea06bc3a1f4fa77d10250cc275e2496df6039d93f9b2229bc1f5334e484494dbd08881cf046f98aaca8bdddaa6b4a8f947b936d0bdc9e91f2f2b ada-crossbuild.patch
+3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch
+7f6dc922a2c80b1c8c5ed0b6d6e4c1e672984f54bb217f28517929af129892e42c45f7aea4b9c50d8bbc008384b7ae19e1475c79f08b78775709720fe317c8f3 ada-musl.patch"
diff --git a/main/gcc/ada-crossbuild.patch b/main/gcc/ada-crossbuild.patch
new file mode 100644
index 0000000000..d3d2280cb6
--- /dev/null
+++ b/main/gcc/ada-crossbuild.patch
@@ -0,0 +1,49 @@
+Based on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55946
+
+--- gcc-4.8.1/libada/configure.orig
++++ gcc-4.8.1/libada/configure
+@@ -2951,9 +2951,7 @@
+
+
+ # Determine what to build for 'gnatlib'
+-if test $build = $target \
+- && test ${enable_shared} = yes ; then
+- # Note that build=target is almost certainly the wrong test; FIXME
++if test ${enable_shared} = yes ; then
+ default_gnatlib_target="gnatlib-shared"
+ else
+ default_gnatlib_target="gnatlib-plain"
+--- gcc-4.8.1/gcc/ada/gcc-interface/Make-lang.in.orig
++++ gcc-4.8.1/gcc/ada/gcc-interface/Make-lang.in
+@@ -625,7 +625,7 @@
+ ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb
+ -$(MKDIR) ada/doctools
+ $(CP) $^ ada/doctools
+- cd ada/doctools && $(GNATMAKE) -q xgnatugn
++ cd ada/doctools && gnatmake -q xgnatugn
+
+ # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on
+ # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info
+--- gcc-4.8.1/gnattools/Makefile.in.orig
++++ gcc-4.8.1/gnattools/Makefile.in
+@@ -32,6 +32,8 @@
+ # Nonstandard autoconf-set variables.
+ LN_S=@LN_S@
+ target_noncanonical=@target_noncanonical@
++build=@build@
++host=@host@
+
+ # Variables for the user (or the top level) to override.
+ exeext = @EXEEXT@
+@@ -183,7 +185,11 @@
+ # put the host RTS dir first in the PATH to hide the default runtime
+ # files that are among the sources
+ # FIXME: This should be done in configure.
++ifeq ($(host), $(build))
+ RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
++else
++RTS_DIR:=$(strip $(subst \,/,$(shell $(host)-gnatls -v | grep adalib )))
++endif
+ gnattools-cross: $(GCC_DIR)/stamp-tools
+ # gnattools1-re
+ $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
diff --git a/main/gcc/ada-fixes.patch b/main/gcc/ada-fixes.patch
new file mode 100644
index 0000000000..db9a3e3ebe
--- /dev/null
+++ b/main/gcc/ada-fixes.patch
@@ -0,0 +1,47 @@
+--- gcc-4.8.1/gcc/ada/terminals.c.orig
++++ gcc-4.8.1/gcc/ada/terminals.c
+@@ -984,13 +984,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+
+-/* On some system termio is either absent or including it will disable termios
+- (HP-UX) */
+-#if ! defined (__hpux__) && ! defined (FREEBSD) && \
+- ! defined (__APPLE__) && ! defined(__rtems__)
+-# include <termio.h>
+-#endif
+-
+ #include <sys/ioctl.h>
+ #include <termios.h>
+ #include <fcntl.h>
+@@ -1032,10 +1025,8 @@
+ */
+
+ /* Configurable part */
+-#if defined (__APPLE__) || defined (FREEBSD)
++#if defined (__APPLE__) || defined (FREEBSD) || defined(linux)
+ #define USE_OPENPTY
+-#elif defined (linux)
+-#define USE_GETPT
+ #elif defined (sun)
+ #define USE_CLONE_DEVICE "/dev/ptmx"
+ #elif defined (_AIX)
+@@ -1179,7 +1170,7 @@
+ int status;
+
+ /* ensure that s is filled with 0 */
+- bzero (&s, sizeof (&s));
++ bzero (&s, sizeof (s));
+
+ /* Get the current terminal settings */
+ status = tcgetattr (fd, &s);
+--- gcc-4.8.1/gcc/ada/cal.c.orig
++++ gcc-4.8.1/gcc/ada/cal.c
+@@ -65,6 +65,7 @@
+ #include <time.h>
+ #else
+ #include <sys/time.h>
++#include <time.h>
+ #endif
+
+ #ifdef __MINGW32__
diff --git a/main/gcc/ada-musl.patch b/main/gcc/ada-musl.patch
new file mode 100644
index 0000000000..8255e3b36e
--- /dev/null
+++ b/main/gcc/ada-musl.patch
@@ -0,0 +1,118 @@
+--- gcc-4.8.1/gcc/ada/adaint.c.orig
++++ gcc-4.8.1/gcc/ada/adaint.c
+@@ -67,6 +67,11 @@
+ #include <sys/pstat.h>
+ #endif
+
++#if defined (linux)
++#define _GNU_SOURCE 1
++#include <sched.h>
++#endif
++
+ #ifdef VMS
+ #define _POSIX_EXIT 1
+ #define HOST_EXECUTABLE_SUFFIX ".exe"
+@@ -3782,8 +3787,6 @@
+ return (void *) syscall (__NR_gettid);
+ }
+
+-#include <sched.h>
+-
+ /* glibc versions earlier than 2.7 do not define the routines to handle
+ dynamically allocated CPU sets. For these targets, we use the static
+ versions. */
+@@ -3792,7 +3795,7 @@
+
+ /* Dynamic cpu sets */
+
+-cpu_set_t *__gnat_cpu_alloc (size_t count)
++void *__gnat_cpu_alloc (size_t count)
+ {
+ return CPU_ALLOC (count);
+ }
+@@ -3802,30 +3805,30 @@
+ return CPU_ALLOC_SIZE (count);
+ }
+
+-void __gnat_cpu_free (cpu_set_t *set)
++void __gnat_cpu_free (void *set)
+ {
+- CPU_FREE (set);
++ CPU_FREE ((cpu_set_t *) set);
+ }
+
+-void __gnat_cpu_zero (size_t count, cpu_set_t *set)
++void __gnat_cpu_zero (size_t count, void *set)
+ {
+- CPU_ZERO_S (count, set);
++ CPU_ZERO_S (count, (cpu_set_t *) set);
+ }
+
+-void __gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
++void __gnat_cpu_set (int cpu, size_t count, void *set)
+ {
+ /* Ada handles CPU numbers starting from 1, while C identifies the first
+ CPU by a 0, so we need to adjust. */
+- CPU_SET_S (cpu - 1, count, set);
++ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
+ }
+
+ #else
+
+ /* Static cpu sets */
+
+-cpu_set_t *__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
++void *__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
+ {
+- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
++ return xmalloc (sizeof (cpu_set_t));
+ }
+
+ size_t __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
+@@ -3833,21 +3836,21 @@
+ return sizeof (cpu_set_t);
+ }
+
+-void __gnat_cpu_free (cpu_set_t *set)
++void __gnat_cpu_free (void *set)
+ {
+ free (set);
+ }
+
+-void __gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++void __gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+- CPU_ZERO (set);
++ CPU_ZERO ((cpu_set_t *) set);
+ }
+
+-void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+ /* Ada handles CPU numbers starting from 1, while C identifies the first
+ CPU by a 0, so we need to adjust. */
+- CPU_SET (cpu - 1, set);
++ CPU_SET (cpu - 1, (cpu_set_t *) set);
+ }
+ #endif
+ #endif
+--- gcc-4.8.1/gcc/ada/adaint.h.orig
++++ gcc-4.8.1/gcc/ada/adaint.h
+@@ -259,13 +259,11 @@
+
+ /* Routines for interface to required CPU set primitives */
+
+-#include <sched.h>
+-
+-extern cpu_set_t *__gnat_cpu_alloc (size_t);
++extern void * __gnat_cpu_alloc (size_t);
+ extern size_t __gnat_cpu_alloc_size (size_t);
+-extern void __gnat_cpu_free (cpu_set_t *);
+-extern void __gnat_cpu_zero (size_t, cpu_set_t *);
+-extern void __gnat_cpu_set (int, size_t, cpu_set_t *);
++extern void __gnat_cpu_free (void *);
++extern void __gnat_cpu_zero (size_t, void *);
++extern void __gnat_cpu_set (int, size_t, void *);
+ #endif
+
+ #if defined (_WIN32)
diff --git a/main/gcc/ada-no-pie.patch b/main/gcc/ada-no-pie.patch
index e5bdfdea1e..a38db87196 100644
--- a/main/gcc/ada-no-pie.patch
+++ b/main/gcc/ada-no-pie.patch
@@ -1,5 +1,5 @@
---- ./gcc/ada/gcc-interface/Makefile.in.orig 2013-02-06 11:19:08.000000000 +0000
-+++ ./gcc/ada/gcc-interface/Makefile.in 2013-08-30 07:52:29.016804483 +0000
+--- gcc-4.8.1/gcc/ada/gcc-interface/Makefile.in.orig
++++ gcc-4.8.1/gcc/ada/gcc-interface/Makefile.in
@@ -2462,23 +2462,23 @@
gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
@@ -33,6 +33,24 @@
../../gnatsym$(exeext): ../stamp-tools
$(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
+@@ -2500,7 +2500,7 @@
+ $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake
+ $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
+- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
++ --GCC="$(GCC_LINK)" -fno-PIE $(TOOLS_LIBS)
+
+ # Note the use of the "mv" command in order to allow gnatlink to be linked with
+ # with the former version of gnatlink itself which cannot override itself.
+@@ -2510,7 +2510,7 @@
+ $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink
+ $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
+- --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
++ --GCC="$(GCC_LINK)" -fno-PIE $(TOOLS_LIBS)
+ $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext)
+
+ # Needs to be built with CC=gcc
@@ -2519,11 +2519,11 @@
# Likewise for the tools
diff --git a/main/gcc/ada-shared.patch b/main/gcc/ada-shared.patch
new file mode 100644
index 0000000000..6f1c16aff9
--- /dev/null
+++ b/main/gcc/ada-shared.patch
@@ -0,0 +1,30 @@
+Index: b/gcc/ada/link.c
+===================================================================
+--- a/gcc/ada/link.c
++++ b/gcc/ada/link.c
+@@ -105,9 +105,9 @@
+
+ #elif defined (__FreeBSD__)
+ const char *__gnat_object_file_option = "-Wl,@";
+-const char *__gnat_run_path_option = "-Wl,-rpath,";
+-char __gnat_shared_libgnat_default = STATIC;
+-char __gnat_shared_libgcc_default = STATIC;
++const char *__gnat_run_path_option = "";
++char __gnat_shared_libgnat_default = SHARED;
++char __gnat_shared_libgcc_default = SHARED;
+ int __gnat_link_max = 8192;
+ unsigned char __gnat_objlist_file_supported = 1;
+ const char *__gnat_object_library_extension = ".a";
+@@ -127,9 +127,9 @@
+
+ #elif defined (linux) || defined(__GLIBC__)
+ const char *__gnat_object_file_option = "-Wl,@";
+-const char *__gnat_run_path_option = "-Wl,-rpath,";
+-char __gnat_shared_libgnat_default = STATIC;
+-char __gnat_shared_libgcc_default = STATIC;
++const char *__gnat_run_path_option = "";
++char __gnat_shared_libgnat_default = SHARED;
++char __gnat_shared_libgcc_default = SHARED;
+ int __gnat_link_max = 8192;
+ unsigned char __gnat_objlist_file_supported = 1;
+ const char *__gnat_object_library_extension = ".a";
diff --git a/main/gcc/boehm-gc-musl.patch b/main/gcc/boehm-gc-musl.patch
new file mode 100644
index 0000000000..83fcc285c6
--- /dev/null
+++ b/main/gcc/boehm-gc-musl.patch
@@ -0,0 +1,11 @@
+--- gcc-4.8.1/boehm-gc/os_dep.c.orig 2013-09-17 07:46:00.969884340 +0000
++++ gcc-4.8.1/boehm-gc/os_dep.c 2013-09-17 06:53:53.629884946 +0000
+@@ -26,7 +26,7 @@
+ # define __KERNEL__
+ # include <asm/signal.h>
+ # undef __KERNEL__
+-# else
++# elif defined(__GLIBC__)
+ /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
+ /* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */
+ /* prototypes, so we have to include the top-level sigcontext.h to */
diff --git a/main/gcc/boehem-gc-uclibc.patch b/main/gcc/boehm-gc-uclibc.patch
index 0fa6884105..0fa6884105 100644
--- a/main/gcc/boehem-gc-uclibc.patch
+++ b/main/gcc/boehm-gc-uclibc.patch
diff --git a/main/gcc/fix-cxxflags-for-target.patch b/main/gcc/fix-cxxflags-for-target.patch
new file mode 100644
index 0000000000..24dafe74be
--- /dev/null
+++ b/main/gcc/fix-cxxflags-for-target.patch
@@ -0,0 +1,5 @@
+--- gcc-4.8.1/config/mt-gnu.orig
++++ gcc-4.8.1/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET := $(CXXFLAGS_FOR_TARGET) -D_GNU_SOURCE
diff --git a/main/gcc/gcc-4.8-musl.patch b/main/gcc/gcc-4.8-musl.patch
index 4c32a3e589..a394630b0e 100644
--- a/main/gcc/gcc-4.8-musl.patch
+++ b/main/gcc/gcc-4.8-musl.patch
@@ -1,25 +1,51 @@
-11b7c7e47a01 tip
+--- a/gcc/config/aarch64/aarch64-linux.h 2013-01-10 21:38:27.000000000 +0100
++++ b/gcc/config/aarch64/aarch64-linux.h 2013-09-12 21:39:34.004829498 +0200
+@@ -21,7 +21,11 @@
+ #ifndef GCC_AARCH64_LINUX_H
+ #define GCC_AARCH64_LINUX_H
+
++/* The AArch64 port currently supports two dynamic linkers:
++ - ld-linux-aarch64.so.1 - GLIBC dynamic linker
++ - ld-musl-aarch64.so.1 - musl libc dynamic linker */
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64.so.1"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1"
+
+ #define LINUX_TARGET_LINK_SPEC "%{h*} \
+ %{static:-Bstatic} \
# HG changeset patch
-# Parent 6b1b8174ce29396d7dbd482296f43eba38948222
+# Parent e87035576969de2cc4d03decf5f81d682addf305
Support for arm-linux-musl.
-diff -r 6b1b8174ce29 gcc/config/arm/linux-eabi.h
---- a/gcc/config/arm/linux-eabi.h Fri Mar 29 16:41:20 2013 -0400
-+++ b/gcc/config/arm/linux-eabi.h Fri Mar 29 16:41:23 2013 -0400
-@@ -77,6 +77,10 @@
+diff -r e87035576969 gcc/config/arm/linux-eabi.h
+--- a/gcc/config/arm/linux-eabi.h Sun Sep 08 16:10:51 2013 -0400
++++ b/gcc/config/arm/linux-eabi.h Sun Sep 08 16:12:57 2013 -0400
+@@ -77,6 +77,23 @@
%{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
%{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
-+/* musl has no "classic" (i.e. broken) mode */
++/* For ARM musl currently supports two dynamic linkers:
++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI.
++ musl does not support the legacy OABI (i.e. broken) mode.
++ All the dynamic linkers live in /lib.
++ We default to soft-float, but this can be overridden by changing both
++ MUSL_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
+#undef MUSL_DYNAMIC_LINKER
-+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
++#define MUSL_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
++#define MUSL_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
++#define MUSL_DYNAMIC_LINKER_DEFAULT MUSL_DYNAMIC_LINKER_SOFT_FLOAT
++
++#define MUSL_DYNAMIC_LINKER \
++ "%{mfloat-abi=hard:" MUSL_DYNAMIC_LINKER_HARD_FLOAT "} \
++ %{mfloat-abi=soft*:" MUSL_DYNAMIC_LINKER_SOFT_FLOAT "} \
++ %{!mfloat-abi=*:" MUSL_DYNAMIC_LINKER_DEFAULT "}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-diff -r 6b1b8174ce29 libitm/config/arm/hwcap.cc
---- a/libitm/config/arm/hwcap.cc Fri Mar 29 16:41:20 2013 -0400
-+++ b/libitm/config/arm/hwcap.cc Fri Mar 29 16:41:23 2013 -0400
+diff -r e87035576969 libitm/config/arm/hwcap.cc
+--- a/libitm/config/arm/hwcap.cc Sun Sep 08 16:10:51 2013 -0400
++++ b/libitm/config/arm/hwcap.cc Sun Sep 08 16:12:57 2013 -0400
@@ -40,7 +40,11 @@
#ifdef __linux__
@@ -32,13 +58,26 @@ diff -r 6b1b8174ce29 libitm/config/arm/hwcap.cc
#include <elf.h>
static void __attribute__((constructor))
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -26970,6 +26970,9 @@
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
++ *-linux-musl*)
++ gcc_cv_target_dl_iterate_phdr=yes
++ ;;
+ esac
+
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+
# HG changeset patch
-# Parent 2b29df135cf04fe23c38301f6d0fc5796366aecf
+# Parent 572f7b4d1c50cefde3aa2c43d06040fc308ad989
Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker.
-diff -r 2b29df135cf0 gcc/config.gcc
---- a/gcc/config.gcc Fri Mar 29 16:41:11 2013 -0400
-+++ b/gcc/config.gcc Fri Mar 29 16:41:14 2013 -0400
+diff -r 572f7b4d1c50 gcc/config.gcc
+--- a/gcc/config.gcc Sun Sep 08 22:58:18 2013 -0400
++++ b/gcc/config.gcc Mon Sep 09 12:48:34 2013 -0400
@@ -549,7 +549,7 @@
esac
@@ -58,9 +97,9 @@ diff -r 2b29df135cf0 gcc/config.gcc
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
-diff -r 2b29df135cf0 gcc/config/linux.h
---- a/gcc/config/linux.h Fri Mar 29 16:41:11 2013 -0400
-+++ b/gcc/config/linux.h Fri Mar 29 16:41:14 2013 -0400
+diff -r 572f7b4d1c50 gcc/config/linux.h
+--- a/gcc/config/linux.h Sun Sep 08 22:58:18 2013 -0400
++++ b/gcc/config/linux.h Mon Sep 09 12:48:34 2013 -0400
@@ -32,10 +32,12 @@
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
@@ -104,7 +143,7 @@ diff -r 2b29df135cf0 gcc/config/linux.h
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
-@@ -84,16 +89,16 @@
+@@ -84,21 +89,21 @@
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
@@ -125,9 +164,90 @@ diff -r 2b29df135cf0 gcc/config/linux.h
/* Determine whether the entire c99 runtime
is present in the runtime library. */
-diff -r 2b29df135cf0 gcc/config/linux.opt
---- a/gcc/config/linux.opt Fri Mar 29 16:41:11 2013 -0400
-+++ b/gcc/config/linux.opt Fri Mar 29 16:41:14 2013 -0400
+ #undef TARGET_C99_FUNCTIONS
+-#define TARGET_C99_FUNCTIONS (OPTION_GLIBC)
++#define TARGET_C99_FUNCTIONS (OPTION_GLIBC || OPTION_MUSL)
+
+ /* Whether we have sincos that follows the GNU extension. */
+ #undef TARGET_HAS_SINCOS
+@@ -107,3 +112,74 @@
+ /* Whether we have Bionic libc runtime */
+ #undef TARGET_HAS_BIONIC
+ #define TARGET_HAS_BIONIC (OPTION_BIONIC)
++
++/* musl avoids problematic includes by rearranging the include directories.
++ * Unfortunately, this is mostly duplicated from cppdefault.c */
++#if DEFAULT_LIBC == LIBC_MUSL
++#define INCLUDE_DEFAULTS_MUSL_GPP \
++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
++
++#ifdef LOCAL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_LOCAL \
++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_LOCAL
++#endif
++
++#ifdef PREFIX_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_PREFIX \
++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_PREFIX
++#endif
++
++#ifdef CROSS_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_CROSS \
++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#ifdef TOOL_INCLUDE_DIR
++#define INCLUDE_DEFAULTS_MUSL_TOOL \
++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
++#else
++#define INCLUDE_DEFAULTS_MUSL_TOOL
++#endif
++
++#ifdef NATIVE_SYSTEM_HEADER_DIR
++#define INCLUDE_DEFAULTS_MUSL_NATIVE \
++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
++#else
++#define INCLUDE_DEFAULTS_MUSL_NATIVE
++#endif
++
++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
++# undef INCLUDE_DEFAULTS_MUSL_LOCAL
++# define INCLUDE_DEFAULTS_MUSL_LOCAL
++# undef INCLUDE_DEFAULTS_MUSL_NATIVE
++# define INCLUDE_DEFAULTS_MUSL_NATIVE
++#else
++# undef INCLUDE_DEFAULTS_MUSL_CROSS
++# define INCLUDE_DEFAULTS_MUSL_CROSS
++#endif
++
++#undef INCLUDE_DEFAULTS
++#define INCLUDE_DEFAULTS \
++ { \
++ INCLUDE_DEFAULTS_MUSL_GPP \
++ INCLUDE_DEFAULTS_MUSL_PREFIX \
++ INCLUDE_DEFAULTS_MUSL_CROSS \
++ INCLUDE_DEFAULTS_MUSL_TOOL \
++ INCLUDE_DEFAULTS_MUSL_NATIVE \
++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
++ { 0, 0, 0, 0, 0, 0 } \
++ }
++#endif
+diff -r 572f7b4d1c50 gcc/config/linux.opt
+--- a/gcc/config/linux.opt Sun Sep 08 22:58:18 2013 -0400
++++ b/gcc/config/linux.opt Mon Sep 09 12:48:34 2013 -0400
@@ -30,3 +30,7 @@
muclibc
Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
@@ -136,9 +256,9 @@ diff -r 2b29df135cf0 gcc/config/linux.opt
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
+Use musl C library
-diff -r 2b29df135cf0 gcc/ginclude/stddef.h
---- a/gcc/ginclude/stddef.h Fri Mar 29 16:41:11 2013 -0400
-+++ b/gcc/ginclude/stddef.h Fri Mar 29 16:41:14 2013 -0400
+diff -r 572f7b4d1c50 gcc/ginclude/stddef.h
+--- a/gcc/ginclude/stddef.h Sun Sep 08 22:58:18 2013 -0400
++++ b/gcc/ginclude/stddef.h Mon Sep 09 12:48:34 2013 -0400
@@ -181,6 +181,7 @@
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
@@ -180,6 +300,246 @@ diff -r 2b94537ce249 libgomp/config/posix/time.c
#include <unistd.h>
#if TIME_WITH_SYS_TIME
# HG changeset patch
+# Parent 94e435662aff38e86c9ca0dff4bbf451e0190b34
+Get rid of ever-broken fixincludes on musl.
+
+
+diff -r 94e435662aff -r e27957848dc8 fixincludes/mkfixinc.sh
+--- a/fixincludes/mkfixinc.sh Sat Jul 27 23:37:20 2013 -0400
++++ b/fixincludes/mkfixinc.sh Sat Jul 27 23:43:03 2013 -0400
+@@ -19,7 +19,8 @@
+ powerpc-*-eabi* | \
+ powerpc-*-rtems* | \
+ powerpcle-*-eabisim* | \
+- powerpcle-*-eabi* )
++ powerpcle-*-eabi* | \
++ *-musl* )
+ # IF there is no include fixing,
+ # THEN create a no-op fixer and exit
+ (echo "#! /bin/sh" ; echo "exit 0" ) > ${target}
+# HG changeset patch
+# Parent 8eb8b35e72f3987450f5050db45d6e4425084fb5
+libssp is provided in musl libc.
+
+diff -r 8eb8b35e72f3 gcc/configure
+--- a/gcc/configure Mon Aug 26 15:14:02 2013 -0400
++++ b/gcc/configure Mon Aug 26 15:46:55 2013 -0400
+@@ -26764,7 +26764,8 @@
+ gcc_cv_libc_provides_ssp=yes
+ fi
+ ;;
+- *-*-gnu*)
++ *-*-gnu* | \
++ *-linux-musl*)
+ # Avoid complicated tests (see
+ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ # simply assert that glibc does provide this, which is true for all
+diff -r 8eb8b35e72f3 gcc/configure.ac
+--- a/gcc/configure.ac Mon Aug 26 15:14:02 2013 -0400
++++ b/gcc/configure.ac Mon Aug 26 15:46:55 2013 -0400
+@@ -4747,7 +4747,8 @@
+ gcc_cv_libc_provides_ssp=yes
+ fi]
+ ;;
+- *-*-gnu*)
++ *-*-gnu* | \
++ *-linux-musl*)
+ # Avoid complicated tests (see
+ # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
+ # simply assert that glibc does provide this, which is true for all
+@@ -4817,6 +4818,9 @@
+ gcc_cv_target_dl_iterate_phdr=no
+ fi
+ ;;
++ *-linux-musl*)
++ gcc_cv_target_dl_iterate_phdr=yes
++ ;;
+ esac
+ GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
+ if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
+diff -r 8eb8b35e72f3 libssp/Makefile.am
+--- a/libssp/Makefile.am Mon Aug 26 15:14:02 2013 -0400
++++ b/libssp/Makefile.am Mon Aug 26 15:46:55 2013 -0400
+@@ -36,7 +36,11 @@
+
+ AM_CFLAGS = -Wall
+
++if LIBSSP_IN_LIBC
++toolexeclib_LTLIBRARIES = libssp_nonshared.la
++else
+ toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
++endif
+
+ target_noncanonical = @target_noncanonical@
+ libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
+diff -r 8eb8b35e72f3 libssp/Makefile.in
+--- a/libssp/Makefile.in Mon Aug 26 15:14:02 2013 -0400
++++ b/libssp/Makefile.in Mon Aug 26 15:46:55 2013 -0400
+@@ -93,12 +93,17 @@
+ libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@
++@LIBSSP_IN_LIBC_FALSE@am_libssp_la_rpath = -rpath $(toolexeclibdir)
+ am_libssp_nonshared_la_OBJECTS = libssp_nonshared_la-ssp-local.lo
+ libssp_nonshared_la_OBJECTS = $(am_libssp_nonshared_la_OBJECTS)
+ libssp_nonshared_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(libssp_nonshared_la_CFLAGS) $(CFLAGS) \
+ $(libssp_nonshared_la_LDFLAGS) $(LDFLAGS) -o $@
++@LIBSSP_IN_LIBC_FALSE@am_libssp_nonshared_la_rpath = -rpath \
++@LIBSSP_IN_LIBC_FALSE@ $(toolexeclibdir)
++@LIBSSP_IN_LIBC_TRUE@am_libssp_nonshared_la_rpath = -rpath \
++@LIBSSP_IN_LIBC_TRUE@ $(toolexeclibdir)
+ DEFAULT_INCLUDES = -I.@am__isrc@
+ depcomp = $(SHELL) $(top_srcdir)/../depcomp
+ am__depfiles_maybe = depfiles
+@@ -258,7 +263,8 @@
+ @LIBSSP_USE_SYMVER_GNU_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = $(srcdir)/ssp.map
+ @LIBSSP_USE_SYMVER_SUN_TRUE@@LIBSSP_USE_SYMVER_TRUE@version_dep = ssp.map-sun
+ AM_CFLAGS = -Wall
+-toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
++@LIBSSP_IN_LIBC_FALSE@toolexeclib_LTLIBRARIES = libssp.la libssp_nonshared.la
++@LIBSSP_IN_LIBC_TRUE@toolexeclib_LTLIBRARIES = libssp_nonshared.la
+ libsubincludedir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include
+ nobase_libsubinclude_HEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
+ libssp_la_SOURCES = \
+@@ -414,9 +420,9 @@
+ rm -f "$${dir}/so_locations"; \
+ done
+ libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES)
+- $(libssp_la_LINK) -rpath $(toolexeclibdir) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
++ $(libssp_la_LINK) $(am_libssp_la_rpath) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS)
+ libssp_nonshared.la: $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_DEPENDENCIES)
+- $(libssp_nonshared_la_LINK) -rpath $(toolexeclibdir) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
++ $(libssp_nonshared_la_LINK) $(am_libssp_nonshared_la_rpath) $(libssp_nonshared_la_OBJECTS) $(libssp_nonshared_la_LIBADD) $(LIBS)
+
+ mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+diff -r 8eb8b35e72f3 libssp/configure
+--- a/libssp/configure Mon Aug 26 15:14:02 2013 -0400
++++ b/libssp/configure Mon Aug 26 15:46:55 2013 -0400
+@@ -626,6 +626,8 @@
+ ssp_have_usable_vsnprintf
+ EGREP
+ GREP
++LIBSSP_IN_LIBC_FALSE
++LIBSSP_IN_LIBC_TRUE
+ LIBSSP_USE_SYMVER_SUN_FALSE
+ LIBSSP_USE_SYMVER_SUN_TRUE
+ LIBSSP_USE_SYMVER_GNU_FALSE
+@@ -735,6 +737,7 @@
+ enable_multilib
+ enable_dependency_tracking
+ enable_symvers
++enable_ssp_in_libc
+ enable_shared
+ enable_static
+ with_pic
+@@ -1374,6 +1377,7 @@
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --disable-symvers disable symbol versioning for libssp
++ --enable-ssp-in-libc do not build SSP, as it is in libc
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+@@ -4206,6 +4210,36 @@
+ fi
+
+
++# musl provides libssp in libc
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libssp is provided in libc" >&5
++$as_echo_n "checking whether libssp is provided in libc... " >&6; }
++# Check whether --enable-ssp_in_libc was given.
++if test "${enable_ssp_in_libc+set}" = set; then :
++ enableval=$enable_ssp_in_libc; ssp_in_libc=$enableval
++else
++ ssp_in_libc=check
++fi
++
++if test "x$ssp_in_libc" = "xcheck"; then
++ case "$host" in
++ *-musl*)
++ ssp_in_libc=yes
++ ;;
++
++ *)
++ ssp_in_libc=no
++ ;;
++ esac
++fi
++ if test "x$ssp_in_libc" = xyes; then
++ LIBSSP_IN_LIBC_TRUE=
++ LIBSSP_IN_LIBC_FALSE='#'
++else
++ LIBSSP_IN_LIBC_TRUE='#'
++ LIBSSP_IN_LIBC_FALSE=
++fi
++
++
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+ $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+@@ -10658,7 +10692,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10661 "configure"
++#line 10695 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -10764,7 +10798,7 @@
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+-#line 10767 "configure"
++#line 10801 "configure"
+ #include "confdefs.h"
+
+ #if HAVE_DLFCN_H
+@@ -11193,6 +11227,10 @@
+ as_fn_error "conditional \"LIBSSP_USE_SYMVER_SUN\" was never defined.
+ Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ fi
++if test -z "${LIBSSP_IN_LIBC_TRUE}" && test -z "${LIBSSP_IN_LIBC_FALSE}"; then
++ as_fn_error "conditional \"LIBSSP_IN_LIBC\" was never defined.
++Usually this means the macro was only invoked conditionally." "$LINENO" 5
++fi
+
+ : ${CONFIG_STATUS=./config.status}
+ ac_write_fail=0
+diff -r 8eb8b35e72f3 libssp/configure.ac
+--- a/libssp/configure.ac Mon Aug 26 15:14:02 2013 -0400
++++ b/libssp/configure.ac Mon Aug 26 15:46:55 2013 -0400
+@@ -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])
+
++# musl provides libssp in libc
++AC_MSG_CHECKING([whether libssp is provided in libc])
++AC_ARG_ENABLE(ssp_in_libc,
++AC_HELP_STRING([--enable-ssp-in-libc],
++ [do not build SSP, as it is in libc]),
++ssp_in_libc=$enableval,
++ssp_in_libc=check)
++if test "x$ssp_in_libc" = "xcheck"; then
++ case "$host" in
++ *-musl*)
++ ssp_in_libc=yes
++ ;;
++
++ *)
++ ssp_in_libc=no
++ ;;
++ esac
++fi
++AM_CONDITIONAL(LIBSSP_IN_LIBC, [test "x$ssp_in_libc" = xyes])
++
+ AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
+
+ if test x$gcc_no_link = xyes; then
+# HG changeset patch
# Parent f50bb54f331f73405131a30b4f353cfda1c70304
Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one.
@@ -331,17 +691,49 @@ diff -r 2ffe76b215fd gcc/config/rs6000/sysv4.h
{ "cpp_os_ads", CPP_OS_ADS_SPEC }, \
{ "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
-diff -r 2ffe76b215fd libgcc/config/rs6000/linux-unwind.h
---- a/libgcc/config/rs6000/linux-unwind.h Fri Mar 29 16:41:26 2013 -0400
-+++ b/libgcc/config/rs6000/linux-unwind.h Fri Mar 29 16:41:28 2013 -0400
-@@ -258,6 +258,7 @@
+diff -r 7cba4201a2ae libgcc/unwind-dw2-fde-dip.c
+--- a/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:53:05 2013 -0400
++++ b/libgcc/unwind-dw2-fde-dip.c Sat Jul 27 22:57:08 2013 -0400
+@@ -46,33 +46,13 @@
+ #include "unwind-compat.h"
+ #include "gthr.h"
- return _URC_NO_REASON;
- }
-+#endif
-
- #define MD_FROB_UPDATE_CONTEXT frob_update_context
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
+ # define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(__BIONIC__)
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(__FreeBSD__) && __FreeBSD__ >= 7
+-# define ElfW __ElfN
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(__OpenBSD__)
+-# define ElfW(type) Elf_##type
+-# define USE_PT_GNU_EH_FRAME
+-#endif
+-
+-#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+- && defined(TARGET_DL_ITERATE_PHDR) \
+- && defined(__sun__) && defined(__svr4__)
+-# define USE_PT_GNU_EH_FRAME
++# ifdef __OpenBSD__
++# define ElfW(type) Elf_##typ
++# elif defined(__FreeBSD__) && __FreeBSD__ >= 7
++# define ElfW __ElfN
++# endif
+ #endif
+ #if defined(USE_PT_GNU_EH_FRAME)
# HG changeset patch
# Parent 3ea10cd626cb7abdfd56d3fe8d2c9ed58a82797b
Support for i386-linux-musl and x86_64-linux-musl.
@@ -397,3 +789,4 @@ diff -r 3ea10cd626cb libitm/config/linux/x86/tls.h
+#endif
#endif // LIBITM_X86_TLS_H
+
diff --git a/main/gcc/gcc-ice-hack.patch b/main/gcc/gcc-ice-hack.patch
new file mode 100644
index 0000000000..f993235072
--- /dev/null
+++ b/main/gcc/gcc-ice-hack.patch
@@ -0,0 +1,304 @@
+# DP: Retry the build on an ice, save the calling options and preprocessed
+# DP: source when the ice is reproducible.
+
+2004-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c (execute): Don't free first string early, but at the end
+ of the function. Call retry_ice if compiler exited with
+ ICE_EXIT_CODE.
+ (retry_ice): New function.
+ * diagnostic.c (diagnostic_count_diagnostic,
+ diagnostic_action_after_output, error_recursion): Exit with
+ ICE_EXIT_CODE instead of FATAL_EXIT_CODE.
+
+Index: b/gcc/gcc.c
+===================================================================
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -249,6 +249,9 @@
+ #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
+ static const char *convert_filename (const char *, int, int);
+ #endif
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
++static void retry_ice (const char *prog, const char **argv);
++#endif
+
+ static const char *getenv_spec_function (int, const char **);
+ static const char *if_exists_spec_function (int, const char **);
+@@ -2771,7 +2774,7 @@
+ }
+ }
+
+- if (string != commands[i].prog)
++ if (i && string != commands[i].prog)
+ free (CONST_CAST (char *, string));
+ }
+
+@@ -2824,6 +2827,16 @@
+ else if (WIFEXITED (status)
+ && WEXITSTATUS (status) >= MIN_FATAL_STATUS)
+ {
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
++ /* For ICEs in cc1, cc1obj, cc1plus see if it is
++ reproducible or not. */
++ const char *p;
++ if (WEXITSTATUS (status) == ICE_EXIT_CODE
++ && i == 0
++ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
++ && ! strncmp (p + 1, "cc1", 3))
++ retry_ice (commands[0].prog, commands[0].argv);
++#endif
+ if (WEXITSTATUS (status) > greatest_status)
+ greatest_status = WEXITSTATUS (status);
+ ret_code = -1;
+@@ -2881,6 +2894,9 @@
+ }
+ }
+
++ if (commands[0].argv[0] != commands[0].prog)
++ free (CONST_CAST (char *, commands[0].argv[0]));
++
+ return ret_code;
+ }
+ }
+@@ -6034,6 +6050,227 @@
+ switches[switchnum].validated = true;
+ }
+
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
++#define RETRY_ICE_ATTEMPTS 2
++
++static void
++retry_ice (const char *prog, const char **argv)
++{
++ int nargs, out_arg = -1, quiet = 0, attempt;
++ int pid, retries, sleep_interval;
++ const char **new_argv;
++ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2];
++
++ if (gcc_input_filename == NULL || ! strcmp (gcc_input_filename, "-"))
++ return;
++
++ for (nargs = 0; argv[nargs] != NULL; ++nargs)
++ /* Only retry compiler ICEs, not preprocessor ones. */
++ if (! strcmp (argv[nargs], "-E"))
++ return;
++ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o')
++ {
++ if (out_arg == -1)
++ out_arg = nargs;
++ else
++ return;
++ }
++ /* If the compiler is going to output any time information,
++ it might varry between invocations. */
++ else if (! strcmp (argv[nargs], "-quiet"))
++ quiet = 1;
++ else if (! strcmp (argv[nargs], "-ftime-report"))
++ return;
++
++ if (out_arg == -1 || !quiet)
++ return;
++
++ memset (temp_filenames, '\0', sizeof (temp_filenames));
++ new_argv = XALLOCAVEC (const char *, nargs + 3);
++ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *));
++ new_argv[nargs++] = "-frandom-seed=0";
++ new_argv[nargs] = NULL;
++ if (new_argv[out_arg][2] == '\0')
++ new_argv[out_arg + 1] = "-";
++ else
++ new_argv[out_arg] = "-o-";
++
++ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt)
++ {
++ int fd = -1;
++ int status;
++
++ temp_filenames[attempt * 2] = make_temp_file (".out");
++ temp_filenames[attempt * 2 + 1] = make_temp_file (".err");
++
++ if (attempt == RETRY_ICE_ATTEMPTS)
++ {
++ int i;
++ int fd1, fd2;
++ struct stat st1, st2;
++ size_t n, len;
++ char *buf;
++
++ buf = XNEWVEC (char, 8192);
++
++ for (i = 0; i < 2; ++i)
++ {
++ fd1 = open (temp_filenames[i], O_RDONLY);
++ fd2 = open (temp_filenames[2 + i], O_RDONLY);
++
++ if (fd1 < 0 || fd2 < 0)
++ {
++ i = -1;
++ close (fd1);
++ close (fd2);
++ break;
++ }
++
++ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0)
++ {
++ i = -1;
++ close (fd1);
++ close (fd2);
++ break;
++ }
++
++ if (st1.st_size != st2.st_size)
++ {
++ close (fd1);
++ close (fd2);
++ break;
++ }
++
++ len = 0;
++ for (n = st1.st_size; n; n -= len)
++ {
++ len = n;
++ if (len > 4096)
++ len = 4096;
++
++ if (read (fd1, buf, len) != (int) len
++ || read (fd2, buf + 4096, len) != (int) len)
++ {
++ i = -1;
++ break;
++ }
++
++ if (memcmp (buf, buf + 4096, len) != 0)
++ break;
++ }
++
++ close (fd1);
++ close (fd2);
++
++ if (n)
++ break;
++ }
++
++ free (buf);
++ if (i == -1)
++ break;
++
++ if (i != 2)
++ {
++ fnotice (stderr, "The bug is not reproducible, so it is"
++ " likely a hardware or OS problem.\n");
++ break;
++ }
++
++ fd = open (temp_filenames[attempt * 2], O_RDWR);
++ if (fd < 0)
++ break;
++ write (fd, "//", 2);
++ for (i = 0; i < nargs; i++)
++ {
++ write (fd, " ", 1);
++ write (fd, new_argv[i], strlen (new_argv[i]));
++ }
++ write (fd, "\n", 1);
++ new_argv[nargs] = "-E";
++ new_argv[nargs + 1] = NULL;
++ }
++
++ /* Fork a subprocess; wait and retry if it fails. */
++ sleep_interval = 1;
++ pid = -1;
++ for (retries = 0; retries < 4; retries++)
++ {
++ pid = fork ();
++ if (pid >= 0)
++ break;
++ sleep (sleep_interval);
++ sleep_interval *= 2;
++ }
++
++ if (pid < 0)
++ break;
++ else if (pid == 0)
++ {
++ if (attempt != RETRY_ICE_ATTEMPTS)
++ fd = open (temp_filenames[attempt * 2], O_RDWR);
++ if (fd < 0)
++ exit (-1);
++ if (fd != 1)
++ {
++ close (1);
++ dup (fd);
++ close (fd);
++ }
++
++ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR);
++ if (fd < 0)
++ exit (-1);
++ if (fd != 2)
++ {
++ close (2);
++ dup (fd);
++ close (fd);
++ }
++
++ if (prog == new_argv[0])
++ execvp (prog, CONST_CAST2 (char *const *, const char **, new_argv));
++ else
++ execv (new_argv[0], CONST_CAST2 (char *const *, const char **, new_argv));
++ exit (-1);
++ }
++
++ if (waitpid (pid, &status, 0) < 0)
++ break;
++
++ if (attempt < RETRY_ICE_ATTEMPTS
++ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE))
++ {
++ fnotice (stderr, "The bug is not reproducible, so it is"
++ " likely a hardware or OS problem.\n");
++ break;
++ }
++ else if (attempt == RETRY_ICE_ATTEMPTS)
++ {
++ close (fd);
++ if (WIFEXITED (status)
++ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE)
++ {
++ fnotice (stderr, "Preprocessed source stored into %s file,"
++ " please attach this to your bugreport.\n",
++ temp_filenames[attempt * 2]);
++ /* Make sure it is not deleted. */
++ free (temp_filenames[attempt * 2]);
++ temp_filenames[attempt * 2] = NULL;
++ break;
++ }
++ }
++ }
++
++ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++)
++ if (temp_filenames[attempt])
++ {
++ unlink (temp_filenames[attempt]);
++ free (temp_filenames[attempt]);
++ }
++}
++#endif
++
+ /* Search for a file named NAME trying various prefixes including the
+ user's -B prefix and some standard ones.
+ Return the absolute file name found. If nothing is found, return NAME. */
+Index: b/gcc/diagnostic.c
+===================================================================
+--- a/gcc/diagnostic.c
++++ b/gcc/diagnostic.c
+@@ -455,7 +455,7 @@
+ real_abort ();
+ diagnostic_finish (context);
+ fnotice (stderr, "compilation terminated.\n");
+- exit (FATAL_EXIT_CODE);
++ exit (ICE_EXIT_CODE);
+
+ default:
+ gcc_unreachable ();
diff --git a/main/gcc/pr49423.patch b/main/gcc/pr49423.patch
new file mode 100644
index 0000000000..b399daf2de
--- /dev/null
+++ b/main/gcc/pr49423.patch
@@ -0,0 +1,103 @@
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49423
+http://gcc.gnu.org/ml/gcc-patches/2013-06/msg01191.html
+
+ChangeLog
+
+ gcc/
+ * config/arm/arm.c (arm_legitimate_address_outer_p)
+ (thumb2_legitimate_address_p): Don't allow symbol refs with mode
+ size smaller than a word.
+ * config/arm/arm.md (thumb1_zero_extendqisi2, *arm_extendhisi2)
+ (*arm_extendhisi2_v6, *arm_extendqihi_insn, *arm_extendqisi)
+ (*arm_extendqisi_v6): Remove pool_range/neg_pool_range attributes.
+
+Index: gcc/config/arm/arm.c
+===================================================================
+--- a/gcc/config/arm/arm.c (revision 200204)
++++ b/gcc/config/arm/arm.c (working copy)
+@@ -5947,6 +5947,7 @@ arm_legitimate_address_outer_p (enum mac
+ #endif
+
+ else if (GET_MODE_CLASS (mode) != MODE_FLOAT
++ && GET_MODE_SIZE (mode) >= UNITS_PER_WORD
+ && code == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (x)
+ && ! (flag_pic
+@@ -6022,6 +6023,7 @@ thumb2_legitimate_address_p (enum machin
+ }
+
+ else if (GET_MODE_CLASS (mode) != MODE_FLOAT
++ && GET_MODE_SIZE (mode) >= UNITS_PER_WORD
+ && code == SYMBOL_REF
+ && CONSTANT_POOL_ADDRESS_P (x)
+ && ! (flag_pic
+Index: gcc/config/arm/arm.md
+===================================================================
+--- a/gcc/config/arm/arm.md (revision 200204)
++++ b/gcc/config/arm/arm.md (working copy)
+@@ -5432,8 +5432,7 @@
+ #
+ ldrb\\t%0, %1"
+ [(set_attr "length" "4,2")
+- (set_attr "type" "alu_shift,load_byte")
+- (set_attr "pool_range" "*,32")]
++ (set_attr "type" "alu_shift,load_byte")]
+ )
+
+ (define_insn "*thumb1_zero_extendqisi2_v6"
+@@ -5700,9 +5699,7 @@
+ ldr%(sh%)\\t%0, %1"
+ [(set_attr "length" "8,4")
+ (set_attr "type" "alu_shift,load_byte")
+- (set_attr "predicable" "yes")
+- (set_attr "pool_range" "*,256")
+- (set_attr "neg_pool_range" "*,244")]
++ (set_attr "predicable" "yes")]
+ )
+
+ ;; ??? Check Thumb-2 pool range
+@@ -5714,9 +5711,7 @@
+ sxth%?\\t%0, %1
+ ldr%(sh%)\\t%0, %1"
+ [(set_attr "type" "simple_alu_shift,load_byte")
+- (set_attr "predicable" "yes")
+- (set_attr "pool_range" "*,256")
+- (set_attr "neg_pool_range" "*,244")]
++ (set_attr "predicable" "yes")]
+ )
+
+ (define_insn "*arm_extendhisi2addsi"
+@@ -5758,9 +5753,7 @@
+ "TARGET_ARM && arm_arch4"
+ "ldr%(sb%)\\t%0, %1"
+ [(set_attr "type" "load_byte")
+- (set_attr "predicable" "yes")
+- (set_attr "pool_range" "256")
+- (set_attr "neg_pool_range" "244")]
++ (set_attr "predicable" "yes")]
+ )
+
+ (define_expand "extendqisi2"
+@@ -5800,9 +5793,7 @@
+ ldr%(sb%)\\t%0, %1"
+ [(set_attr "length" "8,4")
+ (set_attr "type" "alu_shift,load_byte")
+- (set_attr "predicable" "yes")
+- (set_attr "pool_range" "*,256")
+- (set_attr "neg_pool_range" "*,244")]
++ (set_attr "predicable" "yes")]
+ )
+
+ (define_insn "*arm_extendqisi_v6"
+@@ -5814,9 +5805,7 @@
+ sxtb%?\\t%0, %1
+ ldr%(sb%)\\t%0, %1"
+ [(set_attr "type" "simple_alu_shift,load_byte")
+- (set_attr "predicable" "yes")
+- (set_attr "pool_range" "*,256")
+- (set_attr "neg_pool_range" "*,244")]
++ (set_attr "predicable" "yes")]
+ )
+
+ (define_insn "*arm_extendqisi2addsi"
+
diff --git a/main/gcc/pr57748.patch b/main/gcc/pr57748.patch
new file mode 100644
index 0000000000..23a87ba705
--- /dev/null
+++ b/main/gcc/pr57748.patch
@@ -0,0 +1,295 @@
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57748
+(comment #36, attachment 30782)
+
+--- a/gcc/expr.c 2013-08-06 00:09:45.000000000 +0200
++++ b/gcc/expr.c 2013-09-10 08:23:09.570951685 +0200
+@@ -4691,8 +4691,6 @@ expand_assignment (tree to, tree from, b
+ int unsignedp;
+ int volatilep = 0;
+ tree tem;
+- bool misalignp;
+- rtx mem = NULL_RTX;
+
+ push_temp_slots ();
+ tem = get_inner_reference (to, &bitsize, &bitpos, &offset, &mode1,
+@@ -4702,40 +4700,7 @@ expand_assignment (tree to, tree from, b
+ && DECL_BIT_FIELD_TYPE (TREE_OPERAND (to, 1)))
+ get_bit_range (&bitregion_start, &bitregion_end, to, &bitpos, &offset);
+
+- /* If we are going to use store_bit_field and extract_bit_field,
+- make sure to_rtx will be safe for multiple use. */
+- mode = TYPE_MODE (TREE_TYPE (tem));
+- if (TREE_CODE (tem) == MEM_REF
+- && mode != BLKmode
+- && ((align = get_object_alignment (tem))
+- < GET_MODE_ALIGNMENT (mode))
+- && ((icode = optab_handler (movmisalign_optab, mode))
+- != CODE_FOR_nothing))
+- {
+- struct expand_operand ops[2];
+-
+- misalignp = true;
+- to_rtx = gen_reg_rtx (mode);
+- mem = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
+-
+- /* If the misaligned store doesn't overwrite all bits, perform
+- rmw cycle on MEM. */
+- if (bitsize != GET_MODE_BITSIZE (mode))
+- {
+- create_input_operand (&ops[0], to_rtx, mode);
+- create_fixed_operand (&ops[1], mem);
+- /* The movmisalign<mode> pattern cannot fail, else the assignment
+- would silently be omitted. */
+- expand_insn (icode, 2, ops);
+-
+- mem = copy_rtx (mem);
+- }
+- }
+- else
+- {
+- misalignp = false;
+- to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
+- }
++ to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
+
+ /* If the bitfield is volatile, we want to access it in the
+ field's mode, not the computed mode.
+@@ -4773,6 +4738,8 @@ expand_assignment (tree to, tree from, b
+ if (MEM_P (to_rtx)
+ && GET_MODE (to_rtx) == BLKmode
+ && GET_MODE (XEXP (to_rtx, 0)) != VOIDmode
++ && bitregion_start == 0
++ && bitregion_end == 0
+ && bitsize > 0
+ && (bitpos % bitsize) == 0
+ && (bitsize % GET_MODE_ALIGNMENT (mode1)) == 0
+@@ -4874,17 +4841,6 @@ expand_assignment (tree to, tree from, b
+ get_alias_set (to), nontemporal);
+ }
+
+- if (misalignp)
+- {
+- struct expand_operand ops[2];
+-
+- create_fixed_operand (&ops[0], mem);
+- create_input_operand (&ops[1], to_rtx, mode);
+- /* The movmisalign<mode> pattern cannot fail, else the assignment
+- would silently be omitted. */
+- expand_insn (icode, 2, ops);
+- }
+-
+ if (result)
+ preserve_temp_slots (result);
+ pop_temp_slots ();
+@@ -9905,7 +9861,7 @@ expand_expr_real_1 (tree exp, rtx target
+ && modifier != EXPAND_STACK_PARM
+ ? target : NULL_RTX),
+ VOIDmode,
+- modifier == EXPAND_SUM ? EXPAND_NORMAL : modifier);
++ EXPAND_MEMORY);
+
+ /* If the bitfield is volatile, we want to access it in the
+ field's mode, not the computed mode.
+--- a/gcc/testsuite/gcc.dg/torture/pr57748-1.c 1970-01-01 01:00:00.000000000 +0100
++++ b/gcc/testsuite/gcc.dg/torture/pr57748-1.c 2013-09-06 08:38:03.718686940 +0200
+@@ -0,0 +1,49 @@
++/* PR middle-end/57748 */
++/* { dg-do run } */
++/* ICE in expand_assignment:
++ misalignp == true, !MEM_P (to_rtx), offset != 0,
++ => gcc_assert (TREE_CODE (offset) == INTEGER_CST) */
++
++#include <stdlib.h>
++
++extern void abort (void);
++
++typedef long long V
++ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
++
++typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
++
++struct __attribute__((packed)) T { char c; P s; };
++
++void __attribute__((noinline, noclone))
++check (struct T *t)
++{
++ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
++ abort ();
++}
++
++int __attribute__((noinline, noclone))
++get_i (void)
++{
++ return 0;
++}
++
++void __attribute__((noinline, noclone))
++foo (P *p)
++{
++ V a = { 3, 4 };
++ int i = get_i ();
++ p->b[i] = a;
++}
++
++int
++main ()
++{
++ struct T *t = (struct T *) calloc (128, 1);
++
++ foo (&t->s);
++ check (t);
++
++ free (t);
++ return 0;
++}
+--- a/gcc/testsuite/gcc.dg/torture/pr57748-2.c 1970-01-01 01:00:00.000000000 +0100
++++ b/gcc/testsuite/gcc.dg/torture/pr57748-2.c 2013-09-06 08:38:03.718686940 +0200
+@@ -0,0 +1,43 @@
++/* PR middle-end/57748 */
++/* { dg-do run } */
++/* wrong code in expand_assignment:
++ misalignp == true, !MEM_P (to_rtx),
++ offset == 0, bitpos >= GET_MODE_PRECISION,
++ => result = NULL. */
++
++#include <stdlib.h>
++
++extern void abort (void);
++
++typedef long long V
++ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
++
++typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
++
++struct __attribute__((packed)) T { char c; P s; };
++
++void __attribute__((noinline, noclone))
++check (struct T *t)
++{
++ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
++ abort ();
++}
++
++void __attribute__((noinline, noclone))
++foo (P *p)
++{
++ V a = { 3, 4 };
++ p->b[0] = a;
++}
++
++int
++main ()
++{
++ struct T *t = (struct T *) calloc (128, 1);
++
++ foo (&t->s);
++ check (t);
++
++ free (t);
++ return 0;
++}
+--- a/gcc/testsuite/gcc.dg/torture/pr57748-3.c 1970-01-01 01:00:00.000000000 +0100
++++ b/gcc/testsuite/gcc.dg/torture/pr57748-3.c 2013-09-09 09:54:28.937891452 +0200
+@@ -0,0 +1,49 @@
++/* PR middle-end/57748 */
++/* { dg-do run } */
++/* { dg-final { scan-assembler-not "movdqu" } } */
++/* data store race in expand_assignment:
++ misalignp == true, !MEM_P (to_rtx),
++ offset == 0, bitsize < GET_MODE_BITSIZE,
++ => rmw cycle on MEM. */
++
++#include <stdlib.h>
++
++typedef long long V
++ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
++
++union x
++{
++ long long a;
++ float b;
++} __attribute__((aligned (1)));
++
++struct s
++{
++ union x xx[0];
++ V x;
++} __attribute__((packed));
++
++void __attribute__((noinline, noclone))
++check (union x *xx)
++{
++ if (xx[0].b != 3.14F || xx[1].a != 0x123456789ABCDEF)
++ abort ();
++}
++
++void __attribute__((noinline, noclone))
++foo (struct s * x)
++{
++ x->xx[0].a = -1;
++ x->xx[0].b = 3.14F;
++ x->x[1] = 0x123456789ABCDEF;
++}
++
++struct s ss;
++
++int
++main ()
++{
++ foo (&ss);
++ check (ss.xx);
++ return 0;
++}
+--- a/gcc/testsuite/gcc.dg/torture/pr57748-4.c 1970-01-01 01:00:00.000000000 +0100
++++ b/gcc/testsuite/gcc.dg/torture/pr57748-4.c 2013-09-10 08:36:37.182962269 +0200
+@@ -0,0 +1,50 @@
++/* PR middle-end/57748 */
++/* { dg-do run } */
++/* { dg-final { scan-assembler-not "movdqu" } } */
++/* wrong code in expand_expr_real_1:
++ read whole structure instead of only one member. */
++
++#include <stdlib.h>
++
++typedef long long V
++ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
++
++union x
++{
++ long long a;
++ float b;
++} __attribute__((aligned (1)));
++
++struct s
++{
++ union x xx[0];
++ V x;
++} __attribute__((packed));
++
++void __attribute__((noinline, noclone))
++check (struct s *x)
++{
++ if (x->xx[0].b != 3.14F || x->xx[1].a != 0x123456789ABCDEF)
++ abort ();
++ if (x->xx[2].b != 3.14F || x->xx[3].a != 0x123456789ABCDEF)
++ abort ();
++}
++
++void __attribute__((noinline, noclone))
++foo (struct s * x)
++{
++ x->xx[0].a = -1;
++ x->xx[0].b = 3.14F;
++ x->x[1] = 0x123456789ABCDEF;
++}
++
++struct s ss[2];
++
++int
++main ()
++{
++ foo (ss);
++ foo (ss+1);
++ check (ss);
++ return 0;
++}