summaryrefslogtreecommitdiff
path: root/user/openjdk7
diff options
context:
space:
mode:
Diffstat (limited to 'user/openjdk7')
-rw-r--r--user/openjdk7/APKBUILD593
-rw-r--r--user/openjdk7/gcc-001_all_default-ssp-strong.patch215
-rw-r--r--user/openjdk7/gcc-002_all_default-relro.patch33
-rw-r--r--user/openjdk7/gcc-003_all_default-fortify-source.patch40
-rw-r--r--user/openjdk7/gcc-005_all_default-as-needed.patch241
-rw-r--r--user/openjdk7/gcc-011_all_default-warn-format-security.patch43
-rw-r--r--user/openjdk7/gcc-012_all_default-warn-trampolines.patch25
-rw-r--r--user/openjdk7/gcc-020_all_msgfmt-libstdc++-link.patch39
-rw-r--r--user/openjdk7/gcc-050_all_libiberty-asprintf.patch18
-rw-r--r--user/openjdk7/gcc-051_all_libiberty-pic.patch10
-rw-r--r--user/openjdk7/gcc-053_all_libitm-no-fortify-source.patch27
-rw-r--r--user/openjdk7/gcc-067_all_gcc-poison-system-directories.patch194
-rw-r--r--user/openjdk7/gcc-090_all_pr55930-dependency-tracking.patch18
-rw-r--r--user/openjdk7/gcc-201-cilkrts.patch59
-rw-r--r--user/openjdk7/gcc-203-libgcc_s.patch56
-rw-r--r--user/openjdk7/gcc-204-linux_libc_has_function.patch25
-rw-r--r--user/openjdk7/gcc-205-nopie.patch75
-rw-r--r--user/openjdk7/gcc-207-static-pie.patch40
-rw-r--r--user/openjdk7/gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch32
-rw-r--r--user/openjdk7/gcc-310-build-gcj-s390x.patch28
-rw-r--r--user/openjdk7/gcc-320-libffi-gnulinux.patch13
-rw-r--r--user/openjdk7/gcc-330-gccgo-link-to-ucontext.patch11
-rw-r--r--user/openjdk7/gcc-331-gccgo-use-real-off_t-type.patch30
-rw-r--r--user/openjdk7/gcc-332-gccgo-remove-ustat.patch190
-rw-r--r--user/openjdk7/gcc-ada-aarch64-multiarch.patch16
-rw-r--r--user/openjdk7/gcc-ada-fixes.patch35
-rw-r--r--user/openjdk7/gcc-ada-musl.patch137
-rw-r--r--user/openjdk7/gcc-ada-shared.patch30
-rw-r--r--user/openjdk7/gcc-add-classic_table-support.patch152
-rw-r--r--user/openjdk7/gcc-boehm-gc-musl.patch62
-rw-r--r--user/openjdk7/gcc-fix-cxxflags-passing.patch10
-rw-r--r--user/openjdk7/gcc-fix-gcj-iconv-musl.patch120
-rw-r--r--user/openjdk7/gcc-fix-gcj-musl.patch49
-rw-r--r--user/openjdk7/gcc-fix-gcj-stdgnu14-link.patch35
-rw-r--r--user/openjdk7/gcc-fix-rs6000-pie.patch59
-rw-r--r--user/openjdk7/gcc-gcc-4.8-build-args.patch41
-rw-r--r--user/openjdk7/gcc-gcc-4.9-musl-fortify.patch11
-rw-r--r--user/openjdk7/gcc-gcc-5.4.0-locale.patch13
-rw-r--r--user/openjdk7/gcc-gcc-6.1-musl-libssp.patch20
-rw-r--r--user/openjdk7/gcc-gcc-pure64.patch89
-rw-r--r--user/openjdk7/gcc-isl-fix.patch15
-rw-r--r--user/openjdk7/gcc-libgcc-always-build-gcceh.a.patch39
-rw-r--r--user/openjdk7/gcc-libgo-musl-1.2.3.patch13
-rw-r--r--user/openjdk7/gcc-lra-pentium.patch48
-rw-r--r--user/openjdk7/icedtea-cpio.patch11
-rw-r--r--user/openjdk7/icedtea-hotspot-musl-ppc.patch169
-rw-r--r--user/openjdk7/icedtea-hotspot-musl.patch79
-rw-r--r--user/openjdk7/icedtea-hotspot-noagent-musl.patch54
-rw-r--r--user/openjdk7/icedtea-hotspot-uclibc-fixes.patch93
-rw-r--r--user/openjdk7/icedtea-jdk-execinfo.patch40
-rw-r--r--user/openjdk7/icedtea-jdk-fix-build.patch56
-rw-r--r--user/openjdk7/icedtea-jdk-fix-ipv6-init.patch42
-rw-r--r--user/openjdk7/icedtea-jdk-musl.patch116
-rw-r--r--user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch84
-rw-r--r--user/openjdk7/icedtea-jdk-no-soname.patch12
-rw-r--r--user/openjdk7/icedtea-newer-freetype.patch21
-rw-r--r--user/openjdk7/icedtea-remove-gawk.patch22
-rw-r--r--user/openjdk7/icedtea-tar.patch22
-rw-r--r--user/openjdk7/icedtea-xattr.patch11
-rw-r--r--user/openjdk7/project-autoconf-2xx.patch30
-rw-r--r--user/openjdk7/remove-gawk.patch125
-rw-r--r--user/openjdk7/xattr.patch11
62 files changed, 4047 insertions, 0 deletions
diff --git a/user/openjdk7/APKBUILD b/user/openjdk7/APKBUILD
new file mode 100644
index 000000000..3fa9af806
--- /dev/null
+++ b/user/openjdk7/APKBUILD
@@ -0,0 +1,593 @@
+# Contributor: Timo Teras <timo.teras@iki.fi>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: Zach van Rijn <me@zv.io>
+pkgname=openjdk7
+# pkgver is <JDK version>.<JDK update>
+pkgver=7.201.$_icedteaver
+# Check https://icedtea.classpath.org/download/source/ when updating
+_icedteaver=2.6.16
+pkgrel=0
+pkgdesc="OpenJDK 7 via IcedTea"
+url="https://icedtea.classpath.org/"
+arch="all"
+license="GPL-2.0-only WITH Classpath-exception-2.0"
+depends="$pkgname-jre java-cacerts"
+options="sover-namecheck"
+
+# GCJ is required to bootstrap from source; it was removed from GCC 7.
+# GCC 6 is not packaged or installed.
+_gccver=6.4.0
+_gccmaj=${_gccver%%.*}
+_ecjver=4.9
+makedepends_gcc="bison flex linux-headers texinfo zip
+ gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev libucontext-dev
+ libart-lgpl-dev
+ "
+
+makedepends="bash findutils zip file mawk util-linux libxslt
+ autoconf automake linux-headers coreutils cmd:which
+ ca-certificates
+ nss-dev cups-dev libjpeg-turbo-dev giflib-dev libpng-dev libxt-dev
+ lcms2-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
+ libxrender-dev alsa-lib-dev freetype-dev fontconfig-dev
+ gtk+2.0-dev krb5-dev attr-dev pcsc-lite-dev lksctp-tools-dev
+ libxcomposite-dev nss-static cmd:wget
+ unzip
+
+ $makedepends_gcc
+ "
+
+install=""
+
+# upstream binary versions
+RHINO_VER=1.7.7.2
+_RHINO_VER=1_7_7_2
+ANT_VER=1.9.11
+
+case $CARCH in
+x86|pmmx) _jarch=i386;;
+x86_64) _jarch=amd64;;
+aarch64) _jarch=aarch64;;
+arm*) _jarch=arm
+ # openjdk has quite a bit of arm assembly producing textrels
+ # and it's non trivial to fix. allow it for now.
+ options="$options textrels";;
+s390x) _jarch=s390x;;
+ppc64le) _jarch=ppc64le;;
+ppc64) _jarch=ppc64; ;;
+ppc) _jarch=ppc;;
+esac
+
+INSTALL_BASE=/usr/lib/jvm/java-1.7-openjdk
+_jrelib="$INSTALL_BASE/jre/lib/$_jarch"
+_jvmdir=/usr/lib/jvm/java-1.5-gcj
+
+# exclude xawt from ldpath to avoid duplicate provides for libmawt.so
+# (also in headless). in future this should be a virtual provides.
+ldpath="$_jrelib:$_jrelib/native_threads:$_jrelib/headless:$_jrelib/server:$_jrelib/jli"
+sonameprefix="$pkgname:"
+
+provides="$pkgname-bootstrap=$pkgver-r$pkgrel"
+
+subpackages="$pkgname-jre-lib:jrelib:noarch $pkgname-jre $pkgname-jre-base:jrebase
+ $pkgname-doc:doc"
+
+BOOTSTRAP_JAVA_HOME="$_jvmdir"
+_bootstrap_java_home="$srcdir/gcc-$_gccver/usr/share/java"
+
+_dropsver=$_icedteaver
+_dropsurl=https://icedtea.classpath.org/download/drops/icedtea7/$_dropsver
+
+source_gcc="
+ https://ftp.gnu.org/gnu/gcc/gcc-$_gccver/gcc-$_gccver.tar.xz
+ https://sourceware.org/pub/java/ecj-$_ecjver.jar
+
+ gcc-001_all_default-ssp-strong.patch
+ gcc-002_all_default-relro.patch
+ gcc-003_all_default-fortify-source.patch
+ gcc-005_all_default-as-needed.patch
+ gcc-011_all_default-warn-format-security.patch
+ gcc-012_all_default-warn-trampolines.patch
+ gcc-020_all_msgfmt-libstdc++-link.patch
+ gcc-050_all_libiberty-asprintf.patch
+ gcc-051_all_libiberty-pic.patch
+ gcc-053_all_libitm-no-fortify-source.patch
+ gcc-067_all_gcc-poison-system-directories.patch
+ gcc-090_all_pr55930-dependency-tracking.patch
+
+ gcc-201-cilkrts.patch
+ gcc-203-libgcc_s.patch
+ gcc-204-linux_libc_has_function.patch
+ gcc-205-nopie.patch
+ gcc-207-static-pie.patch
+
+ gcc-libgcc-always-build-gcceh.a.patch
+ gcc-gcc-4.9-musl-fortify.patch
+ gcc-gcc-6.1-musl-libssp.patch
+ gcc-boehm-gc-musl.patch
+ gcc-gcc-pure64.patch
+ gcc-fix-gcj-stdgnu14-link.patch
+ gcc-fix-gcj-musl.patch
+ gcc-fix-gcj-iconv-musl.patch
+
+ gcc-gcc-4.8-build-args.patch
+ gcc-fix-cxxflags-passing.patch
+ gcc-ada-fixes.patch
+ gcc-ada-shared.patch
+ gcc-ada-musl.patch
+ gcc-ada-aarch64-multiarch.patch
+
+ gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch
+ gcc-310-build-gcj-s390x.patch
+ gcc-320-libffi-gnulinux.patch
+ gcc-330-gccgo-link-to-ucontext.patch
+ gcc-331-gccgo-use-real-off_t-type.patch
+ gcc-332-gccgo-remove-ustat.patch
+ gcc-libgo-musl-1.2.3.patch
+
+ gcc-fix-rs6000-pie.patch
+ gcc-add-classic_table-support.patch
+ gcc-lra-pentium.patch
+
+ gcc-gcc-5.4.0-locale.patch
+ gcc-isl-fix.patch
+ "
+
+source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.gz
+ openjdk-$_dropsver.tar.bz2::$_dropsurl/openjdk.tar.bz2
+ corba-$_dropsver.tar.bz2::$_dropsurl/corba.tar.bz2
+ jaxp-$_dropsver.tar.bz2::$_dropsurl/jaxp.tar.bz2
+ jaxws-$_dropsver.tar.bz2::$_dropsurl/jaxws.tar.bz2
+ jdk-$_dropsver.tar.bz2::$_dropsurl/jdk.tar.bz2
+ langtools-$_dropsver.tar.bz2::$_dropsurl/langtools.tar.bz2
+ hotspot-$_dropsver.tar.bz2::$_dropsurl/hotspot.tar.bz2
+ https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
+ https://github.com/mozilla/rhino/releases/download/Rhino${_RHINO_VER}_Release/rhino-$RHINO_VER.zip
+
+ icedtea-hotspot-musl.patch
+ icedtea-hotspot-musl-ppc.patch
+ icedtea-hotspot-noagent-musl.patch
+ icedtea-hotspot-uclibc-fixes.patch
+ icedtea-jdk-fix-build.patch
+ icedtea-jdk-execinfo.patch
+ icedtea-jdk-fix-ipv6-init.patch
+ icedtea-jdk-musl.patch
+ icedtea-jdk-no-soname.patch
+ icedtea-cpio.patch
+ icedtea-tar.patch
+ icedtea-remove-gawk.patch
+ icedtea-xattr.patch
+ icedtea-newer-freetype.patch
+
+ remove-gawk.patch
+ xattr.patch
+ project-autoconf-2xx.patch
+
+ $source_gcc
+ "
+
+builddir="$srcdir/icedtea-$_icedteaver"
+
+srcdir_gcc="${srcdir}_gcc"
+
+#---------------------------------------------------------------
+# gcc
+
+STRIP_FOR_TARGET=${CROSS_COMPILE}strip
+
+: ${LANG_CXX:=true}
+: ${LANG_OBJC:=false}
+: ${LANG_JAVA:=true}
+: ${LANG_GO:=false}
+: ${LANG_FORTRAN:=false}
+: ${LANG_ADA:=false}
+
+LIBGCC=true
+LIBATOMIC=true
+LIBITM=true
+
+_languages=java
+#---------------------------------------------------------------
+
+clean() {
+ rm -fr "$srcdir"
+ rm -fr "$srcdir_gcc"
+}
+
+unpack_gcc() {
+ mkdir -p "$srcdir_gcc"
+ tar -C "$srcdir_gcc" -Jxf gcc-$_gccver.tar.xz
+}
+
+unpack() {
+ if [ -z "$force" ]; then
+ verify
+ initdcheck
+ fi
+ mkdir -p "$srcdir"
+ msg "Unpacking sources..."
+ tar -C "$srcdir" -zxf icedtea-$_icedteaver.tar.gz
+ tar -C "$srcdir" -zxf apache-ant-$ANT_VER-bin.tar.gz
+ unzip -o -q "rhino-$RHINO_VER.zip" -d "$srcdir"
+
+ unpack_gcc
+}
+
+# we build out-of-tree
+_gccdir="$srcdir_gcc"/gcc-$_gccver
+_gcclibdir=/usr/lib/gcc/${CTARGET}/$_gccver
+_gcclibexec=/usr/libexec/gcc/${CTARGET}/$_gccver
+
+prepare_gcc () {
+ cd "$_gccdir"
+
+ _err=
+ for i in $source_gcc; do
+ case "$i" in
+ *.patch)
+ msg "Applying $i"
+ patch -p1 -F3 -i "$srcdir"/$i || _err="$_err $i"
+ ;;
+ esac
+ done
+
+ if [ -n "$_err" ]; then
+ error "The following patches failed:"
+ for i in $_err; do
+ echo " $i"
+ done
+ return 1
+ fi
+
+ # see http://gcc.gnu.org/ml/java/2008-04/msg00027.html
+ mv "$srcdir"/ecj-*.jar ecj.jar
+
+ echo ${_gccver} > gcc/BASE-VER
+ echo "UNSUPPORTED=1" > libcilkrts/configure.tgt
+ rm libgo/go/syscall/libcall_linux_ustat.go
+}
+
+prepare() {
+ cd "$builddir"
+
+ # Busybox sha256 does not support longopts
+ sed -e "s/--check/-c/g" -i Makefile.am
+
+ for patch in $source; do
+ case $patch in
+ icedtea-*.patch)
+ cp ../$patch patches
+ ;;
+ gcc-*.patch)
+ continue; # defer gcc patches to end of routine
+ ;;
+ *.patch)
+ msg "Applying patch $patch"
+ patch -p1 -i "$srcdir"/$patch
+ ;;
+ esac
+ done
+
+ ./autogen.sh
+
+ prepare_gcc
+}
+
+build_gcc() {
+ mkdir "$_gccdir"/build
+ cd "$_gccdir"/build
+
+ local _arch_configure=
+ local _libc_configure=
+ local _cross_configure=
+ local _bootstrap_configure=
+ local _hash_style=gnu
+ local _symvers=
+
+ case "$CTARGET" in
+ aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64 --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419";;
+ armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --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";;
+ armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";;
+ m68k-*-*-*) _arch_configure="--with-arch=68020 --with-tune=68020-40";;
+ mipsel-*-*-*) _arch_configure="--with-arch-32=mips2 --with-tune-32=mips32 --with-fp-32=32 --with-mips-plt --with-float=hard --with-abi=32";;
+ mips-*-*-*) _arch_configure="--with-arch=mips3 --with-mips-plt --with-abi=32"; _hash_style="sysv";;
+ mips32el-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-abi=32"; _hash_style="sysv";;
+ powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";;
+ powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no";;
+ powerpc64le*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no";;
+ i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";;
+ i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=pentium2 --enable-cld --enable-mmx";;
+ pentium3-*-*-*) _arch_configure="--with-arch=pentium3 --with-tune=pentium-m";;
+ s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";;
+ esac
+
+ case "$CTARGET_LIBC" in
+ musl)
+ # musl does not support mudflap, or libsanitizer
+ # libmpx uses secure_getenv and struct _libc_fpstate not present in musl
+ _libc_configure="--disable-libmpx --disable-libmudflap --disable-libsanitizer"
+ _symvers="--disable-symvers"
+ export libat_cv_have_ifunc=no
+ export ac_cv_type_off64_t=no
+ ;;
+ esac
+
+ _cross_configure="--disable-bootstrap"
+
+ case "$BOOTSTRAP" in
+ nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;;
+ *) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;;
+ esac
+
+ $LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic"
+ $LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm"
+ $LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath"
+
+# export CFLAGS="$CPPFLAGS $CFLAGS"
+# export CXXFLAGS="$CPPFLAGS $CXXFLAGS"
+# unset CPPFLAGS
+# export CFLAGS_FOR_TARGET=" "
+# export CXXFLAGS_FOR_TARGET=" "
+# export LDFLAGS_FOR_TARGET=" "
+
+ 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 " arch_configure=$_arch_configure"
+ echo " libc_configure=$_libc_configure"
+ echo " cross_configure=$_cross_configure"
+ echo " bootstrap_configure=$_bootstrap_configure"
+ echo " hash_style=$_hash_style"
+ echo ""
+
+ "$_gccdir"/configure --prefix="$srcdir"/gcc-$_gccver/usr \
+ --mandir="$srcdir"/gcc-$_gccver/usr/share/man \
+ --infodir="$srcdir"/gcc-$_gccver/usr/share/info \
+ --build=${CBUILD} \
+ --host=${CHOST} \
+ --target=${CTARGET} \
+ --with-pkgversion="Adelie ${_gccver}" \
+ --with-bugurl="https://git.adelielinux.org/adelie/packages/-/issues" \
+ --enable-checking=release \
+ --disable-fixed-point \
+ --disable-libstdcxx-pch \
+ --disable-multilib \
+ --disable-werror \
+ $_symvers \
+ --enable-__cxa_atexit \
+ --enable-default-pie \
+ --enable-cloog-backend \
+ --enable-languages=$_languages \
+ $_arch_configure \
+ $_libc_configure \
+ $_cross_configure \
+ $_bootstrap_configure \
+ --with-system-zlib \
+ --with-linker-hash-style=$_hash_style \
+ --enable-java-awt=gtk \
+ --enable-java-home \
+ --with-jvm-root-dir="$srcdir"/gcc-$_gccver"${_jvmdir}" \
+ --with-ecj-jar="$_gccdir"/ecj.jar \
+ ;
+ make
+
+ # ephemeral (only used for openjdk build)
+ make -j1 install
+ cp "$_gccdir"/build/$CTARGET/libjava/scripts/jar "$srcdir"/gcc-$_gccver/usr/bin
+}
+
+build() {
+ build_gcc
+
+ cd "$builddir" # lost during gcc build?
+
+ export PATH="$JAVA_HOME/bin:$srcdir/gcc-$_gccver/usr/bin:$PATH"
+ export LD_LIBRARY_PATH="$srcdir"/gcc-$_gccver/usr/lib
+
+ [ -z "$JOBS" ] && export JOBS=$(echo $MAKEFLAGS | sed -n -e 's/.*-j\([0-9]\+\).*/\1/p')
+ export ALT_PARALLEL_COMPILE_JOBS="${JOBS:-2}"
+ export HOTSPOT_BUILD_JOBS="${JOBS:-2}"
+
+ export JAVA_HOME=$BOOTSTRAP_JAVA_HOME
+ export ANT_HOME="$srcdir"/gcc-$_gccver/usr
+ export PATH=$JAVA_HOME/bin:$srcdir/apache-ant-$ANT_VER/bin:$PATH
+ export DISTRIBUTION_PATCHES=""
+
+ # Explicitly set the C++ standard as the default has changed on GCC 6+
+ # and disable optimizations that lead to a broken JVM. These options
+ # has been adopted from the Fedora package.
+ export EXTRA_CPP_FLAGS="$CXXFLAGS -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+ # CXXFLAGS doesn't make it to all calls, so we set the C++ standard
+ # version for C too.
+ export EXTRA_CFLAGS="$CFLAGS -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
+
+ local patch
+ for patch in $source; do
+ case $patch in
+ icedtea-*.patch)
+ export DISTRIBUTION_PATCHES="$DISTRIBUTION_PATCHES patches/$patch"
+ ;;
+ esac
+ done
+ echo "icedtea patches: $DISTRIBUTION_PATCHES"
+
+ # --disable-arm32-jit: https://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2942
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=$INSTALL_BASE \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --with-parallel-jobs=${JOBS:-2} \
+ --disable-dependency-tracking \
+ --disable-downloading \
+ --disable-arm32-jit \
+ --with-rhino=$srcdir/rhino$RHINO_VER/lib/rhino-$RHINO_VER.jar \
+ --with-openjdk-src-zip=$srcdir/openjdk-$_dropsver.tar.bz2 \
+ --with-hotspot-src-zip=$srcdir/hotspot-$_dropsver.tar.bz2 \
+ --with-corba-src-zip=$srcdir/corba-$_dropsver.tar.bz2 \
+ --with-jaxp-src-zip=$srcdir/jaxp-$_dropsver.tar.bz2 \
+ --with-jaxws-src-zip=$srcdir/jaxws-$_dropsver.tar.bz2 \
+ --with-jdk-src-zip=$srcdir/jdk-$_dropsver.tar.bz2 \
+ --with-langtools-src-zip=$srcdir/langtools-$_dropsver.tar.bz2 \
+ --with-jdk-home="$srcdir"/gcc-$_gccver/$BOOTSTRAP_JAVA_HOME \
+ --with-pkgversion="Adelie ${pkgver}-r${pkgrel}" \
+ --enable-nss \
+ --enable-non-nss-curves \
+ --enable-bootstrap \
+ --with-gcj="$srcdir"/gcc-$_gccver/usr/bin/gcj \
+ --with-ecj-jar="$_gccdir"/ecj.jar \
+ ;
+
+ msg "Icedtea boot"
+ make -j1 icedtea-boot SHELL=/bin/bash USRBIN_PATH=/bin/
+ msg "Icedtea boot done"
+ make
+}
+
+package() {
+ mkdir -p "$pkgdir"/$INSTALL_BASE
+ cp -a "$builddir"/openjdk.build/j2sdk-image/* "$pkgdir"/$INSTALL_BASE
+ rm "$pkgdir"/$INSTALL_BASE/src.zip
+
+ # symlink to shared java cacerts store
+ rm -f "$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
+ ln -sf /etc/ssl/certs/java/cacerts \
+ "$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
+}
+
+jrelib() {
+ pkgdesc="OpenJDK 7 Java Runtime (class libraries)"
+ depends=""
+
+ local A; for A in jre/lib/zi jre/lib/images jre/lib/*.jar \
+ jre/lib/security jre/lib/ext/*.jar jre/lib/cmm \
+ jre/ASSEMBLY_EXCEPTION jre/THIRD_PARTY_README jre/LICENSE; do
+
+ local dirname="${A%/*}"
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
+ mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
+ done
+}
+
+jrebase() {
+ pkgdesc="OpenJDK 7 Java Runtime (no GUI support)"
+ depends="$pkgname-jre-lib java-common java-cacerts"
+
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/bin
+
+ local A; for A in java orbd rmid servertool unpack200 keytool \
+ pack200 rmiregistry tnameserv; do
+ mv "$pkgdir"/$INSTALL_BASE/bin/$A "$subpkgdir"/$INSTALL_BASE/bin
+ done
+
+ # rest of the jre subdir (which were not taken by -jre subpkg)
+ mv "$pkgdir"/$INSTALL_BASE/jre "$subpkgdir"/$INSTALL_BASE
+}
+
+jre() {
+ pkgdesc="OpenJDK 7 Java Runtime"
+ # manually depend to avoid clash with libgcj's libjvm.so
+ depends="so:openjdk7:libjvm.so=0"
+
+ mkdir -p "$subpkgdir"
+ local A; for A in jre/bin/policytool \
+ bin/appletviewer \
+ bin/policytool \
+ jre/lib/$_jarch/xawt \
+ jre/lib/$_jarch/libsplashscreen.so; do
+
+ local dirname="${A%/*}"
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
+ mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
+ done
+}
+
+doc() {
+ default_doc
+ mkdir -p "$subpkgdir"/$INSTALL_BASE/
+ mv "$pkgdir"/$INSTALL_BASE/man "$subpkgdir"/$INSTALL_BASE/
+}
+
+sha512sums="cc782e1c5b1ce158be315cff5be61676373870c2062eb34688583a875ab68413bbabd909ce83e79a9c46c3d0c8ec10aad3c015276ddf782ce2079cb5a7098f82 icedtea-2.6.16.tar.gz
+ee2443da63ab6b1a525d0633a577f28d28d3916cb47b312d61d71b4795ae3bde4a70478017b7639133fb65cfb63aa0fcbc397afbde18f20d605a50286163e4a2 openjdk-2.6.16.tar.bz2
+3926a1c889d0ff5386dd78e8fb1ff71b553744fe574ab9655d9e1677da9aea3306d65e631866afcbb533b8e0fefbb34ae655400c9bc7c2058aaa34f8fb0a04d8 corba-2.6.16.tar.bz2
+2b37ba6f235b684682d9590c292b6af5fb6f41d4001f92dcf4945570e13fe760f91bbc7068d071e3e935829c9719936ae96940874ee211fd32cba187e05f0255 jaxp-2.6.16.tar.bz2
+41dc2b7a610cd5f4c9155c14670bb97f1c57924af2737faf6beb7b284c0ad7c0f0b33f4276cde5674a57db3f88ba4503f94f2dff7a52db3273ee53ed0b14be64 jaxws-2.6.16.tar.bz2
+2703b7bf7455aa3997426f2ce3d4c2285ee44640a940d15c1c3434414c295d87b44e749fece5a7b966661910c8768a79774fb03b43ab5605df9dc8965b600fd7 jdk-2.6.16.tar.bz2
+192dd5fac399c52bcb547617832428b40af493089b4bb63159cd9363c78af76c7acdc051d461eb4e4692b2090e05ed769b9fec460a328973b36b57bbb28cee39 langtools-2.6.16.tar.bz2
+73b0338ec293d0d87cc7251f63ef453ec10c7de978c56d8ff455b16ee0506175aed681a9a95fbdcc8b747ba00ef6cf914f63d0c5d22268b40620d4dbc7390a98 hotspot-2.6.16.tar.bz2
+0da12cb0f761b8cb76e042449e7d93f43236e7bc948e337215470a70031f0a2dda6d1b508f9397b283808d84c4ebddb31558fe1cd8e6e6469c1dd390d69ec6e7 apache-ant-1.9.11-bin.tar.gz
+1b9e8721749e81c5420a00af1e00ee0e4f48624ccb4e9aa969032114116ad50f59b254d4d16d74feff74de64157cc8b0a2ead9b555907c84b7055b796fba9a75 rhino-1.7.7.2.zip
+f62b942f0bacda8e37d0f1876d8ba14ddb4fc55a7d5fd1019463744927f40f422a85e9ee051948d566242f5a785aa28f275eb58768611283cba89af91235f43c icedtea-hotspot-musl.patch
+e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef icedtea-hotspot-musl-ppc.patch
+e7a2c1771bb582d427041f8d22e48c0daf8f20d7c0926cbce3549d49c4e949359ee25a35682b486e82f3e390535c950c5beee3bd8d06fb5a717b50f2d9b2a6bc icedtea-hotspot-noagent-musl.patch
+822eee0dc4d3ba677a289dfeb3668b536d2d626708390a9d9702fb4144a481fd443a215a0d2041c6026113837aafa4ba0b5e9ead8589d2da6717a238bbc95a5a icedtea-hotspot-uclibc-fixes.patch
+213a537de5f011cb39d608515c3413513ac75fb93593f9a9ef4205f71d72bdd8b097c80db185f7b26021d5bb85045b866f34f3478482dc4189972d8614a13458 icedtea-jdk-fix-build.patch
+0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb icedtea-jdk-execinfo.patch
+48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
+44a35941c80f408d0607e32763b3b6ccee21e1d39886309327d3d74d2900117e4346ef59e77c663fd022fec10ee8f365eeb46c1260014d5765d226ce175ce3c5 icedtea-jdk-musl.patch
+bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1 icedtea-jdk-no-soname.patch
+a54c79c82afa1bc95265397b274260584c8b8c6be1651ddfb907d9523a809ea4581409e0d3fb0bbb63ef5a204e8ce29b7940e78cd640af1f490ae938c59129b6 icedtea-cpio.patch
+dc5f59068395e9501b17308c91ec80670c195117e22cb7bef78d551d118f180a11d7f0b5d47f4c7106909d9a9a8c060ddd60b78f251fd35afa6c72a1515af53e icedtea-tar.patch
+049061b97d6e744b7ad9bad4a3dbfa1d236400003175e49740830dcb78a1f164b5c67b066e76c970eb27e09707f948cac0f5b7073abe0f49bcecfdd747f0107d icedtea-remove-gawk.patch
+b9950ddf9c5ebb53d1e029a1fe8ef843860128ceb05872313b33fd2696a4acadbc8291110ca6513ce7531e0f943e42b167068e603f7ecd0e36f5b16d6bb827ab icedtea-xattr.patch
+49d5e0fb5b180941f7f0fe6c8e84f33b0311efe7e4ec664d2ab4844196e6d728de8a74d69a7aa952ba964f9de65c2b1c0b7c4656d81ad14123d0cc7acea315db icedtea-newer-freetype.patch
+fda1ba46276475cced16c4f380dbc0a0ac07ae2d66a8da10e88455a299bd40ff04a63dae1c5f3d3de6adbb3c6c240db5d37df0be2fc3391764cb21c9ad83eb8b remove-gawk.patch
+3dd758e04e3b852398d81356c02a89afce0c664938d3f0179ee32e358d7057f5f969379329dd1ebcbf4bc3d37bd5e0d94102cd3f023326db5175968cfbbc9c35 xattr.patch
+6dd39baca14f088d0b2157308e3d9657ab64ecdb7daab09137486e212e3a8c53f6deae6167b6212217c6ef29c1406347e21ca6bb193ced9ebeb399aeb06bda4b project-autoconf-2xx.patch
+02c60e54527c7adf584798d5251f8a0b80c93d5deafce82501b2c28e6692e0bd783927bbfc4bc527a863c0cccc025150a34740a9e29badb02d4b48e56a8aba90 gcc-6.4.0.tar.xz
+28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar
+a1335adc2fbee98e36c4437ff2587771b98ed4180726779020f65039498235626a411cdb0100dbd20cd19d12f0d94f9a21af179ff624676c28cead9d60598b5d gcc-001_all_default-ssp-strong.patch
+e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 gcc-002_all_default-relro.patch
+f86466c62b8291fac46f9c250c7ad8fa5ab7b1cce2504442fd07ddc4543665b317ae28951f244e39aba29aeaf3fff252ec4f6a147aa16adb2b7aed747dd89188 gcc-003_all_default-fortify-source.patch
+51282fea54c7e616367bbeb2479ba13fec6f24eb47bd04e2071907b3b36273b2ff24676f46ef8d22f241c8ab4857307861eee076eab66797c3a50a8ecaa1809a gcc-005_all_default-as-needed.patch
+3398386dd1e079d6545dd9799adc799c6b80e3984fac6899d0e1a7ee21b66d0c7e53cddf17a65d590c883db750f9f79aaedd857355a8b9f7fb9476c906237919 gcc-011_all_default-warn-format-security.patch
+9adb0d2b9b67dd957df6c609b8714c7c078efb52cd88770905c37c67827be8fc83d1125037b9c29d77db21ce78756aa2bb0bacdb0b98d869ac126da76a298e21 gcc-012_all_default-warn-trampolines.patch
+d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd gcc-020_all_msgfmt-libstdc++-link.patch
+840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 gcc-050_all_libiberty-asprintf.patch
+0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca gcc-051_all_libiberty-pic.patch
+e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab gcc-053_all_libitm-no-fortify-source.patch
+e87da18aa7ab92b02b06168658c63b42a6c73a08fad2a30f81ef6296100fdbe3c3a91548fd0cb24eaf591e862bb08e4b67249bc4b977b07da33523aee0c686bc gcc-067_all_gcc-poison-system-directories.patch
+4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 gcc-090_all_pr55930-dependency-tracking.patch
+ef052d0c3c9642fcb5ed570069c5a49c8ef523c47ac8ce3f201a801766f72ae4ff7c3725a70ee66e52c0fb559621e35fe0cf5b88b901d71ceadd381f49653a08 gcc-201-cilkrts.patch
+808e206f5e107084156fba333d4e091dcbd62f5d7756142bc292d4b0a52619f8c2aaca3617defc2f5b6552ba0439aebd33f4141329d88eab6ddf2dd637d92c08 gcc-203-libgcc_s.patch
+fc0de05b36613b732a0222ea005c90653c6a40d6761b6894af2419272f4e74875f37e26af33a9b9940669ef89269c44c46d17ca5bcd54b5cd1176e5eaf2992c1 gcc-204-linux_libc_has_function.patch
+98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 gcc-205-nopie.patch
+3287d5b443bea8ec64132bcabe869c738ae98ea8f1a86df1c5d18c927f8816edbfcefeefc47792dbbb2bcacf50319af00e01b3735d34525913b64350770ad453 gcc-207-static-pie.patch
+d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b gcc-libgcc-always-build-gcceh.a.patch
+600fe5098dc54edaa9808fd5717af9dec058953f9ad37d49cfba1db4f7e9a7a8f02019342f75157fc575946fa693259422184de27b7ecc8386d9f3ecc0f7cc5d gcc-gcc-4.9-musl-fortify.patch
+dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-gcc-6.1-musl-libssp.patch
+bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 gcc-boehm-gc-musl.patch
+fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-gcc-pure64.patch
+2253941f3d19b6d08801d3782f5f5ed56c3b73fbc9d3561a8f01c702963ac4fab91599c686076e7081eb6a80c37ccd33591ae978996d6eee1dc0ce0f1c50259a gcc-fix-gcj-stdgnu14-link.patch
+f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d452e9579924a523bc75da6e0648c1c976d42e40af48b10343b gcc-fix-gcj-musl.patch
+54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 gcc-fix-gcj-iconv-musl.patch
+abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-gcc-4.8-build-args.patch
+35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 gcc-fix-cxxflags-passing.patch
+9016b257abd8fa981de44a49512e35db814d1cbb47c1a87cd31c12d4ae20b13e9e149fe41691a7ec3c95bbcfde8a79194a8d2eaf547ceade3a246fad67c47dd8 gcc-ada-fixes.patch
+3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 gcc-ada-shared.patch
+631d4bdef6d8bde34df7978bb53ec28c3c909cf1f87139e5f148138d0f09adc58b41ecf0148bbf50fb4bc916c411e9bf8a2b6c046c75c0e77d754d8c35bcd4d7 gcc-ada-musl.patch
+fa44c8158111627aa0e91c43e7cc3aa38642c2041c96532dd4f0932dae4d6f92ea2850b683abcf10e7e120299d42ea6b69adc00002a514c76be8e39e99fa052b gcc-ada-aarch64-multiarch.patch
+4b4a0ff306a8ef34ff6e3284fbfca869012164a47ba7cb099085c1dd03e6ca0cdd462f82710e08c9a02895adc7484e4c5eef17b5aa264cf5d978fe8ad78eea93 gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch
+385bc2fa50204f678964e5148c6170f572701dab920fbec8301f505bda34d182cde0adb7da042fee71719e12fb59f59181897f9b1bb4f4716ff59aad46ca1998 gcc-310-build-gcj-s390x.patch
+f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 gcc-320-libffi-gnulinux.patch
+8efd028febb962ae100be32f72f7450c4f77d67ad96a5f47072136cdf47043f9d54835a87c7ab5aaa0fa0108c4c7a97ba2d7732d5aaf2efce70fe1f7e1c39d6e gcc-330-gccgo-link-to-ucontext.patch
+24c8708f64b9b7945b3f07e9bbecf17ab8bcde2524f49cbd694ca2f6146ccc3f13bb027db282f326525ea79d50a2868fa3fa2b0d688a914b5ea77bbfd7e5cbe4 gcc-331-gccgo-use-real-off_t-type.patch
+cf19fcc6abee70210a9061e5385fe361a5eb59a74f7d34297420a53e351400da23a060164bef5b322daba4be90019481731acf93c45fb5a93430018f1aa7ce35 gcc-332-gccgo-remove-ustat.patch
+d5eb8d289a1de1f9d85d5451a81265a1aac3eea79a555cc4bfaa60cb7c3f80c00ee1ea3791a8069bc22783f3534d6ad20bfaa4e11252f49f9ffa27843315c0ee gcc-libgo-musl-1.2.3.patch
+01c71cd5881fc07ea3b9b980697e89b3ca0fe98502958ceafc3fca18b2604c844e2f457feab711baf8e03f00a5383b0e38aac7eb954034e306f43d4a37f165ed gcc-fix-rs6000-pie.patch
+1860593584f629d24d5b6db14b0a3412e9f93449b663aaa4981301a0923db0159314905e694f27366fbfef72dce06636ab6df86862b7e9e9564847e03bee82c1 gcc-add-classic_table-support.patch
+4e1b421ed72668b66ecbcb0a34afa99d2a34cb2ea9ee51c4aad605fc8a0e94e3bfbabae4ebe236efc5ec86fc01a472cbe93f36fe25cf579714939d8102a9b84a gcc-lra-pentium.patch
+67a75a94fdba69de96b98dbc2978a50cb197857c464b81f7c956176da7066b3be937e40cb15e0870fc1e7382d662c5101bcd18cf457fc4112de41802042b51c4 gcc-gcc-5.4.0-locale.patch
+ca9e2747fc0ed5b5c35a7df6ae48482855c2663882b5e7a86e65efa5910b3be77380361fe21668718a3e68f6362306a440fa86bff6c50b4d92d6c75ce65a47e8 gcc-isl-fix.patch"
diff --git a/user/openjdk7/gcc-001_all_default-ssp-strong.patch b/user/openjdk7/gcc-001_all_default-ssp-strong.patch
new file mode 100644
index 000000000..95949eb00
--- /dev/null
+++ b/user/openjdk7/gcc-001_all_default-ssp-strong.patch
@@ -0,0 +1,215 @@
+# DP: Turn on -fstack-protector by default for C, C++, ObjC, ObjC++.
+# DP: Build libgcc using -fno-stack-protector.
+
+---
+ gcc/Makefile.in | 2 ++
+ gcc/cp/lang-specs.h | 6 +++---
+ gcc/doc/invoke.texi | 4 ++++
+ gcc/gcc.c | 18 ++++++++++++++----
+ gcc/objc/lang-specs.h | 10 +++++-----
+ gcc/objcp/lang-specs.h | 8 ++++----
+ 6 files changed, 32 insertions(+), 16 deletions(-)
+
+Index: b/gcc/gcc.c
+===================================================================
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -858,6 +858,14 @@ proper position among the other output f
+ #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
+ #endif
+
++#ifndef SSP_DEFAULT_SPEC
++#ifdef TARGET_LIBC_PROVIDES_SSP
++#define SSP_DEFAULT_SPEC "%{!fno-stack-protector:%{!fstack-protector-all:%{!ffreestanding:%{!nostdlib:%{!fstack-protector:-fstack-protector-strong}}}}}"
++#else
++#define SSP_DEFAULT_SPEC ""
++#endif
++#endif
++
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+@@ -1057,6 +1065,7 @@ static const char *cc1_spec = CC1_SPEC;
+ static const char *cc1plus_spec = CC1PLUS_SPEC;
+ static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
+ static const char *link_ssp_spec = LINK_SSP_SPEC;
++static const char *ssp_default_spec = SSP_DEFAULT_SPEC;
+ static const char *asm_spec = ASM_SPEC;
+ static const char *asm_final_spec = ASM_FINAL_SPEC;
+ static const char *link_spec = LINK_SPEC;
+@@ -1112,7 +1121,7 @@ static const char *cpp_unique_options =
+ static const char *cpp_options =
+ "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
+- %{undef} %{save-temps*:-fpch-preprocess}";
++ %{undef} %{save-temps*:-fpch-preprocess} %(ssp_default)";
+
+ /* This contains cpp options which are not passed when the preprocessor
+ output will be used by another program. */
+@@ -1301,9 +1310,9 @@ static const struct compiler default_com
+ %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
+ %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
+ cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
+- %(cc1_options)}\
++ %(cc1_options) %(ssp_default)}\
+ %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
+- cc1 %(cpp_unique_options) %(cc1_options)}}}\
++ cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
+ {"-",
+ "%{!E:%e-E or -x required when input is from standard input}\
+@@ -1328,7 +1337,7 @@ static const struct compiler default_com
+ %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
+ {".i", "@cpp-output", 0, 0, 0},
+ {"@cpp-output",
+- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
++ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(ssp_default) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {".s", "@assembler", 0, 0, 0},
+ {"@assembler",
+ "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
+@@ -1560,6 +1569,7 @@ static struct spec_list static_specs[] =
+ INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
+ INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
+ INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
++ INIT_STATIC_SPEC ("ssp_default", &ssp_default_spec),
+ INIT_STATIC_SPEC ("endfile", &endfile_spec),
+ INIT_STATIC_SPEC ("link", &link_spec),
+ INIT_STATIC_SPEC ("lib", &lib_spec),
+Index: b/gcc/cp/lang-specs.h
+===================================================================
+--- a/gcc/cp/lang-specs.h
++++ b/gcc/cp/lang-specs.h
+@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3.
+ %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
+ cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:-o %g.s \
+ %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}}%V}}}}",
+@@ -58,11 +58,11 @@ along with GCC; see the file COPYING3.
+ %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
+ cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {".ii", "@c++-cpp-output", 0, 0, 0},
+ {"@c++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+- cc1plus -fpreprocessed %i %(cc1_options) %2\
++ cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+Index: b/gcc/params.def
+===================================================================
+--- a/gcc/params.def
++++ b/gcc/params.def
+@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
+ DEFPARAM (PARAM_SSP_BUFFER_SIZE,
+ "ssp-buffer-size",
+ "The lower bound for a buffer to be considered for stack smashing protection.",
+- 8, 1, 0)
++ 4, 1, 0)
+
+ DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
+ "min-size-for-stack-sharing",
+Index: b/gcc/objc/lang-specs.h
+===================================================================
+--- a/gcc/objc/lang-specs.h
++++ b/gcc/objc/lang-specs.h
+@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3.
+ %{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
++ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}\
+ %{!save-temps*:%{!no-integrated-cpp:\
+- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
++ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objective-c-header",
+ "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
+@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3.
+ %{traditional|traditional-cpp:\
+ %eGNU Objective C no longer supports traditional compilation}\
+ %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
+- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ -o %g.s %{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}%V}\
+ %{!save-temps*:%{!no-integrated-cpp:\
+- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ -o %g.s %{!o*:--output-pch=%i.gch}\
+ %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
+ {".mi", "@objective-c-cpp-output", 0, 0, 0},
+ {"@objective-c-cpp-output",
+- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objc-cpp-output",
+ "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
+- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
++ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+Index: b/gcc/objcp/lang-specs.h
+===================================================================
+--- a/gcc/objcp/lang-specs.h
++++ b/gcc/objcp/lang-specs.h
+@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.
+ %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+ cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {"@objective-c++",
+@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3.
+ %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
+ cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
+ %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
+- %(cc1_options) %2\
++ %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}",
+ CPLUSPLUS_CPP_SPEC, 0, 0},
+ {".mii", "@objective-c++-cpp-output", 0, 0, 0},
+ {"@objective-c++-cpp-output",
+ "%{!M:%{!MM:%{!E:\
+- cc1objplus -fpreprocessed %i %(cc1_options) %2\
++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ {"@objc++-cpp-output",
+ "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
+ %{!M:%{!MM:%{!E:\
+- cc1objplus -fpreprocessed %i %(cc1_options) %2\
++ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
+ %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+Index: b/gcc/doc/invoke.texi
+===================================================================
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -9247,6 +9247,9 @@
+ The minimum size of variables taking part in stack slot sharing when not
+ optimizing. The default value is 32.
+
++The Alpine Linux default is "4", to increase
++the number of functions protected by the stack protector.
++
+ @item max-jump-thread-duplication-stmts
+ Maximum number of statements allowed in a block that needs to be
+ duplicated when threading jumps.
+@@ -10185,6 +10188,11 @@
+ Like @option{-fstack-protector} but includes additional functions to
+ be protected --- those that have local array definitions, or have
+ references to local frame addresses.
++
++NOTE: In Alpine Linux,
++@option{-fstack-protector-strong} is enabled by default for C,
++C++, ObjC, ObjC++, if none of @option{-fno-stack-protector},
++@option{-nostdlib}, nor @option{-ffreestanding} are found.
+
+ @item -fstack-protector-explicit
+ @opindex fstack-protector-explicit
diff --git a/user/openjdk7/gcc-002_all_default-relro.patch b/user/openjdk7/gcc-002_all_default-relro.patch
new file mode 100644
index 000000000..c461017dc
--- /dev/null
+++ b/user/openjdk7/gcc-002_all_default-relro.patch
@@ -0,0 +1,33 @@
+# Turn on -Wl,-z,relro,-z,now by default.
+
+---
+ gcc/doc/invoke.texi | 3 +++
+ gcc/gcc.c | 1 +
+ 2 files changed, 4 insertions(+), 0 deletions(-)
+
+Index: b/gcc/doc/invoke.texi
+===================================================================
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map
+ linker. When using the GNU linker, you can also get the same effect with
+ @option{-Wl,-Map=output.map}.
+
++NOTE: In Alpine Linux, for LDFLAGS, the option
++@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
++
+ @item -u @var{symbol}
+ @opindex u
+ Pretend the symbol @var{symbol} is undefined, to force linking of
+Index: b/gcc/gcc.c
+===================================================================
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -890,6 +890,7 @@ proper position among the other output f
+ "%{flto|flto=*:%<fcompare-debug*} \
+ %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
+ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
++ "-z relro -z now " \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
diff --git a/user/openjdk7/gcc-003_all_default-fortify-source.patch b/user/openjdk7/gcc-003_all_default-fortify-source.patch
new file mode 100644
index 000000000..6ca803343
--- /dev/null
+++ b/user/openjdk7/gcc-003_all_default-fortify-source.patch
@@ -0,0 +1,40 @@
+# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
+# DP: if the optimization level is > 0
+
+---
+ gcc/doc/invoke.texi | 6 ++++++
+ gcc/c-family/c-cppbuiltin.c | 3 +
+ 2 files changed, 9 insertions(+), 0 deletions(-)
+
+Index: b/gcc/doc/invoke.texi
+===================================================================
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -7840,6 +7840,12 @@ also turns on the following optimization
+ Please note the warning under @option{-fgcse} about
+ invoking @option{-O2} on programs that use computed gotos.
+
++NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
++set by default, and is activated when @option{-O} is set to 2 or higher.
++This enables additional compile-time and run-time checks for several libc
++functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
++@option{-D_FORTIFY_SOURCE=0}.
++
+ @item -O3
+ @opindex O3
+ Optimize yet more. @option{-O3} turns on all optimizations specified
+Index: b/gcc/c-family/c-cppbuiltin.c
+===================================================================
+--- a/gcc/c-family/c-cppbuiltin.c
++++ b/gcc/c-family/c-cppbuiltin.c
+@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile)
+ builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
+ builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
+
++ /* Fortify Source enabled by default for optimization levels > 0 */
++ if (optimize)
++ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
++
+ /* Misc. */
+ if (flag_gnu89_inline)
+ cpp_define (pfile, "__GNUC_GNU_INLINE__");
diff --git a/user/openjdk7/gcc-005_all_default-as-needed.patch b/user/openjdk7/gcc-005_all_default-as-needed.patch
new file mode 100644
index 000000000..ee4f7962a
--- /dev/null
+++ b/user/openjdk7/gcc-005_all_default-as-needed.patch
@@ -0,0 +1,241 @@
+# DP: On linux targets pass --as-needed by default to the linker, but always
+# DP: link the sanitizer libraries with --no-as-needed.
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -568,8 +568,11 @@ proper position among the other output f
+ #ifdef LIBTSAN_EARLY_SPEC
+ #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
+ #elif defined(HAVE_LD_STATIC_DYNAMIC)
+-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
+- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
++#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
++ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
++ " -ltsan " \
++ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
++ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
+ STATIC_LIBTSAN_LIBS
+ #else
+ #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
+--- a/gcc/config/gnu-user.h
++++ b/gcc/config/gnu-user.h
+@@ -124,13 +124,13 @@
+ #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
+ "%{static-libasan:%{!shared:" \
+ LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
+- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
++ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
+ #undef LIBTSAN_EARLY_SPEC
+ #define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
+ LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
+- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
++ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
+ #undef LIBLSAN_EARLY_SPEC
+ #define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
+ LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
+- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
++ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
+ #endif
+Index: b/gcc/config/aarch64/aarch64-linux.h
+===================================================================
+--- a/gcc/config/aarch64/aarch64-linux.h
++++ b/gcc/config/aarch64/aarch64-linux.h
+@@ -36,5 +36,6 @@
+
+ #define LINUX_TARGET_LINK_SPEC "%{h*} \
++ --as-needed \
+ %{static:-Bstatic} \
+ %{shared:-shared} \
+ %{symbolic:-Bsymbolic} \
+Index: b/gcc/config/ia64/linux.h
+===================================================================
+--- a/gcc/config/ia64/linux.h
++++ b/gcc/config/ia64/linux.h
+@@ -58,7 +58,7 @@ do { \
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "\
++#define LINK_SPEC " --as-needed \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+Index: b/gcc/config/sparc/linux.h
+===================================================================
+--- a/gcc/config/sparc/linux.h
++++ b/gcc/config/sparc/linux.h
+@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
++#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
+ %{!mno-relax:%{!r:-relax}} \
+ %{!shared: \
+ %{!static: \
+Index: b/gcc/config/s390/linux.h
+===================================================================
+--- a/gcc/config/s390/linux.h
++++ b/gcc/config/s390/linux.h
+@@ -65,7 +65,7 @@ along with GCC; see the file COPYING3.
+
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
++ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
+ %{shared:-shared} \
+ %{!shared: \
+ %{static:-static} \
+Index: b/gcc/config/rs6000/linux64.h
+===================================================================
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -466,12 +466,12 @@ extern int dot_symbols;
+ " -m elf64ppc")
+ #endif
+
+-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
+ %(link_os_extra_spec32)"
+
+-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \
+ %(link_os_extra_spec64)"
+Index: b/gcc/config/rs6000/sysv4.h
+===================================================================
+--- a/gcc/config/rs6000/sysv4.h
++++ b/gcc/config/rs6000/sysv4.h
+@@ -784,7 +784,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
+ MUSL_DYNAMIC_LINKER)
+
+-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
++#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
+ %{rdynamic:-export-dynamic} \
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
+
+Index: b/gcc/config/i386/gnu-user64.h
+===================================================================
+--- a/gcc/config/i386/gnu-user64.h
++++ b/gcc/config/i386/gnu-user64.h
+@@ -57,5 +57,6 @@ see the files COPYING3 and COPYING.RUNTI
+ %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
+ %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
++ --as-needed \
+ %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+Index: b/gcc/config/i386/gnu-user.h
+===================================================================
+--- a/gcc/config/i386/gnu-user.h
++++ b/gcc/config/i386/gnu-user.h
+@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.
+ { "link_emulation", GNU_USER_LINK_EMULATION },\
+ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
+
+-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
++#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+Index: b/gcc/config/alpha/linux-elf.h
+===================================================================
+--- a/gcc/config/alpha/linux-elf.h
++++ b/gcc/config/alpha/linux-elf.h
+@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.
+
+ #define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
+
+-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
++#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
+ %{O*:-O3} %{!O*:-O1} \
+ %{shared:-shared} \
+ %{!shared: \
+Index: b/gcc/config/arm/linux-elf.h
+===================================================================
+--- a/gcc/config/arm/linux-elf.h
++++ b/gcc/config/arm/linux-elf.h
+@@ -73,5 +73,6 @@
+ %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
+ -X \
++ --as-needed \
+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
+ SUBTARGET_EXTRA_LINK_SPEC
+
+Index: b/gcc/config/mips/gnu-user.h
+===================================================================
+--- a/gcc/config/mips/gnu-user.h
++++ b/gcc/config/mips/gnu-user.h
+@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.
+ #undef GNU_USER_TARGET_LINK_SPEC
+ #define GNU_USER_TARGET_LINK_SPEC "\
+ %{G*} %{EB} %{EL} %{mips*} %{shared} \
++ -as-needed \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic:-export-dynamic} \
+Index: b/libjava/Makefile.am
+===================================================================
+--- a/libjava/Makefile.am
++++ b/libjava/Makefile.am
+@@ -627,14 +631,14 @@
+ rm .libs/libgcj_bc.so; \
+ mv .libs/libgcj_bc.so.1.0.0 .libs/libgcj_bc.so; \
+ $(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+- -o .libs/libgcj_bc.so.1.0.0 -lgcj || exit; \
++ -o .libs/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
+ rm .libs/libgcj_bc.so.1; \
+ $(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1
+
+ ## This rule creates the libgcj_bc library that is actually installed.
+ install/libgcj_bc.la: $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_DEPENDENCIES) install/$(am__dirstamp)
+ $(libgcj_bc_la_LINK) $(am_libgcj_bc_la_rpath) $(libgcj_bc_la_LDFLAGS) \
+- $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS)
++ $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS) -Wl,--no-as-needed -lgcj
+
+ ## Note that property_files is defined in sources.am.
+ propertyo_files = $(patsubst classpath/resource/%,%,$(addsuffix .lo,$(property_files)))
+@@ -762,7 +766,7 @@
+ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ $(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+- -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
++ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
+ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+ $(LN_S) libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.la;
+
+Index: b/libjava/Makefile.in
+===================================================================
+--- a/libjava/Makefile.in
++++ b/libjava/Makefile.in
+@@ -10644,13 +10648,13 @@
+ rm .libs/libgcj_bc.so; \
+ mv .libs/libgcj_bc.so.1.0.0 .libs/libgcj_bc.so; \
+ $(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+- -o .libs/libgcj_bc.so.1.0.0 -lgcj || exit; \
++ -o .libs/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
+ rm .libs/libgcj_bc.so.1; \
+ $(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1
+
+ install/libgcj_bc.la: $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_DEPENDENCIES) install/$(am__dirstamp)
+ $(libgcj_bc_la_LINK) $(am_libgcj_bc_la_rpath) $(libgcj_bc_la_LDFLAGS) \
+- $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS)
++ $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS) -Wl,--no-as-needed -lgcj
+
+ $(propertyo_files): %.lo: classpath/resource/%
+ $(mkinstalldirs) `dirname $@`; \
+@@ -12494,7 +12498,7 @@
+ @USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ @USE_LIBGCJ_BC_TRUE@ mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
+ @USE_LIBGCJ_BC_TRUE@ $(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
+-@USE_LIBGCJ_BC_TRUE@ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
++@USE_LIBGCJ_BC_TRUE@ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
+ @USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+ @USE_LIBGCJ_BC_TRUE@ $(LN_S) libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+ @USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.la;
+
diff --git a/user/openjdk7/gcc-011_all_default-warn-format-security.patch b/user/openjdk7/gcc-011_all_default-warn-format-security.patch
new file mode 100644
index 000000000..a58383a8e
--- /dev/null
+++ b/user/openjdk7/gcc-011_all_default-warn-format-security.patch
@@ -0,0 +1,43 @@
+Enable -Wformat and -Wformat-security by default.
+
+
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -412,7 +412,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonliteral) Warning LangEnabledBy(C ObjC C++ O
+ Warn about format strings that are not literals
+
+ Wformat-security
+-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
+ Warn about possible security problems with format functions
+
+ Wformat-y2k
+@@ -424,7 +424,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++
+ Warn about zero-length formats
+
+ Wformat=
+-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0)
+ Warn about printf/scanf/strftime/strfmon format string anomalies
+
+ Wignored-qualifiers
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -3451,6 +3451,8 @@ compiler warns that an unrecognized option is present.
+ '-Wno-format-contains-nul', '-Wno-format-extra-args', and
+ '-Wno-format-zero-length'. '-Wformat' is enabled by '-Wall'.
+
++ This option is enabled by default in Alpine Linux.
++
+ '-Wno-format-contains-nul'
+ If '-Wformat' is specified, do not warn about format strings
+ that contain NUL bytes.
+@@ -3496,6 +3498,8 @@ compiler warns that an unrecognized option is present.
+ future warnings may be added to '-Wformat-security' that are
+ not included in '-Wformat-nonliteral'.)
+
++ This option is enabled by default in Alpine Linux.
++
+ '-Wformat-y2k'
+ If '-Wformat' is specified, also warn about 'strftime' formats
+ that may yield only a two-digit year.
diff --git a/user/openjdk7/gcc-012_all_default-warn-trampolines.patch b/user/openjdk7/gcc-012_all_default-warn-trampolines.patch
new file mode 100644
index 000000000..9ab4378d4
--- /dev/null
+++ b/user/openjdk7/gcc-012_all_default-warn-trampolines.patch
@@ -0,0 +1,25 @@
+Enable -Wtrampolines by default.
+
+
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -648,7 +648,7 @@ Common Var(warn_system_headers) Warning
+ Do not suppress warnings from system headers
+
+ Wtrampolines
+-Common Var(warn_trampolines) Warning
++Common Var(warn_trampolines) Init(1) Warning
+ Warn whenever a trampoline is generated
+
+ Wtype-limits
+--- a/gcc/doc/gcc.info
++++ b/gcc/doc/gcc.info
+@@ -4021,6 +4021,8 @@ compiler warns that an unrecognized option is present.
+ and thus requires the stack to be made executable in order for the
+ program to work properly.
+
++ This warning is enabled by default in Gentoo.
++
+ '-Wfloat-equal'
+ Warn if floating-point values are used in equality comparisons.
+
diff --git a/user/openjdk7/gcc-020_all_msgfmt-libstdc++-link.patch b/user/openjdk7/gcc-020_all_msgfmt-libstdc++-link.patch
new file mode 100644
index 000000000..a70ea50a0
--- /dev/null
+++ b/user/openjdk7/gcc-020_all_msgfmt-libstdc++-link.patch
@@ -0,0 +1,39 @@
+Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
+
+Solves error messages like the following:
+
+msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
+
+The libgcc_s.so used during build doesn't satisfy the needs of the
+libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
+is used as a stand-alone application here, and what library it uses
+behind the scenes is of no concern to the gcc build process.
+Therefore, simply invoking it "as usual", i.e. without any special
+library path, will make it work as expected here.
+
+2011-09-19 Martin von Gagern
+
+References:
+https://bugs.gentoo.org/372377
+https://bugs.gentoo.org/295480
+
+--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
++++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
+@@ -39,6 +39,7 @@ MSGFMT = msgfmt
+ EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
+
+ .po.mo:
++ env --unset=LD_LIBRARY_PATH \
+ $(MSGFMT) -o $@ $<
+
+ all-local: all-local-$(USE_NLS)
+--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
++++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
+@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
+
+
+ .po.mo:
++ env --unset=LD_LIBRARY_PATH \
+ $(MSGFMT) -o $@ $<
+
+ all-local: all-local-$(USE_NLS)
diff --git a/user/openjdk7/gcc-050_all_libiberty-asprintf.patch b/user/openjdk7/gcc-050_all_libiberty-asprintf.patch
new file mode 100644
index 000000000..bee0c4c23
--- /dev/null
+++ b/user/openjdk7/gcc-050_all_libiberty-asprintf.patch
@@ -0,0 +1,18 @@
+2008-07-25 Magnus Granberg <zorry@ume.nu>
+
+ * include/libiberty.h (asprintf): Don't declare if defined as a macro
+
+--- a/include/libiberty.h
++++ b/include/libiberty.h
+@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
+ /* Like sprintf but provides a pointer to malloc'd storage, which must
+ be freed by the caller. */
+
++/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
++#ifndef asprintf
+ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
+ #endif
++#endif
+
+ #if !HAVE_DECL_VASPRINTF
+ /* Like vsprintf but provides a pointer to malloc'd storage, which
diff --git a/user/openjdk7/gcc-051_all_libiberty-pic.patch b/user/openjdk7/gcc-051_all_libiberty-pic.patch
new file mode 100644
index 000000000..b6160a730
--- /dev/null
+++ b/user/openjdk7/gcc-051_all_libiberty-pic.patch
@@ -0,0 +1,10 @@
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
+ $(AR) $(AR_FLAGS) $(TARGETLIB) \
+ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
+ $(RANLIB) $(TARGETLIB); \
++ cp $(TARGETLIB) ../ ; \
+ cd ..; \
+ else true; fi
+
diff --git a/user/openjdk7/gcc-053_all_libitm-no-fortify-source.patch b/user/openjdk7/gcc-053_all_libitm-no-fortify-source.patch
new file mode 100644
index 000000000..5ab15afc3
--- /dev/null
+++ b/user/openjdk7/gcc-053_all_libitm-no-fortify-source.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/508852
+https://gcc.gnu.org/PR61164
+
+2014-04-27 Magnus Granberg <zorry@gentoo.org>
+
+ #508852
+ * libitm/configure.tgt: Disable FORTIFY
+
+--- a/libitm/configure.tgt
++++ b/libitm/configure.tgt
+@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
+ esac
+ fi
+
++# FIXME: error: inlining failed in call to always_inline
++# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’
++# : function body can be overwritten at link time
++# Disable Fortify in libitm for now. #508852
++case "${target}" in
++ *-*-linux*)
++ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
++ ;;
++esac
++
+ # Map the target cpu to an ARCH sub-directory. At the same time,
+ # work out any special compilation flags as necessary.
+ case "${target_cpu}" in
diff --git a/user/openjdk7/gcc-067_all_gcc-poison-system-directories.patch b/user/openjdk7/gcc-067_all_gcc-poison-system-directories.patch
new file mode 100644
index 000000000..103671617
--- /dev/null
+++ b/user/openjdk7/gcc-067_all_gcc-poison-system-directories.patch
@@ -0,0 +1,194 @@
+http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/gcc/gcc-6.1/0010-gcc-poison-system-directories.patch
+
+From d76250323dad69212c958e4857a98d99ab51a39e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 29 Mar 2013 08:59:00 +0400
+Subject: [PATCH 10/46] gcc: poison-system-directories
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Inappropriate [distribution: codesourcery]
+---
+ gcc/common.opt | 4 ++++
+ gcc/config.in | 6 ++++++
+ gcc/configure | 16 ++++++++++++++++
+ gcc/configure.ac | 10 ++++++++++
+ gcc/doc/invoke.texi | 9 +++++++++
+ gcc/gcc.c | 2 ++
+ gcc/incpath.c | 19 +++++++++++++++++++
+ 7 files changed, 66 insertions(+)
+
+diff --git a/gcc/common.opt b/gcc/common.opt
+index 67048db..733185c 100644
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -659,6 +659,10 @@ Wreturn-local-addr
+ Common Var(warn_return_local_addr) Init(1) Warning
+ Warn about returning a pointer/reference to a local or temporary variable.
+
++Wpoison-system-directories
++Common Var(flag_poison_system_directories) Init(1) Warning
++Warn for -I and -L options using system directories if cross compiling
++
+ Wshadow
+ Common Var(warn_shadow) Warning
+ Warn when one local variable shadows another.
+diff --git a/gcc/config.in b/gcc/config.in
+index 115cb61..105b30f 100644
+--- a/gcc/config.in
++++ b/gcc/config.in
+@@ -187,6 +187,12 @@
+ #endif
+
+
++/* Define to warn for use of native system header directories */
++#ifndef USED_FOR_TARGET
++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
++#endif
++
++
+ /* Define if you want all operations on RTL (the basic data structure of the
+ optimizer and back end) to be checked for dynamic type safety at runtime.
+ This is quite expensive. */
+diff --git a/gcc/configure b/gcc/configure
+index 1c6e340..8f83152 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -942,6 +942,7 @@ with_system_zlib
+ enable_maintainer_mode
+ enable_link_mutex
+ enable_version_specific_runtime_libs
++enable_poison_system_directories
+ enable_plugin
+ enable_host_shared
+ enable_libquadmath_support
+@@ -1681,6 +1682,8 @@ Optional Features:
+ --enable-version-specific-runtime-libs
+ specify that runtime libraries should be installed
+ in a compiler-specific directory
++ --enable-poison-system-directories
++ warn for use of native system header directories
+ --enable-plugin enable plugin support
+ --enable-host-shared build host code as shared libraries
+ --disable-libquadmath-support
+@@ -28908,6 +28911,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
+ fi
+
+
++# Check whether --enable-poison-system-directories was given.
++if test "${enable_poison_system_directories+set}" = set; then :
++ enableval=$enable_poison_system_directories;
++else
++ enable_poison_system_directories=no
++fi
++
++if test "x${enable_poison_system_directories}" = "xyes"; then
++
++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
++
++fi
++
+ # Substitute configuration variables
+
+
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 6c1dcd9..0fccaef 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -5861,6 +5861,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
+ [specify that runtime libraries should be
+ installed in a compiler-specific directory])])
+
++AC_ARG_ENABLE([poison-system-directories],
++ AS_HELP_STRING([--enable-poison-system-directories],
++ [warn for use of native system header directories]),,
++ [enable_poison_system_directories=no])
++if test "x${enable_poison_system_directories}" = "xyes"; then
++ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
++ [1],
++ [Define to warn for use of native system header directories])
++fi
++
+ # Substitute configuration variables
+ AC_SUBST(subdirs)
+ AC_SUBST(srcdir)
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 821f8fd..8bb49e7 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -284,6 +284,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Wparentheses -Wno-pedantic-ms-format @gol
+ -Wplacement-new -Wplacement-new=@var{n} @gol
+ -Wpointer-arith -Wno-pointer-to-int-cast @gol
++-Wno-poison-system-directories @gol
+ -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
+ -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
+ -Wshift-overflow -Wshift-overflow=@var{n} @gol
+@@ -4723,6 +4724,14 @@ made up of data only and thus requires no special treatment. But, for
+ most targets, it is made up of code and thus requires the stack to be
+ made executable in order for the program to work properly.
+
++@item -Wno-poison-system-directories
++@opindex Wno-poison-system-directories
++Do not warn for @option{-I} or @option{-L} options using system
++directories such as @file{/usr/include} when cross compiling. This
++option is intended for use in chroot environments when such
++directories contain the correct headers and libraries for the target
++system rather than the host.
++
+ @item -Wfloat-equal
+ @opindex Wfloat-equal
+ @opindex Wno-float-equal
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 1af5920..4cfef7f 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -1017,6 +1017,8 @@ proper position among the other output files. */
+ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
++ %{Wno-poison-system-directories:--no-poison-system-directories} \
++ %{Werror=poison-system-directories:--error-poison-system-directories} \
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) " \
+ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
+ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index ea40f4a..856da41 100644
+--- a/gcc/incpath.c
++++ b/gcc/incpath.c
+@@ -26,6 +26,7 @@
+ #include "intl.h"
+ #include "incpath.h"
+ #include "cppdefault.h"
++#include "diagnostic-core.h"
+
+ /* Microsoft Windows does not natively support inodes.
+ VMS has non-numeric inodes. */
+@@ -381,6 +382,24 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
+ }
+ fprintf (stderr, _("End of search list.\n"));
+ }
++
++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
++ if (flag_poison_system_directories)
++ {
++ struct cpp_dir *p;
++
++ for (p = heads[QUOTE]; p; p = p->next)
++ {
++ if ((!strncmp (p->name, "/usr/include", 12))
++ || (!strncmp (p->name, "/usr/local/include", 18))
++ || (!strncmp (p->name, "/usr/X11R6/include", 18)))
++ warning (OPT_Wpoison_system_directories,
++ "include location \"%s\" is unsafe for "
++ "cross-compilation",
++ p->name);
++ }
++ }
++#endif
+ }
+
+ /* Use given -I paths for #include "..." but not #include <...>, and
+--
+2.8.2
+
diff --git a/user/openjdk7/gcc-090_all_pr55930-dependency-tracking.patch b/user/openjdk7/gcc-090_all_pr55930-dependency-tracking.patch
new file mode 100644
index 000000000..a8743e08c
--- /dev/null
+++ b/user/openjdk7/gcc-090_all_pr55930-dependency-tracking.patch
@@ -0,0 +1,18 @@
+libatomic build failure if configured with --disable-dependency-tracking
+load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory
+
+https://bugs.gentoo.org/463463
+http://gcc.gnu.org/PR55930
+
+--- a/libatomic/Makefile.in
++++ b/libatomic/Makefile.in
+@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
+ PAT_S = $(word 3,$(PAT_SPLIT))
+ IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
+ IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
+-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
++@AMDEP_FALSE@M_DEPS =
+ M_SIZE = -DN=$(PAT_N)
+ M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
+ M_FILE = $(PAT_BASE)_n.c
diff --git a/user/openjdk7/gcc-201-cilkrts.patch b/user/openjdk7/gcc-201-cilkrts.patch
new file mode 100644
index 000000000..4aac10d6d
--- /dev/null
+++ b/user/openjdk7/gcc-201-cilkrts.patch
@@ -0,0 +1,59 @@
+From 594e3c1ab576daddeb86015efc8b1677020b1878 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 24 Oct 2015 20:39:30 +0000
+Subject: [PATCH 1/6] cilkrts
+
+---
+ libcilkrts/runtime/os-unix.c | 22 +++++++---------------
+ 1 file changed, 7 insertions(+), 15 deletions(-)
+
+diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
+index cb582dd..e43d7d5 100644
+--- a/libcilkrts/runtime/os-unix.c
++++ b/libcilkrts/runtime/os-unix.c
+@@ -51,6 +51,7 @@
+ #if defined __linux__
+ # include <sys/sysinfo.h>
+ # include <sys/syscall.h>
++# include <sched.h>
+ #elif defined __APPLE__
+ # include <sys/sysctl.h>
+ // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
+@@ -400,28 +401,19 @@ COMMON_SYSDEP void __cilkrts_sleep(void)
+
+ COMMON_SYSDEP void __cilkrts_yield(void)
+ {
+-#if __APPLE__ || __FreeBSD__ || __VXWORKS__
+- // On MacOS, call sched_yield to yield quantum. I'm not sure why we
+- // don't do this on Linux also.
+- sched_yield();
+-#elif defined(__DragonFly__)
+- // On DragonFly BSD, call sched_yield to yield quantum.
+- sched_yield();
+-#elif defined(__MIC__)
++#if defined(__MIC__)
+ // On MIC, pthread_yield() really trashes things. Arch's measurements
+ // showed that calling _mm_delay_32() (or doing nothing) was a better
+ // option. Delaying 1024 clock cycles is a reasonable compromise between
+ // giving up the processor and latency starting up when work becomes
+ // available
+ _mm_delay_32(1024);
+-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
+- // On Android and Solaris, call sched_yield to yield quantum. I'm not
+- // sure why we don't do this on Linux also.
+- sched_yield();
+-#else
+- // On Linux, call pthread_yield (which in turn will call sched_yield)
+- // to yield quantum.
++#elif defined(__sun__) && !defined(__svr4__)
++ // On old SunOS call pthread_yield to yield a quantum.
+ pthread_yield();
++#else
++ // On other platforms call sched_yield to yield a quantum.
++ sched_yield();
+ #endif
+ }
+
+--
+2.8.1
+
diff --git a/user/openjdk7/gcc-203-libgcc_s.patch b/user/openjdk7/gcc-203-libgcc_s.patch
new file mode 100644
index 000000000..c74351c71
--- /dev/null
+++ b/user/openjdk7/gcc-203-libgcc_s.patch
@@ -0,0 +1,56 @@
+From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 24 Oct 2015 20:09:53 +0000
+Subject: [PATCH 3/6] libgcc_s
+
+---
+ gcc/config/i386/i386.c | 4 ++--
+ libgcc/config/i386/cpuinfo.c | 6 +++---
+ libgcc/config/i386/t-linux | 2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 3d044e8..82523e1 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
+ {
+ case IX86_BUILTIN_CPU_INIT:
+ {
+- /* Make it call __cpu_indicator_init in libgcc. */
++ /* Make it call __cpu_indicator_init_local in libgcc.a. */
+ tree call_expr, fndecl, type;
+ type = build_function_type_list (integer_type_node, NULL_TREE);
+- fndecl = build_fn_decl ("__cpu_indicator_init", type);
++ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
+ call_expr = build_call_expr (fndecl, 0);
+ return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
+ }
+diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
+index 8c2248d..6c82f15 100644
+--- a/libgcc/config/i386/cpuinfo.c
++++ b/libgcc/config/i386/cpuinfo.c
+@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
+ return 0;
+ }
+
+-#if defined SHARED && defined USE_ELF_SYMVER
+-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
+-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
++#ifndef SHARED
++int __cpu_indicator_init_local (void)
++ __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif
+diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
+index 11bb46e..4f47f7b 100644
+--- a/libgcc/config/i386/t-linux
++++ b/libgcc/config/i386/t-linux
+@@ -3,4 +3,4 @@
+ # t-slibgcc-elf-ver and t-linux
+ SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
+
+-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
++HOST_LIBGCC2_CFLAGS += -mlong-double-80
+--
+2.8.1
+
diff --git a/user/openjdk7/gcc-204-linux_libc_has_function.patch b/user/openjdk7/gcc-204-linux_libc_has_function.patch
new file mode 100644
index 000000000..2dcedc3a7
--- /dev/null
+++ b/user/openjdk7/gcc-204-linux_libc_has_function.patch
@@ -0,0 +1,25 @@
+From edec78452d693fb524daa9a6efd45c850b27b25c Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Fri, 6 Nov 2015 23:59:20 +0000
+Subject: [PATCH 4/6] linux_libc_has_function
+
+---
+ gcc/config/linux.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gcc/config/linux.c b/gcc/config/linux.c
+index 250296b..16c3768 100644
+--- a/gcc/config/linux.c
++++ b/gcc/config/linux.c
+@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
+ bool
+ linux_libc_has_function (enum function_class fn_class)
+ {
+- if (OPTION_GLIBC)
++ if (OPTION_GLIBC || OPTION_MUSL)
+ return true;
+ if (OPTION_BIONIC)
+ if (fn_class == function_c94
+--
+2.8.1
+
diff --git a/user/openjdk7/gcc-205-nopie.patch b/user/openjdk7/gcc-205-nopie.patch
new file mode 100644
index 000000000..e3da94d10
--- /dev/null
+++ b/user/openjdk7/gcc-205-nopie.patch
@@ -0,0 +1,75 @@
+From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 7 Nov 2015 02:08:05 +0000
+Subject: [PATCH 5/6] nopie
+
+---
+ gcc/configure | 27 +++++++++++++++++++++++++++
+ gcc/configure.ac | 13 +++++++++++++
+ 2 files changed, 40 insertions(+)
+
+diff --git a/gcc/configure b/gcc/configure
+index 1c6e340..7e8b5d6 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -29390,6 +29390,33 @@ fi
+ $as_echo "$gcc_cv_no_pie" >&6; }
+ if test "$gcc_cv_no_pie" = "yes"; then
+ NO_PIE_FLAG="-no-pie"
++else
++ # Check if -nopie works.
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
++$as_echo_n "checking for -nopie option... " >&6; }
++if test "${gcc_cv_nopie+set}" = set; then :
++ $as_echo_n "(cached) " >&6
++else
++ saved_LDFLAGS="$LDFLAGS"
++ LDFLAGS="$LDFLAGS -nopie"
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++int main(void) {return 0;}
++_ACEOF
++if ac_fn_cxx_try_link "$LINENO"; then :
++ gcc_cv_nopie=yes
++else
++ gcc_cv_nopie=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++ conftest$ac_exeext conftest.$ac_ext
++ LDFLAGS="$saved_LDFLAGS"
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
++$as_echo "$gcc_cv_nopie" >&6; }
++ if test "$gcc_cv_nopie" = "yes"; then
++ NO_PIE_FLAG="-nopie"
++ fi
+ fi
+
+
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 6c1dcd9..0ca7647 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option],
+ LDFLAGS="$saved_LDFLAGS"])
+ if test "$gcc_cv_no_pie" = "yes"; then
+ NO_PIE_FLAG="-no-pie"
++else
++ # Check if -nopie works.
++ AC_CACHE_CHECK([for -nopie option],
++ [gcc_cv_nopie],
++ [saved_LDFLAGS="$LDFLAGS"
++ LDFLAGS="$LDFLAGS -nopie"
++ AC_LINK_IFELSE([int main(void) {return 0;}],
++ [gcc_cv_nopie=yes],
++ [gcc_cv_nopie=no])
++ LDFLAGS="$saved_LDFLAGS"])
++ if test "$gcc_cv_nopie" = "yes"; then
++ NO_PIE_FLAG="-nopie"
++ fi
+ fi
+ AC_SUBST([NO_PIE_FLAG])
+
+--
+2.8.1
+
diff --git a/user/openjdk7/gcc-207-static-pie.patch b/user/openjdk7/gcc-207-static-pie.patch
new file mode 100644
index 000000000..9355c584b
--- /dev/null
+++ b/user/openjdk7/gcc-207-static-pie.patch
@@ -0,0 +1,40 @@
+diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
+index b0bf40a..d4b56fe 100644
+--- a/gcc/config/gnu-user.h
++++ b/gcc/config/gnu-user.h
+@@ -51,10 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ #if defined HAVE_LD_PIE
+ #define GNU_USER_TARGET_STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:gcrt1.o%s;: \
+- %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \
+- crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \
++ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \
++ crti.o%s %{shared:crtbeginS.o%s;: \
+ %{" PIE_SPEC ":crtbeginS.o%s} \
+- %{" NO_PIE_SPEC ":crtbegin.o%s}} \
++ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \
+ %{fvtable-verify=none:%s; \
+ fvtable-verify=preinit:vtv_start_preinit.o%s; \
+ fvtable-verify=std:vtv_start.o%s} \
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index 0208d61..731564e 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -870,7 +870,7 @@ proper position among the other output files. */
+ #endif
+
+ #ifdef ENABLE_DEFAULT_PIE
+-#define NO_PIE_SPEC "no-pie|static"
++#define NO_PIE_SPEC "no-pie"
+ #define PIE_SPEC NO_PIE_SPEC "|r|shared:;"
+ #define NO_FPIE1_SPEC "fno-pie"
+ #define FPIE1_SPEC NO_FPIE1_SPEC ":;"
+@@ -916,7 +916,7 @@ proper position among the other output files. */
+ #ifndef LINK_PIE_SPEC
+ #ifdef HAVE_LD_PIE
+ #ifndef LD_PIE_SPEC
+-#define LD_PIE_SPEC "-pie"
++#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic}"
+ #endif
+ #else
+ #define LD_PIE_SPEC ""
diff --git a/user/openjdk7/gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch b/user/openjdk7/gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch
new file mode 100644
index 000000000..241957871
--- /dev/null
+++ b/user/openjdk7/gcc-300-main-gcc-add-musl-s390x-dynamic-linker.patch
@@ -0,0 +1,32 @@
+From be841c16dd544553c67faac79bd4cc3cd10a1dc0 Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Mon, 21 Nov 2016 01:42:16 +0700
+Subject: [PATCH] main/gcc: add musl s390x dynamic linker
+
+---
+ gcc/config/s390/linux.h | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
+index 1e3ed35..a244214 100644
+--- a/gcc/config/s390/linux.h
++++ b/gcc/config/s390/linux.h
+@@ -63,6 +63,15 @@ along with GCC; see the file COPYING3. If not see
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
+
++#undef MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-s390x.so.1"
++#undef MUSL_DYNAMIC_LINKER32
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390x.so.1"
++#undef MUSL_DYNAMIC_LINKER64
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
++#undef MUSL_DYNAMIC_LINKERX32
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-s390x.so.1"
++
+ #undef LINK_SPEC
+ #define LINK_SPEC \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
+--
+2.10.2
+
diff --git a/user/openjdk7/gcc-310-build-gcj-s390x.patch b/user/openjdk7/gcc-310-build-gcj-s390x.patch
new file mode 100644
index 000000000..1e522ee15
--- /dev/null
+++ b/user/openjdk7/gcc-310-build-gcj-s390x.patch
@@ -0,0 +1,28 @@
+From 697a7ba791fce2ffab2ed723d909a89684019e3d Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Sun, 19 Feb 2017 17:03:33 +0000
+Subject: [PATCH] main/gcc : when building gcc-java on s390x, libgcj.so
+ complains about undefined reference to __data_start. Using
+ SEARCH_FOR_DATA_START instead solved it. Credit to Andrew Haley at RedHat.
+
+---
+ boehm-gc/include/private/gcconfig.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
+index 4ca6a80..a15fff6 100644
+--- a/boehm-gc/include/private/gcconfig.h
++++ b/boehm-gc/include/private/gcconfig.h
+@@ -1837,8 +1837,7 @@
+ # define OS_TYPE "LINUX"
+ # define LINUX_STACKBOTTOM
+ # define DYNAMIC_LOADING
+- extern int __data_start[];
+-# define DATASTART ((ptr_t)(__data_start))
++# define SEARCH_FOR_DATA_START
+ extern int _end[];
+ # define DATAEND (_end)
+ # define CACHE_LINE_SIZE 256
+--
+2.11.1
+
diff --git a/user/openjdk7/gcc-320-libffi-gnulinux.patch b/user/openjdk7/gcc-320-libffi-gnulinux.patch
new file mode 100644
index 000000000..b3b4fc931
--- /dev/null
+++ b/user/openjdk7/gcc-320-libffi-gnulinux.patch
@@ -0,0 +1,13 @@
+diff --git a/libffi/closures.c.orig b/libffi/closures.c
+index 721ff00..22a699c 100644
+--- a/libffi/src/closures.c.orig
++++ b/libffi/src/closures.c
+@@ -34,7 +34,7 @@
+ #include <ffi_common.h>
+
+ #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
+-# if __gnu_linux__ && !defined(__ANDROID__)
++# if __linux__ && !defined(__ANDROID__)
+ /* This macro indicates it may be forbidden to map anonymous memory
+ with both write and execute permission. Code compiled when this
+ option is defined will attempt to map such pages once, but if it
diff --git a/user/openjdk7/gcc-330-gccgo-link-to-ucontext.patch b/user/openjdk7/gcc-330-gccgo-link-to-ucontext.patch
new file mode 100644
index 000000000..8aa60ca54
--- /dev/null
+++ b/user/openjdk7/gcc-330-gccgo-link-to-ucontext.patch
@@ -0,0 +1,11 @@
+--- gcc-6.4.0/Makefile.in.old 2018-06-21 22:16:35.167781541 -0500
++++ gcc-6.4.0/Makefile.in 2018-06-22 00:36:13.849486086 -0500
+@@ -41332,7 +41332,7 @@
+ esac; \
+ module_srcdir=libgo; \
+ rm -f no-such-file || : ; \
+- CONFIG_SITE=no-such-file $(SHELL) \
++ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
+ $$s/$$module_srcdir/configure \
+ --srcdir=$${topdir}/$$module_srcdir \
+ $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
diff --git a/user/openjdk7/gcc-331-gccgo-use-real-off_t-type.patch b/user/openjdk7/gcc-331-gccgo-use-real-off_t-type.patch
new file mode 100644
index 000000000..1c8c43e9e
--- /dev/null
+++ b/user/openjdk7/gcc-331-gccgo-use-real-off_t-type.patch
@@ -0,0 +1,30 @@
+--- gcc-6.4.0/libgo/go/syscall/libcall_linux.go.old 2016-02-03 15:58:02.419872000 -0600
++++ gcc-6.4.0/libgo/go/syscall/libcall_linux.go 2018-06-22 00:56:31.478280552 -0500
+@@ -355,19 +355,19 @@
+ //sys Setxattr(path string, attr string, data []byte, flags int) (err error)
+ //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
+
+-//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
+-//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
++//sys splice(rfd int, roff *_off_t, wfd int, woff *_off_t, len int, flags int) (n int64, err error)
++//splice(rfd _C_int, roff *_off_t, wfd _C_int, woff *_off_t, len Size_t, flags _C_uint) Ssize_t
+ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
+- var lroff _loff_t
+- var plroff *_loff_t
++ var lroff _off_t
++ var plroff *_off_t
+ if roff != nil {
+- lroff = _loff_t(*roff)
++ lroff = _off_t(*roff)
+ plroff = &lroff
+ }
+- var lwoff _loff_t
+- var plwoff *_loff_t
++ var lwoff _off_t
++ var plwoff *_off_t
+ if woff != nil {
+- lwoff = _loff_t(*woff)
++ lwoff = _off_t(*woff)
+ plwoff = &lwoff
+ }
+ n, err = splice(rfd, plroff, wfd, plwoff, len, flags)
diff --git a/user/openjdk7/gcc-332-gccgo-remove-ustat.patch b/user/openjdk7/gcc-332-gccgo-remove-ustat.patch
new file mode 100644
index 000000000..90aa65ad7
--- /dev/null
+++ b/user/openjdk7/gcc-332-gccgo-remove-ustat.patch
@@ -0,0 +1,190 @@
+From bdead75ea02fa852a559f35b41453df0c47c9a66 Mon Sep 17 00:00:00 2001
+From: Ian Lance Taylor <iant@golang.org>
+Date: Fri, 22 Jun 2018 06:24:48 -0700
+Subject: [PATCH] syscall: remove Ustat
+
+glibc 2.28 removes ustat.h and the ustat function entirely, which
+breaks syscall.Ustat.
+
+Updates golang/go#25990
+
+Change-Id: I430802c86389a02cb4a0cd6caff36fa542d98f2f
+Reviewed-on: https://go-review.googlesource.com/120535
+Reviewed-by: Than McIntosh <thanm@google.com>
+---
+ libgo/config.h.in | 3 ---
+ libgo/configure | 33 ---------------------------------
+ libgo/configure.ac | 18 ------------------
+ libgo/go/syscall/libcall_linux_ustat.go | 12 ------------
+ libgo/mksysinfo.sh | 14 --------------
+ libgo/sysinfo.c | 3 ---
+ 6 files changed, 83 deletions(-)
+ delete mode 100644 libgo/go/syscall/libcall_linux_ustat.go
+
+diff --git a/libgo/config.h.in b/libgo/config.h.in
+index 57560cd0..de57d0cc 100644
+--- a/libgo/config.h.in
++++ b/libgo/config.h.in
+@@ -343,9 +343,6 @@
+ /* Define to 1 if you have the `unshare' function. */
+ #undef HAVE_UNSHARE
+
+-/* Define to 1 if you have the <ustat.h> header file and it works. */
+-#undef HAVE_USTAT_H
+-
+ /* Define to 1 if you have the `utimensat' function. */
+ #undef HAVE_UTIMENSAT
+
+diff --git a/libgo/configure b/libgo/configure
+index 66942eda..7166f940 100755
+--- a/libgo/configure
++++ b/libgo/configure
+@@ -14760,39 +14760,6 @@ fi
+ done
+
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <ustat.h> can be used" >&5
+-$as_echo_n "checking whether <ustat.h> can be used... " >&6; }
+-if test "${libgo_cv_c_ustat_h+set}" = set; then :
+- $as_echo_n "(cached) " >&6
+-else
+- CFLAGS_hold=$CFLAGS
+-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-#include <sys/types.h>
+-#ifdef HAVE_LINUX_FILTER_H
+-#include <linux/filter.h>
+-#endif
+-#include <ustat.h>
+-
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+- libgo_cv_c_ustat_h=yes
+-else
+- libgo_cv_c_ustat_h=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-CFLAGS=$CFLAGS_hold
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_ustat_h" >&5
+-$as_echo "$libgo_cv_c_ustat_h" >&6; }
+-if test $libgo_cv_c_ustat_h = yes; then
+-
+-$as_echo "#define HAVE_USTAT_H 1" >>confdefs.h
+-
+-fi
+-
+ if test "$ac_cv_header_sys_mman_h" = yes; then
+ HAVE_SYS_MMAN_H_TRUE=
+ HAVE_SYS_MMAN_H_FALSE='#'
+diff --git a/libgo/configure.ac b/libgo/configure.ac
+index 3cee2c0f..1c192752 100644
+--- a/libgo/configure.ac
++++ b/libgo/configure.ac
+@@ -537,24 +537,6 @@ AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h
+ #endif
+ ])
+
+-AC_CACHE_CHECK([whether <ustat.h> can be used],
+-[libgo_cv_c_ustat_h],
+-[CFLAGS_hold=$CFLAGS
+-CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS"
+-AC_COMPILE_IFELSE(
+-[AC_LANG_SOURCE([
+-#include <sys/types.h>
+-#ifdef HAVE_LINUX_FILTER_H
+-#include <linux/filter.h>
+-#endif
+-#include <ustat.h>
+-])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no])
+-CFLAGS=$CFLAGS_hold])
+-if test $libgo_cv_c_ustat_h = yes; then
+- AC_DEFINE(HAVE_USTAT_H, 1,
+- [Define to 1 if you have the <ustat.h> header file and it works.])
+-fi
+-
+ AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
+
+ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr)
+diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
+index 92ecb479..48bc71db 100755
+--- a/libgo/mksysinfo.sh
++++ b/libgo/mksysinfo.sh
+@@ -1164,20 +1164,6 @@ grep '^type _sysinfo ' gen-sysinfo.go | \
+ -e 's/mem_unit/Unit/' \
+ >> ${OUT}
+
+-# The ustat struct.
+-grep '^type _ustat ' gen-sysinfo.go | \
+- sed -e 's/_ustat/Ustat_t/' \
+- -e 's/f_tfree/Tfree/' \
+- -e 's/f_tinode/Tinoe/' \
+- -e 's/f_fname/Fname/' \
+- -e 's/f_fpack/Fpack/' \
+- >> ${OUT}
+-# Force it to be defined, as on some older GNU/Linux systems the
+-# header file fails when using with <linux/filter.h>.
+-if ! grep 'type _ustat ' gen-sysinfo.go >/dev/null 2>&1; then
+- echo 'type Ustat_t struct { Tfree int32; Tinoe uint64; Fname [5+1]int8; Fpack [5+1]int8; }' >> ${OUT}
+-fi
+-
+ # The utimbuf struct.
+ grep '^type _utimbuf ' gen-sysinfo.go | \
+ sed -e 's/_utimbuf/Utimbuf/' \
+--- gcc-6.4.0/libgo/Makefile.am.old 2016-02-03 15:58:02.419872000 -0600
++++ gcc-6.4.0/libgo/Makefile.am 2018-06-23 02:55:45.772611885 -0500
+@@ -1,4 +1,3 @@
+-# Makefile.am -- Go library Makefile.
+
+ # Copyright 2009 The Go Authors. All rights reserved.
+ # Use of this source code is governed by a BSD-style
+@@ -1989,17 +1988,6 @@
+ syscall_lsf_file =
+ endif
+
+-# GNU/Linux specific ustat support.
+-if LIBGO_IS_LINUX
+-if LIBGO_IS_ARM64
+-syscall_ustat_file =
+-else
+-syscall_ustat_file = go/syscall/libcall_linux_ustat.go
+-endif
+-else
+-syscall_ustat_file =
+-endif
+-
+ # GNU/Linux specific utimesnano support.
+ if LIBGO_IS_LINUX
+ syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go
+@@ -2051,7 +2039,6 @@
+ $(syscall_uname_file) \
+ $(syscall_netlink_file) \
+ $(syscall_lsf_file) \
+- $(syscall_ustat_file) \
+ $(syscall_utimesnano_file) \
+ $(GO_LIBCALL_OS_FILE) \
+ $(GO_LIBCALL_OS_ARCH_FILE) \
+--- gcc-6.4.0/libgo/Makefile.in.old 2016-02-03 15:58:02.419872000 -0600
++++ gcc-6.4.0/libgo/Makefile.in 2018-06-23 02:56:04.842611681 -0500
+@@ -2080,11 +2080,6 @@
+
+ # GNU/Linux specific socket filters.
+ @LIBGO_IS_LINUX_TRUE@syscall_lsf_file = go/syscall/lsf_linux.go
+-@LIBGO_IS_ARM64_FALSE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file = go/syscall/libcall_linux_ustat.go
+-
+-# GNU/Linux specific ustat support.
+-@LIBGO_IS_ARM64_TRUE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file =
+-@LIBGO_IS_LINUX_FALSE@syscall_ustat_file =
+ @LIBGO_IS_LINUX_FALSE@syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go
+
+ # GNU/Linux specific utimesnano support.
+@@ -2122,7 +2117,6 @@
+ $(syscall_uname_file) \
+ $(syscall_netlink_file) \
+ $(syscall_lsf_file) \
+- $(syscall_ustat_file) \
+ $(syscall_utimesnano_file) \
+ $(GO_LIBCALL_OS_FILE) \
+ $(GO_LIBCALL_OS_ARCH_FILE) \
diff --git a/user/openjdk7/gcc-ada-aarch64-multiarch.patch b/user/openjdk7/gcc-ada-aarch64-multiarch.patch
new file mode 100644
index 000000000..ac60b6f6a
--- /dev/null
+++ b/user/openjdk7/gcc-ada-aarch64-multiarch.patch
@@ -0,0 +1,16 @@
+--- gcc-6.4.0/gcc/ada/gcc-interface/Makefile.in.orig
++++ gcc-6.4.0/gcc/ada/gcc-interface/Makefile.in
+@@ -2042,13 +2042,8 @@
+ system.ads<system-linux-x86_64.ads
+ ## ^^ Note the above is a pretty-close placeholder.
+
+- ifneq (,$(or $(filter aarch64-linux-gnu, $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multiarch)), $(filter ../lib64, $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory))))
+ LIBGNAT_TARGET_PAIRS = \
+ $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
+- else
+- LIBGNAT_TARGET_PAIRS = \
+- $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
+- endif
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
diff --git a/user/openjdk7/gcc-ada-fixes.patch b/user/openjdk7/gcc-ada-fixes.patch
new file mode 100644
index 000000000..ba4ea42b4
--- /dev/null
+++ b/user/openjdk7/gcc-ada-fixes.patch
@@ -0,0 +1,35 @@
+--- gcc-6.1.0.orig/gcc/ada/cal.c
++++ gcc-6.1.0/gcc/ada/cal.c
+@@ -49,6 +49,7 @@
+ #include <time.h>
+ #else
+ #include <sys/time.h>
++#include <time.h>
+ #endif
+
+ #ifdef __MINGW32__
+--- gcc-6.1.0.orig/gcc/ada/terminals.c
++++ gcc-6.1.0/gcc/ada/terminals.c
+@@ -1068,13 +1068,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 (BSD) && !defined (__APPLE__) \
+- && !defined (__rtems__)
+-# include <termio.h>
+-#endif
+-
+ #include <sys/ioctl.h>
+ #include <termios.h>
+ #include <fcntl.h>
+@@ -1169,7 +1162,7 @@
+ char *slave_name = NULL;
+
+ #ifdef USE_GETPT
+- master_fd = getpt ();
++ master_fd = posix_openpt (O_RDWR);
+ #elif defined (USE_OPENPTY)
+ status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
+ #elif defined (USE_CLONE_DEVICE)
diff --git a/user/openjdk7/gcc-ada-musl.patch b/user/openjdk7/gcc-ada-musl.patch
new file mode 100644
index 000000000..464c3d57d
--- /dev/null
+++ b/user/openjdk7/gcc-ada-musl.patch
@@ -0,0 +1,137 @@
+diff -rup gcc-5.1.0/gcc.orig/ada/adaint.c gcc-5.1.0/gcc/ada/adaint.c
+--- gcc-5.1.0/gcc.orig/ada/adaint.c 2015-02-20 11:48:57.000000000 +0000
++++ gcc-5.1.0/gcc/ada/adaint.c 2015-06-02 10:47:51.672767476 +0000
+@@ -70,6 +70,11 @@
+ #include <sys/param.h>
+ #include <sys/pstat.h>
+ #endif
++
++#if defined (linux)
++#define _GNU_SOURCE 1
++#include <sched.h>
++#endif
+
+ #ifdef __PikeOS__
+ #define __BSD_VISIBLE 1
+@@ -3057,8 +3062,6 @@ __gnat_lwp_self (void)
+ 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. */
+@@ -3067,7 +3070,7 @@ __gnat_lwp_self (void)
+
+ /* Dynamic cpu sets */
+
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count)
+ {
+ return CPU_ALLOC (count);
+@@ -3080,33 +3083,33 @@ __gnat_cpu_alloc_size (size_t count)
+ }
+
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__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)
++__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)
++__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 /* !CPU_ALLOC */
+
+ /* Static cpu sets */
+
+-cpu_set_t *
++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
+@@ -3116,23 +3119,23 @@ __gnat_cpu_alloc_size (size_t count ATTR
+ }
+
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__gnat_cpu_free (void *set)
+ {
+ free (set);
+ }
+
+ void
+-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++__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)
++__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 /* !CPU_ALLOC */
+ #endif /* linux */
+diff -rup gcc-5.1.0/gcc.orig/ada/adaint.h gcc-5.1.0/gcc/ada/adaint.h
+--- gcc-5.1.0/gcc.orig/ada/adaint.h 2015-01-27 17:20:27.000000000 +0000
++++ gcc-5.1.0/gcc/ada/adaint.h 2015-06-02 10:47:23.188910894 +0000
+@@ -287,13 +287,11 @@ extern void *__gnat_lwp_self (voi
+
+ /* 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 -rup gcc-5.1.0/gcc.orig/ada/gcc-interface/Makefile.in gcc-5.1.0/gcc/ada/gcc-interface/Makefile.in
+--- gcc-5.1.0/gcc.orig/ada/gcc-interface/Makefile.in 2015-04-09 20:29:28.000000000 +0000
++++ gcc-5.1.0/gcc/ada/gcc-interface/Makefile.in 2015-06-02 10:47:23.188910894 +0000
+@@ -1910,7 +1910,7 @@ ifeq ($(strip $(filter-out powerpc% linu
+ endif
+
+ # ARM linux, GNU eabi
+-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
++ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
diff --git a/user/openjdk7/gcc-ada-shared.patch b/user/openjdk7/gcc-ada-shared.patch
new file mode 100644
index 000000000..6f1c16aff
--- /dev/null
+++ b/user/openjdk7/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/user/openjdk7/gcc-add-classic_table-support.patch b/user/openjdk7/gcc-add-classic_table-support.patch
new file mode 100644
index 000000000..e74929302
--- /dev/null
+++ b/user/openjdk7/gcc-add-classic_table-support.patch
@@ -0,0 +1,152 @@
+--- gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_base.h.old 2016-01-04 08:30:50.652828000 -0600
++++ gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_base.h 2017-10-16 07:51:26.226276759 -0500
+@@ -40,19 +40,27 @@
+
+ // NB: Offsets into ctype<char>::_M_table force a particular size
+ // on the mask type. Because of this, we don't use an enum.
+- typedef unsigned int mask;
+- static const mask upper = 1 << 0;
+- static const mask lower = 1 << 1;
+- static const mask alpha = 1 << 2;
+- static const mask digit = 1 << 3;
+- static const mask xdigit = 1 << 4;
+- static const mask space = 1 << 5;
+- static const mask print = 1 << 6;
+- static const mask graph = (1 << 2) | (1 << 3) | (1 << 9); // alnum|punct
+- static const mask cntrl = 1 << 8;
+- static const mask punct = 1 << 9;
+- static const mask alnum = (1 << 2) | (1 << 3); // alpha|digit
+- static const mask blank = 1 << 10;
++ typedef unsigned short int mask;
++/* horrible ugly code from glibc */
++#ifndef _ISbit
++# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
++# define _ISbit(i) (1 << (i))
++# else
++# define _ISbit(i) (i < 8 ? (1 << i << 8) : (1 << i >> 8))
++# endif
++#endif
++ static const mask upper = _ISbit(0);
++ static const mask lower = _ISbit(1);
++ static const mask alpha = _ISbit(2);
++ static const mask digit = _ISbit(3);
++ static const mask xdigit = _ISbit(4);
++ static const mask space = _ISbit(5);
++ static const mask print = _ISbit(6);
++ static const mask graph = _ISbit(7);
++ static const mask cntrl = _ISbit(9);
++ static const mask punct = _ISbit(10);
++ static const mask alnum = _ISbit(11);
++ static const mask blank = _ISbit(8);
+ };
+
+ _GLIBCXX_END_NAMESPACE_VERSION
+--- gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_configure_char.cc.old 2016-01-04 08:30:50.652828000 -0600
++++ gcc-6.4.0/libstdc++-v3/config/os/generic/ctype_configure_char.cc 2017-10-16 08:37:57.986260218 -0500
+@@ -40,7 +40,105 @@
+
+ const ctype_base::mask*
+ ctype<char>::classic_table() throw()
+- { return 0; }
++ {
++ static ctype_base::mask mask[256] = {
++ cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
++ cntrl, cntrl | blank | space, cntrl | space, cntrl | space,
++ cntrl | space, cntrl | space, cntrl, cntrl,
++ cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
++ cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl, cntrl,
++ print | space | blank,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct, print | punct,
++ print | punct,
++ print | alnum | digit | xdigit, print | alnum | digit | xdigit,
++ print | alnum | digit | xdigit, print | alnum | digit | xdigit,
++ print | alnum | digit | xdigit, print | alnum | digit | xdigit,
++ print | alnum | digit | xdigit, print | alnum | digit | xdigit,
++ print | alnum | digit | xdigit, print | alnum | digit | xdigit,
++ print | punct, print | punct,
++ print, print, print,
++ print | punct, print,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | xdigit | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | alnum | alpha | upper,
++ print | punct, print | punct, print | punct,
++ print | punct, print | punct, print | punct,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | xdigit | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | alnum | alpha | lower,
++ print | punct, print | punct, print | punct, print | punct,
++ cntrl,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0
++ };
++ return mask;
++ }
+
+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
+ size_t __refs)
diff --git a/user/openjdk7/gcc-boehm-gc-musl.patch b/user/openjdk7/gcc-boehm-gc-musl.patch
new file mode 100644
index 000000000..2f106cba1
--- /dev/null
+++ b/user/openjdk7/gcc-boehm-gc-musl.patch
@@ -0,0 +1,62 @@
+--- 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 */
+--- gcc-4.8.2/boehm-gc/dyn_load.c.orig 2014-02-17 14:13:09.519850231 +0200
++++ gcc-4.8.2/boehm-gc/dyn_load.c 2014-02-17 14:14:27.906093514 +0200
+@@ -459,9 +459,7 @@
+ /* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
+ /* versions. Thanks to Jakub Jelinek for most of the code. */
+
+-# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
+- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++# if (defined(LINUX) || defined (__GLIBC__))
+
+ /* We have the header files for a glibc that includes dl_iterate_phdr. */
+ /* It may still not be available in the library on the target system. */
+--- gcc-4.8.2/boehm-gc/include/private/gcconfig.h.orig 2014-02-17 14:14:36.026049422 +0200
++++ gcc-4.8.2/boehm-gc/include/private/gcconfig.h 2014-02-17 14:17:11.345207887 +0200
+@@ -684,7 +684,7 @@
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+ # include <features.h>
+-# if defined(__GLIBC__)&& __GLIBC__>=2
++# if 1
+ # define SEARCH_FOR_DATA_START
+ # else /* !GLIBC2 */
+ extern char **__environ;
+@@ -1147,7 +1147,7 @@
+ # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
+ # endif
+ # include <features.h>
+-# if defined(__GLIBC__) && __GLIBC__ >= 2
++# if 1
+ # define SEARCH_FOR_DATA_START
+ # else
+ extern char **__environ;
+@@ -1367,7 +1367,7 @@
+ # define HBLKSIZE 4096
+ # endif
+ # define USE_GENERIC_PUSH_REGS
+-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
++# if 1
+ # define LINUX_STACKBOTTOM
+ # else
+ # define STACKBOTTOM 0x80000000
+@@ -1858,7 +1858,7 @@
+ # ifdef __ELF__
+ # define DYNAMIC_LOADING
+ # include <features.h>
+-# if defined(__GLIBC__) && __GLIBC__ >= 2
++# if 1
+ # define SEARCH_FOR_DATA_START
+ # else
+ extern char **__environ;
diff --git a/user/openjdk7/gcc-fix-cxxflags-passing.patch b/user/openjdk7/gcc-fix-cxxflags-passing.patch
new file mode 100644
index 000000000..8eb1de77d
--- /dev/null
+++ b/user/openjdk7/gcc-fix-cxxflags-passing.patch
@@ -0,0 +1,10 @@
+--- gcc-4.8.1/Makefile.in.orig
++++ gcc-4.8.1/Makefile.in
+@@ -169,6 +169,7 @@
+ # built for the build system to override those in BASE_FLAGS_TO_PASSS.
+ EXTRA_BUILD_FLAGS = \
+ CFLAGS="$(CFLAGS_FOR_BUILD)" \
++ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+
+ # This is the list of directories to built for the host system.
diff --git a/user/openjdk7/gcc-fix-gcj-iconv-musl.patch b/user/openjdk7/gcc-fix-gcj-iconv-musl.patch
new file mode 100644
index 000000000..b0015751e
--- /dev/null
+++ b/user/openjdk7/gcc-fix-gcj-iconv-musl.patch
@@ -0,0 +1,120 @@
+--- gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc.orig 2014-02-18 18:46:14.897880526 +0200
++++ gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc 2014-02-18 18:50:08.766613550 +0200
+@@ -24,6 +24,13 @@
+
+ #ifdef HAVE_ICONV
+ #include <iconv.h>
++#include <endian.h>
++
++#if __BYTE_ORDER == __BIG_ENDIAN
++#define UCS2_CHARSET "UCS-2BE"
++#else
++#define UCS2_CHARSET "UCS-2LE"
++#endif
+
+ template<typename T>
+ static inline size_t
+@@ -45,7 +52,7 @@
+ _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
+ buffer[len] = '\0';
+
+- iconv_t h = iconv_open ("UCS-2", buffer);
++ iconv_t h = iconv_open (UCS2_CHARSET, buffer);
+ if (h == (iconv_t) -1)
+ throw new ::java::io::UnsupportedEncodingException (encoding);
+
+@@ -99,18 +106,6 @@
+ throw new ::java::io::CharConversionException ();
+ }
+
+- if (iconv_byte_swap)
+- {
+- size_t max = (old_out - outavail) / sizeof (jchar);
+- for (size_t i = 0; i < max; ++i)
+- {
+- // Byte swap.
+- jchar c = (((out[outpos + i] & 0xff) << 8)
+- | ((out[outpos + i] >> 8) & 0xff));
+- outbuf[i] = c;
+- }
+- }
+-
+ inpos += old_in - inavail;
+ return (old_out - outavail) / sizeof (jchar);
+ #else /* HAVE_ICONV */
+@@ -145,7 +140,7 @@
+ _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
+ buffer[len] = '\0';
+
+- iconv_t h = iconv_open (buffer, "UCS-2");
++ iconv_t h = iconv_open (buffer, UCS2_CHARSET);
+ if (h == (iconv_t) -1)
+ throw new ::java::io::UnsupportedEncodingException (encoding);
+
+@@ -187,20 +182,6 @@
+ char *inbuf = (char *) &chars[inpos];
+ char *outbuf = (char *) &out[count];
+
+- if (iconv_byte_swap)
+- {
+- // Ugly performance penalty -- don't use losing systems!
+- temp_buffer = (jchar *) _Jv_Malloc (inlength * sizeof (jchar));
+- for (int i = 0; i < inlength; ++i)
+- {
+- // Byte swap.
+- jchar c = (((chars[inpos + i] & 0xff) << 8)
+- | ((chars[inpos + i] >> 8) & 0xff));
+- temp_buffer[i] = c;
+- }
+- inbuf = (char *) temp_buffer;
+- }
+-
+ size_t loop_old_in = old_in;
+ while (1)
+ {
+@@ -252,44 +233,7 @@
+ jboolean
+ gnu::gcj::convert::IOConverter::iconv_init (void)
+ {
+- // Some versions of iconv() always return their UCS-2 results in
+- // big-endian order, and they also require UCS-2 inputs to be in
+- // big-endian order. For instance, glibc 2.1.3 does this. If the
+- // UTF-8=>UCS-2 iconv converter has this feature, then we assume
+- // that all UCS-2 converters do. (This might not be the best
+- // heuristic, but is is all we've got.)
+- jboolean result = false;
+-#ifdef HAVE_ICONV
+- iconv_t handle = iconv_open ("UCS-2", "UTF-8");
+- if (handle != (iconv_t) -1)
+- {
+- jchar c;
+- unsigned char in[4];
+- char *inp, *outp;
+- size_t inc, outc, r;
+-
+- // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv
+- // needs the trailing NUL byte, otherwise iconv fails with EINVAL.
+- in[0] = 0xef;
+- in[1] = 0xbb;
+- in[2] = 0xbf;
+- in[3] = 0x00;
+-
+- inp = (char *) in;
+- inc = 4;
+- outp = (char *) &c;
+- outc = 2;
+-
+- r = iconv_adapter (iconv, handle, &inp, &inc, &outp, &outc);
+- // Conversion must be complete for us to use the result.
+- if (r != (size_t) -1 && inc == 0 && outc == 0)
+- result = (c != 0xfeff);
+-
+- // Release iconv handle.
+- iconv_close (handle);
+- }
+-#endif /* HAVE_ICONV */
+- return result;
++ return false;
+ }
+
+ void
diff --git a/user/openjdk7/gcc-fix-gcj-musl.patch b/user/openjdk7/gcc-fix-gcj-musl.patch
new file mode 100644
index 000000000..d26f510c0
--- /dev/null
+++ b/user/openjdk7/gcc-fix-gcj-musl.patch
@@ -0,0 +1,49 @@
+--- gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc.orig 2014-02-18 10:55:08.617678779 +0200
++++ gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc 2014-02-18 10:56:31.927227453 +0200
+@@ -289,7 +289,7 @@
+ // just default to `en_US'.
+ setlocale (LC_ALL, "");
+ char *locale = setlocale (LC_MESSAGES, "");
+- if (locale && strlen (locale) >= 2)
++ if (locale && strlen (locale) >= 2 && (locale[2] == '\0' || locale[2] == '_'))
+ {
+ char buf[3];
+ buf[2] = '\0';
+--- gcc-4.8.2/libjava/posix-threads.cc.orig 2014-02-18 13:22:01.789933726 +0200
++++ gcc-4.8.2/libjava/posix-threads.cc 2014-02-18 13:29:50.924058875 +0200
+@@ -657,6 +657,7 @@
+ struct sched_param param;
+ pthread_attr_t attr;
+ struct starter *info;
++ size_t ss;
+
+ if (data->flags & FLAG_START)
+ return;
+@@ -675,8 +676,25 @@
+ // Set stack size if -Xss option was given.
+ if (gcj::stack_size > 0)
+ {
+- int e = pthread_attr_setstacksize (&attr, gcj::stack_size);
++ ss = gcj::stack_size;
++ }
++ else
++ {
++ int e = pthread_attr_getstacksize (&attr, &ss);
++ if (e != 0)
++ JvFail (strerror (e));
++
++ // Request at least 1meg of stack
++ if (ss >= 1024 * 1024)
++ ss = 0;
++ else
++ ss = 1024 * 1024;
++ }
++
++ if (ss)
++ {
++ int e = pthread_attr_setstacksize (&attr, ss);
+ if (e != 0)
+ JvFail (strerror (e));
+ }
+
+ info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));
diff --git a/user/openjdk7/gcc-fix-gcj-stdgnu14-link.patch b/user/openjdk7/gcc-fix-gcj-stdgnu14-link.patch
new file mode 100644
index 000000000..2b2ce0fa5
--- /dev/null
+++ b/user/openjdk7/gcc-fix-gcj-stdgnu14-link.patch
@@ -0,0 +1,35 @@
+--- gcc-6.1.0/libjava/Makefile.am
++++ gcc-6.1.0/libjava/Makefile.am
+@@ -488,10 +488,14 @@
+ nat_files = $(nat_source_files:.cc=.lo)
+ xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
+
++libgcj_la_CPPFLAGS = \
++ $(AM_CPPFLAGS) \
++ $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
++
+ # Include THREADLIBS here to ensure that the correct version of
+ # certain linuxthread functions get linked:
+ ## The mysterious backslash in the grep pattern is consumed by make.
+-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
++libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
+ $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)
+--- gcc-6.1.0/libjava/Makefile.in
++++ gcc-6.1.0/libjava/Makefile.in
+@@ -1103,9 +1103,13 @@
+ nat_files = $(nat_source_files:.cc=.lo)
+ xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
+
++libgcj_la_CPPFLAGS = \
++ $(AM_CPPFLAGS) \
++ $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
++
+ # Include THREADLIBS here to ensure that the correct version of
+ # certain linuxthread functions get linked:
+-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
++libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
+ $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
+ -version-info `grep -v '^\#' $(srcdir)/libtool-version` \
+ $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)
diff --git a/user/openjdk7/gcc-fix-rs6000-pie.patch b/user/openjdk7/gcc-fix-rs6000-pie.patch
new file mode 100644
index 000000000..1fbc31a56
--- /dev/null
+++ b/user/openjdk7/gcc-fix-rs6000-pie.patch
@@ -0,0 +1,59 @@
+--- gcc-6.3.0.orig/gcc/config/rs6000/sysv4.h
++++ gcc-6.3.0/gcc/config/rs6000/sysv4.h
+@@ -753,23 +753,42 @@
+ #endif
+
+ #ifdef HAVE_LD_PIE
+-#define STARTFILE_LINUX_SPEC "\
+-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
+-%{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
+-" CRTOFFLOADBEGIN
++#define STARTFILE_LINUX_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;: \
++ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \
++ crti.o%s %{shared:crtbeginS.o%s;: \
++ %{" PIE_SPEC ":crtbeginS.o%s} \
++ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \
++ %{fvtable-verify=none:%s; \
++ fvtable-verify=preinit:vtv_start_preinit.o%s; \
++ fvtable-verify=std:vtv_start.o%s} \
++ " CRTOFFLOADBEGIN
+ #else
+-#define STARTFILE_LINUX_SPEC "\
+-%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
+-%{mnewlib:ecrti.o%s;:crti.o%s} \
+-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
+-" CRTOFFLOADBEGIN
++#define STARTFILE_LINUX_SPEC \
++ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
++ %{fvtable-verify=none:%s; \
++ fvtable-verify=preinit:vtv_start_preinit.o%s; \
++ fvtable-verify=std:vtv_start.o%s} \
++ " CRTOFFLOADBEGIN
+ #endif
+
+-#define ENDFILE_LINUX_SPEC "\
+-%{shared|pie:crtendS.o%s;:crtend.o%s} \
+-%{mnewlib:ecrtn.o%s;:crtn.o%s} \
+-" CRTOFFLOADEND
++#ifdef HAVE_LD_PIE
++#define ENDFILE_LINUX_SPEC \
++ "%{fvtable-verify=none:%s; \
++ fvtable-verify=preinit:vtv_end_preinit.o%s; \
++ fvtable-verify=std:vtv_end.o%s} \
++ %{shared:crtendS.o%s;: %{" PIE_SPEC ":crtendS.o%s} \
++ %{" NO_PIE_SPEC ":crtend.o%s}} crtn.o%s \
++ " CRTOFFLOADEND
++#else
++#define ENDFILE_LINUX_SPEC \
++ "%{fvtable-verify=none:%s; \
++ fvtable-verify=preinit:vtv_end_preinit.o%s; \
++ fvtable-verify=std:vtv_end.o%s} \
++ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s \
++ " CRTOFFLOADEND
++#endif
+
+ #define LINK_START_LINUX_SPEC ""
+
diff --git a/user/openjdk7/gcc-gcc-4.8-build-args.patch b/user/openjdk7/gcc-gcc-4.8-build-args.patch
new file mode 100644
index 000000000..c27e00961
--- /dev/null
+++ b/user/openjdk7/gcc-gcc-4.8-build-args.patch
@@ -0,0 +1,41 @@
+When cross compiling a target gcc, target flags may be used on the host
+
+Configure identifies a number of warning flags (WARN_CFLAGS and
+WARN_CXXFLAGS) from the $CC value. The cross compiler may be different
+from the host compiler and may not support the same set of flags. This
+leads to problems such as:
+
+cc1plus: error: unrecognized command line option "-Wno-narrowing"
+cc1plus: error: unrecognized command line option "-Wno-overlength-strings"
+
+Work around this problem by removing the warning flags from the
+BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS.
+
+Upstream-Status: Pending
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+Index: gcc-4.8.0/gcc/configure
+===================================================================
+--- gcc-4.8.0.orig/gcc/configure
++++ gcc-4.8.0/gcc/configure
+@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc
+ if test x$build != x$host || test "x$coverage_flags" != x
+ then
+ BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
++ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
+ BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ fi
+
+Index: gcc-4.8.0/gcc/configure.ac
+===================================================================
+--- gcc-4.8.0.orig/gcc/configure.ac
++++ gcc-4.8.0/gcc/configure.ac
+@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F
+ if test x$build != x$host || test "x$coverage_flags" != x
+ then
+ BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
++ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)'
+ BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)'
+ fi
+
diff --git a/user/openjdk7/gcc-gcc-4.9-musl-fortify.patch b/user/openjdk7/gcc-gcc-4.9-musl-fortify.patch
new file mode 100644
index 000000000..daae954c8
--- /dev/null
+++ b/user/openjdk7/gcc-gcc-4.9-musl-fortify.patch
@@ -0,0 +1,11 @@
+--- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000
++++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000
+@@ -146,6 +146,8 @@
+
+ #ifdef NATIVE_SYSTEM_HEADER_DIR
+ #define INCLUDE_DEFAULTS_MUSL_NATIVE \
++ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
++ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+ #else
diff --git a/user/openjdk7/gcc-gcc-5.4.0-locale.patch b/user/openjdk7/gcc-gcc-5.4.0-locale.patch
new file mode 100644
index 000000000..dca3ba9e8
--- /dev/null
+++ b/user/openjdk7/gcc-gcc-5.4.0-locale.patch
@@ -0,0 +1,13 @@
+diff --git gcc-5.4.0/libstdc++-v3/config/locale/generic/c_locale.cc.orig gcc-5.4.0/libstdc++-v3/config/locale/generic/c_locale.cc
+--- gcc-5.4.0/libstdc++-v3/config/locale/generic/c_locale.cc.orig
++++ gcc-5.4.0/libstdc++-v3/config/locale/generic/c_locale.cc
+@@ -213,9 +213,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // Currently, the generic model only supports the "C" locale.
+ // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
+ __cloc = 0;
+- if (strcmp(__s, "C"))
+- __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+- "name not valid"));
+ }
+
+ void
diff --git a/user/openjdk7/gcc-gcc-6.1-musl-libssp.patch b/user/openjdk7/gcc-gcc-6.1-musl-libssp.patch
new file mode 100644
index 000000000..fe5c61434
--- /dev/null
+++ b/user/openjdk7/gcc-gcc-6.1-musl-libssp.patch
@@ -0,0 +1,20 @@
+Author: Timo Teräs <timo.teras@iki.fi>
+
+Alpine musl package provides libssp_nonshared.a. We link to it unconditionally,
+as otherwise we get link failures if some objects are -fstack-protector built
+and final link happens with -fno-stack-protector. This seems to be the common
+case when bootstrapping gcc, the piepatches do not seem to fully fix the
+crosstoolchain and bootstrap sequence wrt. stack-protector flag usage.
+
+--- gcc-6.1.0/gcc/gcc.c.orig
++++ gcc-6.1.0/gcc/gcc.c
+@@ -870,8 +870,7 @@
+
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+- "|fstack-protector-strong|fstack-protector-explicit:}"
++#define LINK_SSP_SPEC "-lssp_nonshared"
+ #else
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
diff --git a/user/openjdk7/gcc-gcc-pure64.patch b/user/openjdk7/gcc-gcc-pure64.patch
new file mode 100644
index 000000000..2c350fe5a
--- /dev/null
+++ b/user/openjdk7/gcc-gcc-pure64.patch
@@ -0,0 +1,89 @@
+--- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000
++++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000
+@@ -34,6 +34,6 @@
+ comma=,
+ MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+--- ./gcc/config/aarch64/t-aarch64-linux.orig
++++ ./gcc/config/aarch64/t-aarch64-linux
+@@ -22,7 +22,7 @@
+ LIB1ASMFUNCS = _aarch64_sync_cache_range
+
+ AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
++MULTILIB_OSDIRNAMES = mabi.lp64=../lib
+ MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+
+ MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
+--- ./gcc/config/s390/t-linux64.orig
++++ ./gcc/config/s390/t-linux64
+@@ -7,5 +7,5 @@
+ MULTILIB_OPTIONS = m64/m31
+ MULTILIB_DIRNAMES = 64 32
+-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
+-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
+
+--- ./gcc/config/rs6000/t-linux.orig
++++ ./gcc/config/rs6000/t-linux
+@@ -2,7 +2,8 @@
+ # or soft-float.
+ ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
+ ifneq (,$(findstring powerpc64,$(target)))
+-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ else
+ ifneq (,$(findstring spe,$(target)))
+ MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
+@@ -14,7 +15,8 @@
+ MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
+ endif
+ ifneq (,$(findstring powerpc64le,$(target)))
+-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ endif
+ endif
+
+--- ./gcc/config/rs6000/t-linux64.orig
++++ ./gcc/config/rs6000/t-linux64
+@@ -28,8 +28,8 @@
+ MULTILIB_OPTIONS := m64/m32
+ MULTILIB_DIRNAMES := 64 32
+ MULTILIB_EXTRA_OPTS :=
+-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+
+ rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
+ $(COMPILE) $<
+--- ./gcc/config/rs6000/t-linux64bele.orig
++++ ./gcc/config/rs6000/t-linux64bele
+@@ -2,6 +2,6 @@
+
+ MULTILIB_OPTIONS += mlittle
+ MULTILIB_DIRNAMES += le
+-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES = m64=../lib
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
+--- ./gcc/config/rs6000/t-linux64lebe.orig
++++ ./gcc/config/rs6000/t-linux64lebe
+@@ -2,6 +2,6 @@
+
+ MULTILIB_OPTIONS += mbig
+ MULTILIB_DIRNAMES += be
+-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES := m64=../lib
++MULTILIB_OSDIRNAMES += m32=../lib32
+ MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
diff --git a/user/openjdk7/gcc-isl-fix.patch b/user/openjdk7/gcc-isl-fix.patch
new file mode 100644
index 000000000..d8d294c0e
--- /dev/null
+++ b/user/openjdk7/gcc-isl-fix.patch
@@ -0,0 +1,15 @@
+Fix build with isl >= 0.20.
+
+Backport from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724
+
+--- gcc-6.4.0/gcc/graphite.h.old 2016-01-25 18:19:20.909140000 -0600
++++ gcc-6.4.0/gcc/graphite.h 2022-06-21 02:51:53.660000000 -0500
+@@ -40,6 +40,8 @@
+ #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
+ /* isl 0.15 or later. */
+ #include <isl/schedule_node.h>
++#include <isl/id.h>
++#include <isl/space.h>
+
+ #else
+ /* isl 0.14 or 0.13. */
diff --git a/user/openjdk7/gcc-libgcc-always-build-gcceh.a.patch b/user/openjdk7/gcc-libgcc-always-build-gcceh.a.patch
new file mode 100644
index 000000000..74ae89730
--- /dev/null
+++ b/user/openjdk7/gcc-libgcc-always-build-gcceh.a.patch
@@ -0,0 +1,39 @@
+Highly inspired by:
+ http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
+
+diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
+--- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100
++++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200
+@@ -772,8 +772,9 @@
+ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
+ endif
+
++all: libgcc_eh.a
+ ifeq ($(enable_shared),yes)
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
++all: libgcc_s$(SHLIB_EXT)
+ ifneq ($(LIBUNWIND),)
+ all: libunwind$(SHLIB_EXT)
+ endif
+@@ -950,10 +951,6 @@
+ install-shared:
+ $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
+
+- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
+- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+-
+ $(subst @multilib_dir@,$(MULTIDIR),$(subst \
+ @shlib_base_name@,libgcc_s,$(subst \
+ @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
+@@ -968,6 +965,10 @@
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
+
++ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++
+ parts="$(INSTALL_PARTS)"; \
+ for file in $$parts; do \
+ rm -f $(DESTDIR)$(inst_libdir)/$$file; \
diff --git a/user/openjdk7/gcc-libgo-musl-1.2.3.patch b/user/openjdk7/gcc-libgo-musl-1.2.3.patch
new file mode 100644
index 000000000..8873d44eb
--- /dev/null
+++ b/user/openjdk7/gcc-libgo-musl-1.2.3.patch
@@ -0,0 +1,13 @@
+diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
+index 6fef104..06289a4 100755
+--- a/libgo/mksysinfo.sh
++++ b/libgo/mksysinfo.sh
+@@ -355,7 +355,7 @@ if ! grep '^const SIGCLD ' ${OUT} >/dev/null 2>&1; then
+ fi
+
+ # The syscall numbers. We force the names to upper case.
+-grep '^const _SYS_' gen-sysinfo.go | \
++grep '^const _SYS_[a-z]' gen-sysinfo.go | \
+ sed -e 's/const _\(SYS_[^= ]*\).*$/\1/' | \
+ while read sys; do
+ sup=`echo $sys | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
diff --git a/user/openjdk7/gcc-lra-pentium.patch b/user/openjdk7/gcc-lra-pentium.patch
new file mode 100644
index 000000000..e876bcc39
--- /dev/null
+++ b/user/openjdk7/gcc-lra-pentium.patch
@@ -0,0 +1,48 @@
+--- trunk/gcc/lra-assigns.c 2017/03/10 20:53:18 246058
++++ trunk/gcc/lra-assigns.c 2017/03/10 21:17:13 246059
+@@ -889,6 +889,30 @@
+ live_pseudos_reg_renumber[regno] = hard_regno;
+ }
+
++/* Return true iff there is a reason why pseudo SPILL_REGNO should not
++ be spilled. */
++static bool
++must_not_spill_p (unsigned spill_regno)
++{
++ if ((pic_offset_table_rtx != NULL
++ && spill_regno == REGNO (pic_offset_table_rtx))
++ || ((int) spill_regno >= lra_constraint_new_regno_start
++ && ! bitmap_bit_p (&lra_inheritance_pseudos, spill_regno)
++ && ! bitmap_bit_p (&lra_split_regs, spill_regno)
++ && ! bitmap_bit_p (&lra_subreg_reload_pseudos, spill_regno)
++ && ! bitmap_bit_p (&lra_optional_reload_pseudos, spill_regno)))
++ return true;
++ /* A reload pseudo that requires a singleton register class should
++ not be spilled.
++ FIXME: this mitigates the issue on certain i386 patterns, but
++ does not solve the general case where existing reloads fully
++ cover a limited register class. */
++ if (!bitmap_bit_p (&non_reload_pseudos, spill_regno)
++ && reg_class_size [reg_preferred_class (spill_regno)] == 1)
++ return true;
++ return false;
++}
++
+ /* Array used for sorting reload pseudos for subsequent allocation
+ after spilling some pseudo. */
+ static int *sorted_reload_pseudos;
+@@ -960,13 +984,7 @@
+ /* Spill pseudos. */
+ static_p = false;
+ EXECUTE_IF_SET_IN_BITMAP (&spill_pseudos_bitmap, 0, spill_regno, bi)
+- if ((pic_offset_table_rtx != NULL
+- && spill_regno == REGNO (pic_offset_table_rtx))
+- || ((int) spill_regno >= lra_constraint_new_regno_start
+- && ! bitmap_bit_p (&lra_inheritance_pseudos, spill_regno)
+- && ! bitmap_bit_p (&lra_split_regs, spill_regno)
+- && ! bitmap_bit_p (&lra_subreg_reload_pseudos, spill_regno)
+- && ! bitmap_bit_p (&lra_optional_reload_pseudos, spill_regno)))
++ if (must_not_spill_p (spill_regno))
+ goto fail;
+ else if (non_spilled_static_chain_regno_p (spill_regno))
+ static_p = true;
diff --git a/user/openjdk7/icedtea-cpio.patch b/user/openjdk7/icedtea-cpio.patch
new file mode 100644
index 000000000..c66c1ca60
--- /dev/null
+++ b/user/openjdk7/icedtea-cpio.patch
@@ -0,0 +1,11 @@
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.orig
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk
+@@ -104,7 +104,7 @@
+ COMM = $(UTILS_USR_BIN_PATH)comm
+ COMPRESS = $(UTILS_USR_BIN_PATH)compress
+ CP = $(UTILS_COMMAND_PATH)cp
+-CPIO = $(UTILS_COMMAND_PATH)cpio
++CPIO = $(UTILS_USR_BIN_PATH)cpio
+ CUT = $(UTILS_USR_BIN_PATH)cut
+ DATE = $(UTILS_COMMAND_PATH)date
+ DF = $(UTILS_COMMAND_PATH)df
diff --git a/user/openjdk7/icedtea-hotspot-musl-ppc.patch b/user/openjdk7/icedtea-hotspot-musl-ppc.patch
new file mode 100644
index 000000000..eca684884
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-musl-ppc.patch
@@ -0,0 +1,169 @@
+--- openjdk.orig/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
++++ openjdk/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp
+@@ -110,11 +110,19 @@
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(ucontext_t * uc) {
+@@ -213,7 +221,11 @@
+ if (uc) {
+ address const pc = os::Linux::ucontext_get_pc(uc);
+ if (pc && StubRoutines::is_safefetch_fault(pc)) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = (unsigned long)StubRoutines::continuation_for_safefetch_fault(pc);
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)StubRoutines::continuation_for_safefetch_fault(pc);
++#endif
+ return true;
+ }
+ }
+@@ -364,7 +376,11 @@
+ // continue at the next instruction after the faulting read. Returning
+ // garbage from this read is ok.
+ thread->set_pending_unsafe_access_error();
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = ((unsigned long)pc) + 4;
++#endif
+ return true;
+ }
+ }
+@@ -383,7 +399,11 @@
+ // continue at the next instruction after the faulting read. Returning
+ // garbage from this read is ok.
+ thread->set_pending_unsafe_access_error();
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = ((unsigned long)pc) + 4;
++#else // Musl
++ uc->uc_mcontext.gp_regs[32] = ((unsigned long)pc) + 4;
++#endif
+ return true;
+ }
+ }
+@@ -406,7 +426,11 @@
+ if (stub != NULL) {
+ // Save all thread context in case we need to restore it.
+ if (thread != NULL) thread->set_saved_exception_pc(pc);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uc->uc_mcontext.regs->nip = (unsigned long)stub;
++#else
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)stub;
++#endif
+ return true;
+ }
+
+@@ -564,6 +588,7 @@
+ ucontext_t* uc = (ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -572,8 +597,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -600,7 +635,11 @@
+ // this is only for the "general purpose" registers
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- openjdk.orig/hotspot.orig/src/cpu/ppc/vm/macroAssembler_ppc.cpp
++++ openjdk/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
+@@ -1242,7 +1242,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t)ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1263,15 +1267,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1334,11 +1347,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
diff --git a/user/openjdk7/icedtea-hotspot-musl.patch b/user/openjdk7/icedtea-hotspot-musl.patch
new file mode 100644
index 000000000..1da903148
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-musl.patch
@@ -0,0 +1,79 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/jvm_linux.cpp
++++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp
+@@ -154,7 +154,9 @@
+ #ifdef SIGSTKFLT
+ "STKFLT", SIGSTKFLT, /* Stack fault. */
+ #endif
++#ifdef SIGCLD
+ "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
++#endif
+ "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
+ "CONT", SIGCONT, /* Continue (POSIX). */
+ "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
+--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.inline.hpp
++++ openjdk/hotspot/src/os/linux/vm/os_linux.inline.hpp
+@@ -52,7 +52,7 @@
+
+ #include <unistd.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netdb.h>
+
+ inline void* os::thread_local_storage_at(int index) {
+--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+@@ -73,7 +73,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+@@ -533,6 +532,9 @@
+ ShouldNotReachHere();
+ return true; // Mute compiler
+ }
++
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
+
+ void os::Linux::init_thread_fpu_state(void) {
+ #ifndef AMD64
+--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
+@@ -32,7 +32,9 @@
+ // map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp
+ #define SP_BITLENGTH 32
+ #define PAGE_SHIFT 12
++ #ifndef PAGE_SIZE
+ #define PAGE_SIZE (1UL << PAGE_SHIFT)
++ #endif
+ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
+
+ public:
+--- openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp.orig
++++ openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+@@ -76,7 +76,7 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
++# include <linux/types.h>
+
+ #ifdef BUILTIN_SIM
+ #define REG_SP REG_RSP
+--- openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp.orig
++++ openjdk/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
+@@ -194,10 +194,6 @@
+ return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
+ }
+
+-template <class T> static const T& min (const T& a, const T& b) {
+- return (a > b) ? b : a;
+-}
+-
+ // ---------------------------------------------------------------------------
+ // Read the array of BasicTypes from a signature, and compute where the
+ // arguments should go. Values in the VMRegPair regs array refer to 4-byte
diff --git a/user/openjdk7/icedtea-hotspot-noagent-musl.patch b/user/openjdk7/icedtea-hotspot-noagent-musl.patch
new file mode 100644
index 000000000..37604acca
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-noagent-musl.patch
@@ -0,0 +1,54 @@
+--- openjdk.orig/hotspot/make/linux/makefiles/defs.make
++++ openjdk/hotspot/make/linux/makefiles/defs.make
+@@ -327,6 +327,9 @@
+
+ # Serviceability Binaries
+ # No SA Support for PPC, IA64, ARM or zero
++# or if thread_db.h missing (musl)
++
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+ $(EXPORT_LIB_DIR)/sa-jdi.jar
+ ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+@@ -343,6 +346,10 @@
+ endif
+ endif
+ endif
++endif
++else
++ADD_SA_BINARIES/x86 =
++ADD_SA_BINARIES/sparc =
+ endif
+ ADD_SA_BINARIES/ppc =
+ ADD_SA_BINARIES/ppc64 =
+--- openjdk.orig/hotspot/make/linux/makefiles/sa.make
++++ openjdk/hotspot/make/linux/makefiles/sa.make
+@@ -59,9 +59,11 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium or zero.
++# check for thread_db.h too (musl does not have it).
+
+ all:
+- if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
++ if [ -d $(AGENT_DIR) -a -f /usr/include/thread_db.h \
++ -a "$(SRCARCH)" != "ia64" \
+ -a "$(SRCARCH)" != "zero" \
+ -a "$(SRCARCH)" != "aarch64" ] ; then \
+ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
+--- openjdk.orig/hotspot/make/linux/makefiles/saproc.make
++++ openjdk/hotspot/make/linux/makefiles/saproc.make
+@@ -65,10 +65,13 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium or zero.
++# check for thread_db.h too (musl does not have it).
+
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ifneq ($(wildcard $(AGENT_DIR)),)
+ ifneq ($(filter-out ia64 zero aarch64,$(SRCARCH)),)
+ BUILDLIBSAPROC = $(LIBSAPROC)
++endif
+ endif
+ endif
+
diff --git a/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch b/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch
new file mode 100644
index 000000000..1c1d82276
--- /dev/null
+++ b/user/openjdk7/icedtea-hotspot-uclibc-fixes.patch
@@ -0,0 +1,93 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp
++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+@@ -112,7 +112,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -632,6 +631,13 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if 1
++ // Hard code Alpine Linux supported uclibc/musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++ os::Linux::set_is_NPTL();
++ os::Linux::set_is_floating_stack();
++#else
+ // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
+ // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
+ // generic name for earlier versions.
+@@ -690,6 +696,7 @@
+ if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
+ os::Linux::set_is_floating_stack();
+ }
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2951,11 +2958,7 @@
+ // If we are running with earlier version, which did not have symbol versions,
+ // we should use the base version.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlsym(handle, name);
+ }
+
+ bool os::Linux::libnuma_init() {
+@@ -5312,7 +5315,25 @@
+ // Linux doesn't yet have a (official) notion of processor sets,
+ // so just return the system wide load average.
+ int os::loadavg(double loadavg[], int nelem) {
++#ifdef __UCLIBC__
++ FILE *LOADAVG;
++ double avg[3] = { 0.0, 0.0, 0.0 };
++ int i, res = -1;;
++
++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) {
++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]);
++ res = 0;
++ fclose(LOADAVG);
++ }
++
++ for (i = 0; (i < nelem) && (i < 3); i++) {
++ loadavg[i] = avg[i];
++ }
++
++ return res;
++#else
+ return ::getloadavg(loadavg, nelem);
++#endif
+ }
+
+ void os::pause() {
+--- openjdk.orig/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
++++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+@@ -253,7 +253,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+@@ -267,8 +267,8 @@
+
+ // Checking for finiteness
+
+-inline int g_isfinite(jfloat f) { return finite(f); }
+-inline int g_isfinite(jdouble f) { return finite(f); }
++inline int g_isfinite(jfloat f) { return isfinite(f); }
++inline int g_isfinite(jdouble f) { return isfinite(f); }
+
+
+ // Wide characters
diff --git a/user/openjdk7/icedtea-jdk-execinfo.patch b/user/openjdk7/icedtea-jdk-execinfo.patch
new file mode 100644
index 000000000..a6499dcb0
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-execinfo.patch
@@ -0,0 +1,40 @@
+--- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
++++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c
+@@ -35,7 +35,7 @@
+ #include <X11/Xlib.h>
+ #include <X11/Xatom.h>
+ #include <Xm/MwmUtil.h>
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ #include <execinfo.h>
+ #endif
+ #include <stdio.h>
+@@ -835,7 +835,7 @@
+ AWT_UNLOCK();
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ void
+ print_stack (void)
+ {
+--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c
++++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c
+@@ -27,7 +27,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ #include <execinfo.h>
+ #endif
+
+@@ -689,7 +689,7 @@
+ return ret;
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ void print_stack(void)
+ {
+ void *array[10];
diff --git a/user/openjdk7/icedtea-jdk-fix-build.patch b/user/openjdk7/icedtea-jdk-fix-build.patch
new file mode 100644
index 000000000..9fae895b6
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-fix-build.patch
@@ -0,0 +1,56 @@
+Fixes three issues:
+ - so's should not be linked to -ljvm as dlopen(/abs/name) is
+ used by the launcher to load libjvm.so; it is thus not available
+ (musl/uclibc) ld.so to satisfy NEEDED dependency inserted by
+ -ljvm. Fix to not link against -ljvm, and disable -z defs so
+ undefined symbols are allowed in sos
+ - the previous makes ldd generate errors on unresolved symbols (musl)
+ remove it altogether as it's used for informative purposes only
+ (display things - not check anything useful)
+ - Don't delete the generated directory $(GENCSEXT), this can
+ confuse make in highly parallel builds with:
+ make[6]: *** INTERNAL: readdir: No such file or directory. Stop.
+ make[6]: Leaving directory '.../openjdk-boot/jdk/make/sun/nio/cs'
+
+--- openjdk.orig/jdk/make/common/Defs-linux.gmk
++++ openjdk/jdk/make/common/Defs-linux.gmk
+@@ -350,7 +350,7 @@
+
+ EXTRA_LIBS += -lc
+
+-LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs
++LDFLAGS_DEFS_OPTION =
+ LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
+
+ #
+@@ -407,7 +407,7 @@
+ # the library itself should not.
+ #
+ VM_NAME = server
+-JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
++JVMLIB =
+ JAVALIB = -ljava $(JVMLIB)
+
+ #
+--- openjdk.orig/jdk/make/sun/nio/cs/Makefile
++++ openjdk/jdk/make/sun/nio/cs/Makefile
+@@ -107,7 +107,7 @@
+ $(GENCSDATASRC)/DoubleByte-X.java.template \
+ $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
+ @$(prep-target)
+- $(RM) -r $(GENCSEXT)
++ $(RM) -f "$(GENCSEXT)"/*
+ $(MKDIR) -p $(GENCSEXT)
+ $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs
+ $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \
+--- openjdk.orig/jdk/make/common/shared/Defs-linux.gmk
++++ openjdk/jdk/make/common/shared/Defs-linux.gmk
+@@ -207,8 +207,6 @@
+ if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \
+ $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \
+ fi && \
+- $(ECHO) "Library loads for: $1" && \
+- $(LDD) $1 && \
+ $(ECHO) "RUNPATH for: $1" && \
+ ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \
+ )
diff --git a/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch b/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch
new file mode 100644
index 000000000..11f3bf6dd
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-fix-ipv6-init.patch
@@ -0,0 +1,42 @@
+--- openjdk/jdk/src/solaris/native/java/net/net_util_md.c.orig
++++ openjdk/jdk/src/solaris/native/java/net/net_util_md.c
+@@ -561,7 +561,7 @@
+
+ static struct localinterface *localifs = 0;
+ static int localifsSize = 0; /* size of array */
+-static int nifs = 0; /* number of entries used in array */
++static int nifs = -1; /* number of entries used in array */
+
+ /* not thread safe: make sure called once from one thread */
+
+@@ -573,6 +573,10 @@
+ int index, x1, x2, x3;
+ unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
+
++ if (nifs >= 0)
++ return ;
++ nifs = 0;
++
+ if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) {
+ return ;
+ }
+@@ -601,7 +605,7 @@
+ localifs = (struct localinterface *) realloc (
+ localifs, sizeof (struct localinterface)* (localifsSize+5));
+ if (localifs == 0) {
+- nifs = 0;
++ nifs = -1;
+ fclose (f);
+ return;
+ }
+@@ -624,9 +628,7 @@
+ static int getLocalScopeID (char *addr) {
+ struct localinterface *lif;
+ int i;
+- if (localifs == 0) {
+- initLocalIfs();
+- }
++ initLocalIfs();
+ for (i=0, lif=localifs; i<nifs; i++, lif++) {
+ if (memcmp (addr, lif->localaddr, 16) == 0) {
+ return lif->index;
diff --git a/user/openjdk7/icedtea-jdk-musl.patch b/user/openjdk7/icedtea-jdk-musl.patch
new file mode 100644
index 000000000..49c16d73a
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-musl.patch
@@ -0,0 +1,116 @@
+diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-07-15 07:19:52.186682096 +0000
+@@ -46,6 +46,8 @@
+
+ #include "zip.h"
+
++#define uchar unsigned char
++
+ #ifdef NO_ZLIB
+
+ inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
+diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
+--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-07-15 07:19:52.186682096 +0000
+@@ -23,9 +23,7 @@
+ * questions.
+ */
+
+-#define ushort unsigned short
+-#define uint unsigned int
+-#define uchar unsigned char
++#include <sys/types.h>
+
+ struct unpacker;
+
+diff -ru openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h
+--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-07-15 07:19:52.186682096 +0000
+@@ -27,6 +27,7 @@
+ #ifndef MLIB_TYPES_H
+ #define MLIB_TYPES_H
+
++#include <stddef.h> /* for NULL */
+ #include <limits.h>
+ #if defined(_MSC_VER)
+ #include <float.h> /* for FLT_MAX and DBL_MAX */
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-07-15 07:19:52.186682096 +0000
+@@ -47,7 +47,7 @@
+
+ #include "java_net_Inet4AddressImpl.h"
+
+-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
++#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
+ #define HAS_GLIBC_GETHOSTBY_R 1
+ #endif
+
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-07-15 07:19:52.186682096 +0000
+@@ -47,7 +47,6 @@
+
+ #ifdef __linux__
+ #include <sys/ioctl.h>
+-#include <bits/ioctls.h>
+ #include <sys/utsname.h>
+ #include <stdio.h>
+ #endif
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-07-15 07:19:52.190015524 +0000
+@@ -35,7 +35,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #include <sys/utsname.h>
+ #include <netinet/ip.h>
+
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-07-15 07:19:52.190015524 +0000
+@@ -43,7 +43,6 @@
+ #endif
+ #ifdef __linux__
+ #include <unistd.h>
+-#include <sys/sysctl.h>
+ #endif
+
+ #include "jvm.h"
+diff -ru openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c
+--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2014-07-15 07:22:17.609355950 +0000
+@@ -75,7 +75,7 @@
+ #ifdef _AIX
+ static int sigWakeup = (SIGRTMAX - 1);
+ #else
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+ #endif
+
+ /*
+@@ -148,6 +148,9 @@
+ /*
+ * Setup the signal handler
+ */
++#ifndef __AIX
++ sigWakeup = SIGRTMAX - 2;
++#endif
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+diff -ru openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-06-12 20:14:44.000000000 +0000
++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-07-15 07:19:52.190015524 +0000
+@@ -38,7 +38,7 @@
+ #include <sys/signal.h>
+
+ /* Also defined in src/solaris/native/java/net/linux_close.c */
+-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+
+ static void
+ nullHandler(int sig)
diff --git a/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch b/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch
new file mode 100644
index 000000000..26f89bb54
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-no-lib-nsl-uclibc.patch
@@ -0,0 +1,84 @@
+--- openjdk.orig/hotspot/agent/src/os/solaris/dbx/Makefile
++++ openjdk/hotspot/agent/src/os/solaris/dbx/Makefile
+@@ -50,7 +50,7 @@
+ CFLAGS_32bit := -xarch=v8
+ CFLAGS_64bit := -xarch=v9
+ CFLAGS := -PIC -xO3 $(INCLUDES)
+-LIBS := -lsocket -lnsl -lrtld_db
++LIBS := -lsocket -lrtld_db
+ LDFLAGS := -G
+
+ ifneq "$(ARCH)" "i486"
+--- openjdk.orig/jdk/make/java/hpi/hpi_common.gmk
++++ openjdk/jdk/make/java/hpi/hpi_common.gmk
+@@ -86,5 +86,5 @@
+ # Things that must be linked in.
+ #
+ ifneq ($(PLATFORM), windows)
+-OTHER_LDLIBS += $(LIBSOCKET) -lnsl $(LIBM) -ldl
++OTHER_LDLIBS += $(LIBSOCKET) $(LIBM) -ldl
+ endif
+--- openjdk.orig/jdk/make/java/java/Makefile
++++ openjdk/jdk/make/java/java/Makefile
+@@ -205,7 +205,7 @@
+ OTHER_LDLIBS += $(JVMLIB) -libpath:$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) fdlibm.lib \
+ -libpath:$(OBJDIR)/../../../verify/$(OBJDIRNAME) verify.lib
+ else
+-OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -lnsl -ldl \
++OTHER_LDLIBS += $(JVMLIB) -lverify $(LIBSOCKET) -ldl \
+ -L$(OBJDIR)/../../../fdlibm/$(OBJDIRNAME) -lfdlibm.$(ARCH)
+ endif
+
+--- openjdk.orig/jdk/make/java/java_hprof_demo/Makefile
++++ openjdk/jdk/make/java/java_hprof_demo/Makefile
+@@ -83,7 +83,7 @@
+ ifeq ($(PLATFORM), windows)
+ OTHER_LDLIBS += wsock32.lib winmm.lib
+ else
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl
+ endif
+
+ #
+--- openjdk.orig/jdk/make/java/net/Makefile
++++ openjdk/jdk/make/java/net/Makefile
+@@ -97,7 +97,7 @@
+ # Will not compile at warning level 3 if warnings are fatal
+ COMPILER_WARNINGS_FATAL=false
+ else
+- OTHER_LDLIBS = $(LIBSOCKET) -lnsl -ldl $(JVMLIB)
++ OTHER_LDLIBS = $(LIBSOCKET) -ldl $(JVMLIB)
+ endif
+ ifeq ($(PLATFORM), linux)
+ OTHER_LDLIBS += -lpthread
+--- openjdk.orig/jdk/make/jpda/transport/socket/Makefile
++++ openjdk/jdk/make/jpda/transport/socket/Makefile
+@@ -42,11 +42,11 @@
+ endif
+
+ ifeq ($(PLATFORM), linux)
+- OTHER_LDLIBS += -lnsl $(LIBSOCKET) -lpthread
++ OTHER_LDLIBS += $(LIBSOCKET) -lpthread
+ endif
+
+ ifeq ($(PLATFORM), solaris)
+- OTHER_LDLIBS += -lnsl $(LIBSOCKET)
++ OTHER_LDLIBS += $(LIBSOCKET)
+ endif
+
+ ifeq ($(PLATFORM), windows)
+--- openjdk.orig/jdk/make/mkdemo/jvmti/hprof/Makefile
++++ openjdk/jdk/make/mkdemo/jvmti/hprof/Makefile
+@@ -39,10 +39,10 @@
+ EXTRA_LIBS += wsock32.lib winmm.lib
+ endif
+ ifeq ($(PLATFORM), solaris)
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl
+ endif
+ ifeq ($(PLATFORM), linux)
+- OTHER_LDLIBS += $(LIBSOCKET) -lnsl -ldl -lpthread
++ OTHER_LDLIBS += $(LIBSOCKET) -ldl -lpthread
+ endif
+
+ #
diff --git a/user/openjdk7/icedtea-jdk-no-soname.patch b/user/openjdk7/icedtea-jdk-no-soname.patch
new file mode 100644
index 000000000..fe6bbb732
--- /dev/null
+++ b/user/openjdk7/icedtea-jdk-no-soname.patch
@@ -0,0 +1,12 @@
+--- ./openjdk/jdk/make/common/Defs-linux.gmk.orig
++++ ./openjdk/jdk/make/common/Defs-linux.gmk
+@@ -248,7 +248,9 @@
+ #
+ LDFLAGS_OPT = -Xlinker -O1
+ LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
++ifdef LIBRARY
+ LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
++endif
+
+ #
+ # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
diff --git a/user/openjdk7/icedtea-newer-freetype.patch b/user/openjdk7/icedtea-newer-freetype.patch
new file mode 100644
index 000000000..b2839e351
--- /dev/null
+++ b/user/openjdk7/icedtea-newer-freetype.patch
@@ -0,0 +1,21 @@
+--- openjdk/jdk/make/common/shared/Defs-versions.gmk 2022-09-01 15:40:10.645995564 +0000
++++ openjdk/jdk/make/common/shared/Defs-versions.gmk 2022-09-01 15:41:20.383447148 +0000
+@@ -213,7 +213,7 @@
+ # Generic
+ REQUIRED_ANT_VER = 1.7.1
+ REQUIRED_BOOT_VER = 1.6
+-REQUIRED_FREETYPE_VERSION = 2.2.1
++REQUIRED_FREETYPE_VERSION = 2.10.0
+ REQUIRED_MAKE_VER = 3.81
+ REQUIRED_UNZIP_VER = 5.12
+ REQUIRED_ZIP_VER = 2.2
+--- patches/boot/revert-6973616.patch 2022-09-01 16:12:53.569629968 +0000
++++ patches/boot/revert-6973616.patch 2022-09-01 16:13:07.797914209 +0000
+@@ -7,6 +7,6 @@
+ REQUIRED_ANT_VER = 1.7.1
+ -REQUIRED_BOOT_VER = 1.6
+ +REQUIRED_BOOT_VER = 1.5
+- REQUIRED_FREETYPE_VERSION = 2.2.1
++ REQUIRED_FREETYPE_VERSION = 2.10.0
+ REQUIRED_MAKE_VER = 3.81
+ REQUIRED_UNZIP_VER = 5.12
diff --git a/user/openjdk7/icedtea-remove-gawk.patch b/user/openjdk7/icedtea-remove-gawk.patch
new file mode 100644
index 000000000..98e9878b7
--- /dev/null
+++ b/user/openjdk7/icedtea-remove-gawk.patch
@@ -0,0 +1,22 @@
+--- openjdk/corba/make/common/shared/Defs-utils.gmk.old 2018-10-22 05:22:47.000000000 +0000
++++ openjdk/corba/make/common/shared/Defs-utils.gmk 2019-02-27 00:44:26.900000000 +0000
+@@ -182,7 +182,7 @@
+ # others have it in /usr/bin.
+ SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
+ $(wildcard $(UTILS_USR_BIN_PATH)sort))
+- NAWK = $(USRBIN_PATH)gawk
++ NAWK = $(USRBIN_PATH)mawk
+ # Intrinsic unix command, with backslash-escaped character interpretation
+ ECHO = /bin/echo -e
+ # These are really in UTILS_USR_BIN_PATH on Linux (only sccs is not)
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.old 2019-02-27 00:40:12.430000000 +0000
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk 2019-02-27 00:43:49.520000000 +0000
+@@ -207,7 +207,7 @@
+ # others have it in /usr/bin.
+ SORT=$(firstword $(wildcard $(UTILS_COMMAND_PATH)sort) \
+ $(wildcard $(UTILS_USR_BIN_PATH)sort))
+- NAWK = $(USRBIN_PATH)gawk
++ NAWK = $(USRBIN_PATH)mawk
+ # Intrinsic unix command, with backslash-escaped character interpretation
+ ECHO = /bin/echo -e
+ # These are really in UTILS_USR_BIN_PATH on Linux
diff --git a/user/openjdk7/icedtea-tar.patch b/user/openjdk7/icedtea-tar.patch
new file mode 100644
index 000000000..98c280184
--- /dev/null
+++ b/user/openjdk7/icedtea-tar.patch
@@ -0,0 +1,22 @@
+--- openjdk/jdk/make/common/shared/Defs-utils.gmk.old 2019-02-27 01:45:10.950000000 +0000
++++ openjdk/jdk/make/common/shared/Defs-utils.gmk 2019-02-27 02:26:55.870000000 +0000
+@@ -150,7 +150,7 @@
+ SHOWREV = $(UTILS_USR_BIN_PATH)showrev
+ SORT = $(UTILS_COMMAND_PATH)sort
+ TAIL = $(UTILS_USR_BIN_PATH)tail
+-TAR = $(UTILS_COMMAND_PATH)tar
++TAR = $(UTILS_USR_BIN_PATH)tar
+ TEST = $(UTILS_USR_BIN_PATH)test
+ TOUCH = $(UTILS_COMMAND_PATH)touch
+ TR = $(UTILS_USR_BIN_PATH)tr
+--- openjdk/corba/make/common/shared/Defs-utils.gmk.old 2019-02-27 02:27:38.910000000 +0000
++++ openjdk/corba/make/common/shared/Defs-utils.gmk 2019-02-27 02:28:00.210000000 +0000
+@@ -129,7 +129,7 @@
+ SORT = $(UTILS_COMMAND_PATH)sort
+ STRIP = $(UTILS_CCS_BIN_PATH)strip
+ TAIL = $(UTILS_USR_BIN_PATH)tail
+-TAR = $(UTILS_COMMAND_PATH)tar
++TAR = $(UTILS_USR_BIN_PATH)tar
+ TEST = $(UTILS_USR_BIN_PATH)test
+ TOUCH = $(UTILS_COMMAND_PATH)touch
+ TR = $(UTILS_USR_BIN_PATH)tr
diff --git a/user/openjdk7/icedtea-xattr.patch b/user/openjdk7/icedtea-xattr.patch
new file mode 100644
index 000000000..51aee48c4
--- /dev/null
+++ b/user/openjdk7/icedtea-xattr.patch
@@ -0,0 +1,11 @@
+--- openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c.old 2018-10-22 05:32:13.000000000 +0000
++++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c 2019-02-27 01:37:00.950000000 +0000
+@@ -38,7 +38,7 @@
+
+ #ifdef COMPILE_AGAINST_SYSCALLS
+ #include <sys/types.h>
+-#include <attr/xattr.h>
++#include <sys/xattr.h>
+ #else
+ #include <syscalls_fp.h>
+ #endif
diff --git a/user/openjdk7/project-autoconf-2xx.patch b/user/openjdk7/project-autoconf-2xx.patch
new file mode 100644
index 000000000..7930aac2a
--- /dev/null
+++ b/user/openjdk7/project-autoconf-2xx.patch
@@ -0,0 +1,30 @@
+diff -ur a/autogen.sh b/autogen.sh
+--- a/autogen.sh 2022-02-04 04:38:57.470000000 +0000
++++ b/autogen.sh 2022-02-04 04:40:25.330000000 +0000
+@@ -11,7 +11,7 @@
+ AUTOCONF_VERSION=`${AUTOCONF} --version | head -1 | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+ # echo ${AUTOCONF_VERSION}
+ case ${AUTOCONF_VERSION} in
+- 2.59* | 2.6[0-9]* )
++ 2.59* | 2.[0-9]* )
+ HAVE_AUTOCONF=true
+ break;
+ ;;
+@@ -28,7 +28,7 @@
+ AUTOHEADER_VERSION=`${AUTOHEADER} --version | head -1 | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+ # echo ${AUTOHEADER_VERSION}
+ case ${AUTOHEADER_VERSION} in
+- 2.59* | 2.6[0-9]* )
++ 2.59* | 2.[0-9]* )
+ HAVE_AUTOHEADER=true
+ break;
+ ;;
+@@ -45,7 +45,7 @@
+ AUTORECONF_VERSION=`${AUTORECONF} --version | head -1 | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
+ # echo ${AUTORECONF_VERSION}
+ case ${AUTORECONF_VERSION} in
+- 2.59* | 2.6[0-9]* )
++ 2.59* | 2.[0-9]* )
+ HAVE_AUTORECONF=true
+ break;
+ ;;
diff --git a/user/openjdk7/remove-gawk.patch b/user/openjdk7/remove-gawk.patch
new file mode 100644
index 000000000..dccddbab9
--- /dev/null
+++ b/user/openjdk7/remove-gawk.patch
@@ -0,0 +1,125 @@
+--- icedtea-2.6.16/configure.old 2019-01-01 20:11:07.846602426 +0000
++++ icedtea-2.6.16/configure 2019-02-27 00:23:41.230000000 +0000
+@@ -6881,108 +6881,7 @@
+ LDD="$ac_cv_prog_LDD"
+ fi
+
+-if test -n "$ac_tool_prefix"; then
+- # Extract the first word of "${ac_tool_prefix}gawk", so it can be a program name with args.
+-set dummy ${ac_tool_prefix}gawk; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_path_GAWK+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- case $GAWK in
+- [\\/]* | ?:[\\/]*)
+- ac_cv_path_GAWK="$GAWK" # Let the user override the test with a path.
+- ;;
+- *)
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_path_GAWK="$as_dir/$ac_word$ac_exec_ext"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+- ;;
+-esac
+-fi
+-GAWK=$ac_cv_path_GAWK
+-if test -n "$GAWK"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GAWK" >&5
+-$as_echo "$GAWK" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+-
+-fi
+-if test -z "$ac_cv_path_GAWK"; then
+- ac_pt_GAWK=$GAWK
+- # Extract the first word of "gawk", so it can be a program name with args.
+-set dummy gawk; ac_word=$2
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+-$as_echo_n "checking for $ac_word... " >&6; }
+-if ${ac_cv_path_ac_pt_GAWK+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- case $ac_pt_GAWK in
+- [\\/]* | ?:[\\/]*)
+- ac_cv_path_ac_pt_GAWK="$ac_pt_GAWK" # Let the user override the test with a path.
+- ;;
+- *)
+- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH
+-do
+- IFS=$as_save_IFS
+- test -z "$as_dir" && as_dir=.
+- for ac_exec_ext in '' $ac_executable_extensions; do
+- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+- ac_cv_path_ac_pt_GAWK="$as_dir/$ac_word$ac_exec_ext"
+- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+- break 2
+- fi
+-done
+- done
+-IFS=$as_save_IFS
+-
+- ;;
+-esac
+-fi
+-ac_pt_GAWK=$ac_cv_path_ac_pt_GAWK
+-if test -n "$ac_pt_GAWK"; then
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_GAWK" >&5
+-$as_echo "$ac_pt_GAWK" >&6; }
+-else
+- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+-$as_echo "no" >&6; }
+-fi
+-
+- if test "x$ac_pt_GAWK" = x; then
+- GAWK=""
+- else
+- case $cross_compiling:$ac_tool_warned in
+-yes:)
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+-ac_tool_warned=yes ;;
+-esac
+- GAWK=$ac_pt_GAWK
+- fi
+-else
+- GAWK="$ac_cv_path_GAWK"
+-fi
+-
+- if test x"$GAWK" = x ; then
+- as_fn_error $? "The following program was not found on the PATH: gawk" "$LINENO" 5
+- fi
+-
++GAWK="$AWK"
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args.
+--- icedtea-2.6.16/configure.ac.old 2019-01-01 20:09:39.139994680 +0000
++++ icedtea-2.6.16/configure.ac 2019-02-27 00:25:01.960000000 +0000
+@@ -39,9 +39,7 @@
+ IT_FIND_TOOLS([FASTJAR], [fastjar jar])
+ IT_FIND_TOOLS([SED],[gsed sed])
+ AC_CHECK_TOOL([LDD], [ldd])
+-dnl OpenJDK's README-builds.html lists gawk as a build dependency so we
+-dnl check for it explicitly rather than using AC_PROG_AWK.
+-IT_FIND_TOOL([GAWK], [gawk])
++IT_FIND_TOOL([GAWK], [awk])
+ IT_FIND_TOOL([PERL], [perl])
+ IT_CHECK_FOR_MERCURIAL
+ IT_OBTAIN_HG_REVISIONS
diff --git a/user/openjdk7/xattr.patch b/user/openjdk7/xattr.patch
new file mode 100644
index 000000000..258f9f12d
--- /dev/null
+++ b/user/openjdk7/xattr.patch
@@ -0,0 +1,11 @@
+--- icedtea-2.6.16/acinclude.m4.old 2019-01-01 20:09:39.127994868 +0000
++++ icedtea-2.6.16/acinclude.m4 2019-02-27 00:35:33.320000000 +0000
+@@ -2271,7 +2271,7 @@
+ dnl Check for syscalls
+ AC_CHECK_FUNCS([openat64 fstatat64 fgetxattr fsetxattr fremovexattr flistxattr unlinkat renameat futimesat fdopendir epoll_create epoll_ctl epoll_wait],,
+ [AC_MSG_ERROR([Could not find required syscalls; check config.log and use --disable-compile-against-syscalls if necessary.])])
+- AC_CHECK_HEADERS([sys/epoll.h attr/xattr.h],
++ AC_CHECK_HEADERS([sys/epoll.h sys/xattr.h],
+ , [AC_MSG_ERROR([Could not find required system headers; install the appropriate files from glibc-headers, libc6-dev and/or libattr-devel, libattr1-dev or use --disable-compile-against-syscalls if necessary.])])
+ ENABLE_SYSCALL_COMPILATION=true
+ fi