wok-next rev 21060

Update: binutils (2.31.1), bison (3.2.2), gcc (8.2.0), glibc (2.28), linux (4.14.85)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Dec 05 02:04:28 2018 +0200 (2018-12-05)
parents 5792a639ec6f
children 1f4b1992db1f
files binutils/receipt bison/receipt gcc/.icon.png gcc/receipt gcc/stuff/patches/0002-posix_memalign.patch gcc/stuff/patches/0003-gcc-poison-system-directories.patch gcc/stuff/patches/0008-s390x-muslldso.patch gcc/stuff/patches/0010-ldbl128-config.patch gcc/stuff/patches/0012-static-pie.patch gcc/stuff/patches/002_all_default-relro.patch gcc/stuff/patches/003_all_default-fortify-source.patch gcc/stuff/patches/005_all_default-as-needed.patch gcc/stuff/patches/011_all_default-warn-format-security.patch gcc/stuff/patches/012_all_default-warn-trampolines.patch gcc/stuff/patches/013_all_default-ssp-fix.patch gcc/stuff/patches/020_all_msgfmt-libstdc++-link.patch gcc/stuff/patches/050_all_libiberty-asprintf.patch gcc/stuff/patches/051_all_libiberty-pic.patch gcc/stuff/patches/053_all_libitm-no-fortify-source.patch gcc/stuff/patches/090_all_pr55930-dependency-tracking.patch gcc/stuff/patches/203-libgcc_s.patch gcc/stuff/patches/205-nopie.patch gcc/stuff/patches/320-libffi-gnulinux.patch gcc/stuff/patches/ada-musl.patch gcc/stuff/patches/ada-shared.patch gcc/stuff/patches/fix-cxxflags-passing.patch gcc/stuff/patches/gcc-4.9-musl-fortify.patch gcc/stuff/patches/gcc-6.1-musl-libssp.patch gcc/stuff/patches/gcc-as-needed-gold.patch gcc/stuff/patches/gcc-as-needed-push-pop.patch gcc/stuff/patches/gcc-pure64-mips.patch gcc/stuff/patches/gcc-pure64.patch gcc/stuff/patches/libgcc-always-build-gcceh.a.patch gcc/stuff/patches/libgnarl-musl.patch gcc/stuff/patches/series glibc/receipt glibc/stuff/patches/glibc-2.26-fhs-1.patch glibc/stuff/patches/glibc-2.26-math-1.patch glibc/stuff/patches/glibc-2.26-math-2.patch glibc/stuff/patches/glibc-2.26-math-3.patch glibc/stuff/patches/glibc-2.28-fhs-1.patch glibc/stuff/patches/series linux/receipt slitaz-toolchain/receipt
line diff
     1.1 --- a/binutils/receipt	Tue Dec 04 13:43:21 2018 +0200
     1.2 +++ b/binutils/receipt	Wed Dec 05 02:04:28 2018 +0200
     1.3 @@ -1,13 +1,13 @@
     1.4  # SliTaz package receipt v2.
     1.5  
     1.6  PACKAGE="binutils"
     1.7 -VERSION="2.29"
     1.8 +VERSION="2.31.1"
     1.9  CATEGORY="development"
    1.10  SHORT_DESC="GNU assembler, linker and binary utilities"
    1.11  MAINTAINER="devel@slitaz.org"
    1.12  LICENSE="GPL2 LGPL2 GPL3 LGPL3"
    1.13 -WEB_SITE="http://www.gnu.org/software/binutils/"
    1.14 -LFS="http://www.linuxfromscratch.org/lfs/view/stable/chapter06/binutils.html"
    1.15 +WEB_SITE="https://www.gnu.org/software/binutils/"
    1.16 +LFS="http://www.linuxfromscratch.org/lfs/view/development/chapter06/binutils.html"
    1.17  
    1.18  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    1.19  WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    1.20 @@ -15,10 +15,16 @@
    1.21  BUILD_DEPENDS="glibc-dev zlib-dev texinfo bison flex gettext"
    1.22  SPLIT="libbfd $PACKAGE"
    1.23  
    1.24 +COPY_libbfd="libbfd*.so"
    1.25 +COPY_std="@std @dev @rm"
    1.26 +
    1.27 +CAT_libbfd="system-tools|Binary File Descriptor library"
    1.28 +TAGS_std="LFS assembler linker"
    1.29 +
    1.30 +DEPENDS_libbfd="zlib"
    1.31 +DEPENDS_std="libbfd zlib   flex glibc"
    1.32 +
    1.33  compile_rules() {
    1.34 -	mkdir build
    1.35 -	cd    build
    1.36 -
    1.37  	./configure \
    1.38  		--enable-gold \
    1.39  		--enable-ld=default \
    1.40 @@ -38,21 +44,6 @@
    1.41  		ln -s $TOOLPREFIX$i $i
    1.42  	done
    1.43  
    1.44 -#	# Install libiberty (-liberty flag): dependency described in *.la files
    1.45 -#	install -o root -g root -m 644 $src/include/libiberty.h $install/usr/include
    1.46 +	# Install libiberty (-liberty flag): dependency described in *.la files
    1.47 +	install -m644 $src/include/libiberty.h $install/usr/include
    1.48  }
    1.49 -
    1.50 -genpkg_rules() {
    1.51 -	case $PACKAGE in
    1.52 -		libbfd)
    1.53 -			copy libbfd*.so
    1.54 -			CAT="system-tools|Binary File Descriptor library"
    1.55 -			DEPENDS="zlib"
    1.56 -			;;
    1.57 -		binutils)
    1.58 -			copy @std @dev @rm
    1.59 -			DEPENDS="libbfd zlib   flex glibc"
    1.60 -			TAGS="LFS assembler linker"
    1.61 -			;;
    1.62 -	esac
    1.63 -}
     2.1 --- a/bison/receipt	Tue Dec 04 13:43:21 2018 +0200
     2.2 +++ b/bison/receipt	Wed Dec 05 02:04:28 2018 +0200
     2.3 @@ -1,28 +1,25 @@
     2.4  # SliTaz package receipt v2.
     2.5  
     2.6  PACKAGE="bison"
     2.7 -VERSION="3.2"
     2.8 +VERSION="3.2.2"
     2.9  CATEGORY="development"
    2.10  SHORT_DESC="GNU parser generator"
    2.11  MAINTAINER="al.bobylev@gmail.com"
    2.12  LICENSE="GPL3"
    2.13  WEB_SITE="https://www.gnu.org/software/bison/"
    2.14 -LFS="http://www.linuxfromscratch.org/lfs/view/stable/chapter06/bison.html"
    2.15 +LFS="http://www.linuxfromscratch.org/lfs/view/development/chapter06/bison.html"
    2.16  
    2.17  TARBALL="$PACKAGE-$VERSION.tar.xz"
    2.18  WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    2.19  
    2.20  BUILD_DEPENDS="m4 perl libxslt gettext-dev"
    2.21  
    2.22 +COPY_std="@std @dev"
    2.23 +DEPENDS_std="m4"
    2.24 +TAGS_std="LFS parser language"
    2.25 +
    2.26  compile_rules() {
    2.27  	./configure $CONFIGURE_ARGS &&
    2.28  	make &&
    2.29  	make install
    2.30  }
    2.31 -
    2.32 -genpkg_rules() {
    2.33 -	copy @std @dev
    2.34 -	rm -rf $fs/usr/share/doc # one *.h file copied here with @dev
    2.35 -	DEPENDS="m4"
    2.36 -	TAGS="LFS parser language"
    2.37 -}
     3.1 Binary file gcc/.icon.png has changed
     4.1 --- a/gcc/receipt	Tue Dec 04 13:43:21 2018 +0200
     4.2 +++ b/gcc/receipt	Wed Dec 05 02:04:28 2018 +0200
     4.3 @@ -2,13 +2,13 @@
     4.4  
     4.5  # Note, currently first pass is broken. Sorry.
     4.6  PACKAGE="gcc"
     4.7 -VERSION="7.3.0"
     4.8 +VERSION="8.2.0"
     4.9  CATEGORY="development"
    4.10  SHORT_DESC="The GNU Compiler Collection"
    4.11  MAINTAINER="devel@slitaz.org"
    4.12  LICENSE="GPL2"
    4.13  WEB_SITE="http://gcc.gnu.org/"
    4.14 -LFS="http://www.linuxfromscratch.org/lfs/view/stable/chapter06/gcc.html"
    4.15 +LFS="http://www.linuxfromscratch.org/lfs/view/development/chapter06/gcc.html"
    4.16  
    4.17  TARBALL="$PACKAGE-$VERSION.tar.xz"
    4.18  WGET_URL="http://ftp.gnu.org/gnu/gcc/gcc-$VERSION/$TARBALL"
    4.19 @@ -16,6 +16,7 @@
    4.20  BUILD_DEPENDS="mpc-library-dev mpfr-dev gmp-dev elfutils-dev zlib-dev"
    4.21  SPLIT="$PACKAGE-lib-base $PACKAGE-lib-math libgfortran gfortran libgomp libobjc \
    4.22  libatomic $PACKAGE"
    4.23 +COOKOPTS="skip-log-errors"
    4.24  
    4.25  if [ "$2" == "--first-pass" -o "$3" == "--first-pass" ]; then
    4.26  	STAGE='first'
    4.27 @@ -26,7 +27,7 @@
    4.28  	# Handle cross compilation (native i486/ARM gcc)
    4.29  	case "$ARCH" in
    4.30  		i?86)
    4.31 -			ARCH_ARGS="--with-tune=$ARCH"
    4.32 +			ARCH_ARGS="--with-arch=$ARCH --with-tune=generic --enable-cld"
    4.33  			pkgversion="SliTaz"
    4.34  			languages="c,c++,objc,fortran"
    4.35  			sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in
    4.36 @@ -76,6 +77,7 @@
    4.37  				--enable-languages=$languages \
    4.38  				--disable-multilib \
    4.39  				--disable-bootstrap \
    4.40 +				--disable-libmpx \
    4.41  				--with-system-zlib \
    4.42  				--with-pkgversion="$pkgversion" \
    4.43  				$CONFIGURE_ARGS $ARCH_ARGS
    4.44 @@ -99,8 +101,7 @@
    4.45  	# http://www.linuxfromscratch.org/lfs/view/stable/chapter06/strippingagain.html
    4.46  
    4.47  	[ "$STAGE" == 'first' ] ||
    4.48 -	for i in libquadmath.so.0.0.0 libstdc++.so.6.0.24 libmpx.so.2.0.1 \
    4.49 -		libmpxwrappers.so.2.0.1 libitm.so.1.0.0 libcilkrts.so.5.0.0 \
    4.50 +	for i in libquadmath.so.0.0.0 libstdc++.so.6.0.25 libitm.so.1.0.0 \
    4.51  		libatomic.so.1.2.0; do
    4.52  		cd $install/usr/lib/
    4.53  		objcopy --only-keep-debug $i $i.dbg
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/gcc/stuff/patches/0002-posix_memalign.patch	Wed Dec 05 02:04:28 2018 +0200
     5.3 @@ -0,0 +1,42 @@
     5.4 +From 65eb86f3e110998d30489df009d44b4bc1043adc Mon Sep 17 00:00:00 2001
     5.5 +From: Szabolcs Nagy <nsz@port70.net>
     5.6 +Date: Fri, 26 Jan 2018 20:32:50 +0000
     5.7 +Subject: [PATCH 02/12] posix_memalign
     5.8 +
     5.9 +---
    5.10 + gcc/config/i386/pmm_malloc.h | 9 +++++----
    5.11 + 1 file changed, 5 insertions(+), 4 deletions(-)
    5.12 +
    5.13 +diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h
    5.14 +index ffbb7f82cf5..b0b890d2403 100644
    5.15 +--- a/gcc/config/i386/pmm_malloc.h
    5.16 ++++ b/gcc/config/i386/pmm_malloc.h
    5.17 +@@ -27,12 +27,13 @@
    5.18 + #include <stdlib.h>
    5.19 + 
    5.20 + /* We can't depend on <stdlib.h> since the prototype of posix_memalign
    5.21 +-   may not be visible.  */
    5.22 ++   may not be visible and we can't pollute the namespace either.  */
    5.23 + #ifndef __cplusplus
    5.24 +-extern int posix_memalign (void **, size_t, size_t);
    5.25 ++extern int _mm_posix_memalign (void **, size_t, size_t)
    5.26 + #else
    5.27 +-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
    5.28 ++extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw ()
    5.29 + #endif
    5.30 ++__asm__("posix_memalign");
    5.31 + 
    5.32 + static __inline void *
    5.33 + _mm_malloc (size_t __size, size_t __alignment)
    5.34 +@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment)
    5.35 +     return malloc (__size);
    5.36 +   if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4))
    5.37 +     __alignment = sizeof (void *);
    5.38 +-  if (posix_memalign (&__ptr, __alignment, __size) == 0)
    5.39 ++  if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0)
    5.40 +     return __ptr;
    5.41 +   else
    5.42 +     return NULL;
    5.43 +-- 
    5.44 +2.17.1
    5.45 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/gcc/stuff/patches/0003-gcc-poison-system-directories.patch	Wed Dec 05 02:04:28 2018 +0200
     6.3 @@ -0,0 +1,194 @@
     6.4 +From 48c670d2678e0323d88eb72205e039f393cabe05 Mon Sep 17 00:00:00 2001
     6.5 +From: Khem Raj <raj.khem@gmail.com>
     6.6 +Date: Fri, 29 Mar 2013 08:59:00 +0400
     6.7 +Subject: [PATCH 03/39] gcc: poison-system-directories
     6.8 +
     6.9 +Signed-off-by: Khem Raj <raj.khem@gmail.com>
    6.10 +
    6.11 +Upstream-Status: Inappropriate [distribution: codesourcery]
    6.12 +---
    6.13 + gcc/common.opt      |  4 ++++
    6.14 + gcc/config.in       |  6 ++++++
    6.15 + gcc/configure       | 16 ++++++++++++++++
    6.16 + gcc/configure.ac    | 10 ++++++++++
    6.17 + gcc/doc/invoke.texi |  9 +++++++++
    6.18 + gcc/gcc.c           |  2 ++
    6.19 + gcc/incpath.c       | 19 +++++++++++++++++++
    6.20 + 7 files changed, 66 insertions(+)
    6.21 +
    6.22 +diff --git a/gcc/common.opt b/gcc/common.opt
    6.23 +index d6ef85928f3..7b29efe3882 100644
    6.24 +--- a/gcc/common.opt
    6.25 ++++ b/gcc/common.opt
    6.26 +@@ -679,6 +679,10 @@ Wreturn-local-addr
    6.27 + Common Var(warn_return_local_addr) Init(1) Warning
    6.28 + Warn about returning a pointer/reference to a local or temporary variable.
    6.29 + 
    6.30 ++Wpoison-system-directories
    6.31 ++Common Var(flag_poison_system_directories) Init(1) Warning
    6.32 ++Warn for -I and -L options using system directories if cross compiling
    6.33 ++
    6.34 + Wshadow
    6.35 + Common Var(warn_shadow) Warning
    6.36 + Warn when one variable shadows another.  Same as -Wshadow=global.
    6.37 +diff --git a/gcc/config.in b/gcc/config.in
    6.38 +index 5bccb408016..1c784a8276b 100644
    6.39 +--- a/gcc/config.in
    6.40 ++++ b/gcc/config.in
    6.41 +@@ -194,6 +194,12 @@
    6.42 + #endif
    6.43 + 
    6.44 + 
    6.45 ++/* Define to warn for use of native system header directories */
    6.46 ++#ifndef USED_FOR_TARGET
    6.47 ++#undef ENABLE_POISON_SYSTEM_DIRECTORIES
    6.48 ++#endif
    6.49 ++
    6.50 ++
    6.51 + /* Define if you want all operations on RTL (the basic data structure of the
    6.52 +    optimizer and back end) to be checked for dynamic type safety at runtime.
    6.53 +    This is quite expensive. */
    6.54 +diff --git a/gcc/configure b/gcc/configure
    6.55 +index 5c345ce0fd7..cafd05fd150 100755
    6.56 +--- a/gcc/configure
    6.57 ++++ b/gcc/configure
    6.58 +@@ -953,6 +953,7 @@ with_system_zlib
    6.59 + enable_maintainer_mode
    6.60 + enable_link_mutex
    6.61 + enable_version_specific_runtime_libs
    6.62 ++enable_poison_system_directories
    6.63 + enable_plugin
    6.64 + enable_host_shared
    6.65 + enable_libquadmath_support
    6.66 +@@ -1696,6 +1697,8 @@ Optional Features:
    6.67 +   --enable-version-specific-runtime-libs
    6.68 +                           specify that runtime libraries should be installed
    6.69 +                           in a compiler-specific directory
    6.70 ++  --enable-poison-system-directories
    6.71 ++                          warn for use of native system header directories
    6.72 +   --enable-plugin         enable plugin support
    6.73 +   --enable-host-shared    build host code as shared libraries
    6.74 +   --disable-libquadmath-support
    6.75 +@@ -29715,6 +29718,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
    6.76 + fi
    6.77 + 
    6.78 + 
    6.79 ++# Check whether --enable-poison-system-directories was given.
    6.80 ++if test "${enable_poison_system_directories+set}" = set; then :
    6.81 ++  enableval=$enable_poison_system_directories;
    6.82 ++else
    6.83 ++  enable_poison_system_directories=no
    6.84 ++fi
    6.85 ++
    6.86 ++if test "x${enable_poison_system_directories}" = "xyes"; then
    6.87 ++
    6.88 ++$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
    6.89 ++
    6.90 ++fi
    6.91 ++
    6.92 + # Substitute configuration variables
    6.93 + 
    6.94 + 
    6.95 +diff --git a/gcc/configure.ac b/gcc/configure.ac
    6.96 +index 65dbf1f2f80..dd5b38195ce 100644
    6.97 +--- a/gcc/configure.ac
    6.98 ++++ b/gcc/configure.ac
    6.99 +@@ -6341,6 +6341,16 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
   6.100 +                 [specify that runtime libraries should be
   6.101 +                  installed in a compiler-specific directory])])
   6.102 + 
   6.103 ++AC_ARG_ENABLE([poison-system-directories],
   6.104 ++             AS_HELP_STRING([--enable-poison-system-directories],
   6.105 ++                            [warn for use of native system header directories]),,
   6.106 ++             [enable_poison_system_directories=no])
   6.107 ++if test "x${enable_poison_system_directories}" = "xyes"; then
   6.108 ++  AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
   6.109 ++           [1],
   6.110 ++           [Define to warn for use of native system header directories])
   6.111 ++fi
   6.112 ++
   6.113 + # Substitute configuration variables
   6.114 + AC_SUBST(subdirs)
   6.115 + AC_SUBST(srcdir)
   6.116 +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
   6.117 +index 255149fcfb8..cb71b60fe3c 100644
   6.118 +--- a/gcc/doc/invoke.texi
   6.119 ++++ b/gcc/doc/invoke.texi
   6.120 +@@ -303,6 +303,7 @@ Objective-C and Objective-C++ Dialects}.
   6.121 + -Wpacked  -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
   6.122 + -Wparentheses  -Wno-pedantic-ms-format @gol
   6.123 + -Wplacement-new  -Wplacement-new=@var{n} @gol
   6.124 ++-Wno-poison-system-directories @gol
   6.125 + -Wpointer-arith  -Wpointer-compare  -Wno-pointer-to-int-cast @gol
   6.126 + -Wno-pragmas  -Wredundant-decls  -Wrestrict  -Wno-return-local-addr @gol
   6.127 + -Wreturn-type  -Wsequence-point  -Wshadow  -Wno-shadow-ivar @gol
   6.128 +@@ -5712,6 +5713,14 @@ made up of data only and thus requires no special treatment.  But, for
   6.129 + most targets, it is made up of code and thus requires the stack to be
   6.130 + made executable in order for the program to work properly.
   6.131 + 
   6.132 ++@item -Wno-poison-system-directories
   6.133 ++@opindex Wno-poison-system-directories
   6.134 ++Do not warn for @option{-I} or @option{-L} options using system
   6.135 ++directories such as @file{/usr/include} when cross compiling.  This
   6.136 ++option is intended for use in chroot environments when such
   6.137 ++directories contain the correct headers and libraries for the target
   6.138 ++system rather than the host.
   6.139 ++
   6.140 + @item -Wfloat-equal
   6.141 + @opindex Wfloat-equal
   6.142 + @opindex Wno-float-equal
   6.143 +diff --git a/gcc/gcc.c b/gcc/gcc.c
   6.144 +index a716f708259..02b3cd39fc2 100644
   6.145 +--- a/gcc/gcc.c
   6.146 ++++ b/gcc/gcc.c
   6.147 +@@ -1037,6 +1037,8 @@ proper position among the other output files.  */
   6.148 +    "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
   6.149 +    "%X %{o*} %{e*} %{N} %{n} %{r}\
   6.150 +     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \
   6.151 ++    %{Wno-poison-system-directories:--no-poison-system-directories} \
   6.152 ++    %{Werror=poison-system-directories:--error-poison-system-directories} \
   6.153 +     %{static|no-pie|static-pie:} %{L*} %(mfwrap) %(link_libgcc) " \
   6.154 +     VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \
   6.155 +     %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
   6.156 +diff --git a/gcc/incpath.c b/gcc/incpath.c
   6.157 +index b11c6a57939..e3b7a21966f 100644
   6.158 +--- a/gcc/incpath.c
   6.159 ++++ b/gcc/incpath.c
   6.160 +@@ -26,6 +26,7 @@
   6.161 + #include "intl.h"
   6.162 + #include "incpath.h"
   6.163 + #include "cppdefault.h"
   6.164 ++#include "diagnostic-core.h"
   6.165 + 
   6.166 + /* Microsoft Windows does not natively support inodes.
   6.167 +    VMS has non-numeric inodes.  */
   6.168 +@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
   6.169 + 	}
   6.170 +       fprintf (stderr, _("End of search list.\n"));
   6.171 +     }
   6.172 ++
   6.173 ++#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
   6.174 ++  if (flag_poison_system_directories)
   6.175 ++    {
   6.176 ++       struct cpp_dir *p;
   6.177 ++
   6.178 ++       for (p = heads[INC_QUOTE]; p; p = p->next)
   6.179 ++         {
   6.180 ++          if ((!strncmp (p->name, "/usr/include", 12))
   6.181 ++              || (!strncmp (p->name, "/usr/local/include", 18))
   6.182 ++              || (!strncmp (p->name, "/usr/X11R6/include", 18))
   6.183 ++              || (!strncmp (p->name, "/sw/include", 11))
   6.184 ++              || (!strncmp (p->name, "/opt/include", 12)))
   6.185 ++            warning (OPT_Wpoison_system_directories,
   6.186 ++                     "include location \"%s\" is unsafe for "
   6.187 ++                     "cross-compilation",
   6.188 ++                     p->name);
   6.189 ++         }
   6.190 ++    }
   6.191 ++#endif
   6.192 + }
   6.193 + 
   6.194 + /* Use given -I paths for #include "..." but not #include <...>, and
   6.195 +-- 
   6.196 +2.17.0
   6.197 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/gcc/stuff/patches/0008-s390x-muslldso.patch	Wed Dec 05 02:04:28 2018 +0200
     7.3 @@ -0,0 +1,26 @@
     7.4 +From b693804c8dba92fea7beee98f0aa520853a0532b Mon Sep 17 00:00:00 2001
     7.5 +From: Szabolcs Nagy <nsz@port70.net>
     7.6 +Date: Thu, 22 Dec 2016 11:22:28 +0000
     7.7 +Subject: [PATCH 08/12] s390x muslldso
     7.8 +
     7.9 +---
    7.10 + gcc/config/s390/linux.h | 3 +++
    7.11 + 1 file changed, 3 insertions(+)
    7.12 +
    7.13 +diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
    7.14 +index 525c17c2c9f..2d4f4a0654e 100644
    7.15 +--- a/gcc/config/s390/linux.h
    7.16 ++++ b/gcc/config/s390/linux.h
    7.17 +@@ -76,6 +76,9 @@ along with GCC; see the file COPYING3.  If not see
    7.18 + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
    7.19 + #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
    7.20 + 
    7.21 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
    7.22 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
    7.23 ++
    7.24 + #undef  LINK_SPEC
    7.25 + #define LINK_SPEC \
    7.26 +   "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
    7.27 +-- 
    7.28 +2.17.1
    7.29 +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/gcc/stuff/patches/0010-ldbl128-config.patch	Wed Dec 05 02:04:28 2018 +0200
     8.3 @@ -0,0 +1,76 @@
     8.4 +From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
     8.5 +From: Szabolcs Nagy <nsz@port70.net>
     8.6 +Date: Wed, 28 Feb 2018 00:54:05 +0000
     8.7 +Subject: [PATCH 10/12] ldbl128 config
     8.8 +
     8.9 +---
    8.10 + gcc/configure    | 13 +++++++++++++
    8.11 + gcc/configure.ac | 16 ++++++++++++++--
    8.12 + 2 files changed, 27 insertions(+), 2 deletions(-)
    8.13 +
    8.14 +diff --git a/gcc/configure b/gcc/configure
    8.15 +index 6121e163259..07ff8597d48 100755
    8.16 +--- a/gcc/configure
    8.17 ++++ b/gcc/configure
    8.18 +@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
    8.19 +   withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
    8.20 + else
    8.21 + 
    8.22 ++      case "$target" in
    8.23 ++	s390*-*-linux-musl*)
    8.24 ++	  gcc_cv_target_ldbl128=yes
    8.25 ++	  ;;
    8.26 ++	powerpc*-*-linux-musl*)
    8.27 ++	  gcc_cv_target_ldbl128=no
    8.28 ++	  ;;
    8.29 ++	*)
    8.30 ++
    8.31 + if test $glibc_version_major -gt 2 \
    8.32 +   || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
    8.33 +   gcc_cv_target_ldbl128=yes
    8.34 +@@ -29320,6 +29329,10 @@ else
    8.35 +       && gcc_cv_target_ldbl128=yes
    8.36 + 
    8.37 + fi
    8.38 ++
    8.39 ++	  ;;
    8.40 ++      esac
    8.41 ++
    8.42 + fi
    8.43 + 
    8.44 +     ;;
    8.45 +diff --git a/gcc/configure.ac b/gcc/configure.ac
    8.46 +index b066cc609e1..6c15ed898c0 100644
    8.47 +--- a/gcc/configure.ac
    8.48 ++++ b/gcc/configure.ac
    8.49 +@@ -5971,13 +5971,25 @@ case "$target" in
    8.50 +     AC_ARG_WITH(long-double-128,
    8.51 +       [AS_HELP_STRING([--with-long-double-128],
    8.52 + 		      [use 128-bit long double by default])],
    8.53 +-      gcc_cv_target_ldbl128="$with_long_double_128",
    8.54 ++      gcc_cv_target_ldbl128="$with_long_double_128", [
    8.55 ++      case "$target" in
    8.56 ++	s390*-*-linux-musl*)
    8.57 ++	  gcc_cv_target_ldbl128=yes
    8.58 ++	  ;;
    8.59 ++	powerpc*-*-linux-musl*)
    8.60 ++	  gcc_cv_target_ldbl128=no
    8.61 ++	  ;;
    8.62 ++	*)]
    8.63 +       [GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
    8.64 +       [gcc_cv_target_ldbl128=no
    8.65 +       grep '^[ 	]*#[ 	]*define[ 	][ 	]*__LONG_DOUBLE_MATH_OPTIONAL' \
    8.66 +         $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
    8.67 +       && gcc_cv_target_ldbl128=yes
    8.68 +-      ]])])
    8.69 ++      ]])]
    8.70 ++      [
    8.71 ++	  ;;
    8.72 ++      esac
    8.73 ++      ])
    8.74 +     ;;
    8.75 + esac
    8.76 + if test x$gcc_cv_target_ldbl128 = xyes; then
    8.77 +-- 
    8.78 +2.17.1
    8.79 +
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/gcc/stuff/patches/0012-static-pie.patch	Wed Dec 05 02:04:28 2018 +0200
     9.3 @@ -0,0 +1,138 @@
     9.4 +From a4aa319f7c19e564dced3daeb7222c9315af936c Mon Sep 17 00:00:00 2001
     9.5 +From: Szabolcs Nagy <nsz@port70.net>
     9.6 +Date: Sat, 18 Aug 2018 23:58:45 +0000
     9.7 +Subject: [PATCH 12/12] static-pie
     9.8 +
     9.9 +in gcc-8 -static means static non-pie, even if -pie or -static-pie
    9.10 +are specified, -static-pie can be used to build static pie.
    9.11 +
    9.12 +in musl toolchains -static -pie always meant static pie, so this
    9.13 +patch fixes the link specs accordingly, the new -static-pie is just
    9.14 +an alias to -static -pie.
    9.15 +---
    9.16 + gcc/common.opt            |  4 ++--
    9.17 + gcc/config/gnu-user.h     | 12 +++++-------
    9.18 + gcc/config/rs6000/sysv4.h | 11 +++++------
    9.19 + gcc/gcc.c                 |  6 +++---
    9.20 + 4 files changed, 15 insertions(+), 18 deletions(-)
    9.21 +
    9.22 +diff --git a/gcc/common.opt b/gcc/common.opt
    9.23 +index b52ef0b38c8..0ce5857e01d 100644
    9.24 +--- a/gcc/common.opt
    9.25 ++++ b/gcc/common.opt
    9.26 +@@ -3197,11 +3197,11 @@ Driver
    9.27 + 
    9.28 + no-pie
    9.29 + Driver RejectNegative Negative(shared)
    9.30 +-Don't create a dynamically linked position independent executable.
    9.31 ++Don't create a position independent executable.
    9.32 + 
    9.33 + pie
    9.34 + Driver RejectNegative Negative(no-pie)
    9.35 +-Create a dynamically linked position independent executable.
    9.36 ++Create a position independent executable.
    9.37 + 
    9.38 + static-pie
    9.39 + Driver RejectNegative Negative(pie)
    9.40 +diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h
    9.41 +index 8620de3e42d..235328a2642 100644
    9.42 +--- a/gcc/config/gnu-user.h
    9.43 ++++ b/gcc/config/gnu-user.h
    9.44 +@@ -52,13 +52,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    9.45 + #define GNU_USER_TARGET_STARTFILE_SPEC \
    9.46 +   "%{shared:; \
    9.47 +      pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
    9.48 +-     static:crt1.o%s; \
    9.49 +-     static-pie:rcrt1.o%s; \
    9.50 ++     static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
    9.51 +      " PIE_SPEC ":Scrt1.o%s; \
    9.52 +      :crt1.o%s} \
    9.53 +    crti.o%s \
    9.54 +-   %{static:crtbeginT.o%s; \
    9.55 +-     shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
    9.56 ++   %{shared|" PIE_SPEC ":crtbeginS.o%s; \
    9.57 ++     static:crtbeginT.o%s; \
    9.58 +      :crtbegin.o%s} \
    9.59 +    %{fvtable-verify=none:%s; \
    9.60 +      fvtable-verify=preinit:vtv_start_preinit.o%s; \
    9.61 +@@ -92,8 +91,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    9.62 +   "%{fvtable-verify=none:%s; \
    9.63 +      fvtable-verify=preinit:vtv_end_preinit.o%s; \
    9.64 +      fvtable-verify=std:vtv_end.o%s} \
    9.65 +-   %{static:crtend.o%s; \
    9.66 +-     shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
    9.67 ++   %{shared|" PIE_SPEC ":crtendS.o%s; \
    9.68 +      :crtend.o%s} \
    9.69 +    crtn.o%s \
    9.70 +    " CRTOFFLOADEND
    9.71 +@@ -133,7 +131,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    9.72 + #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
    9.73 + 
    9.74 + #if defined(HAVE_LD_EH_FRAME_HDR)
    9.75 +-#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
    9.76 ++#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} "
    9.77 + #endif
    9.78 + 
    9.79 + #undef LINK_GCC_C_SEQUENCE_SPEC
    9.80 +diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
    9.81 +index bb19d0dcd41..bb2a2324eb0 100644
    9.82 +--- a/gcc/config/rs6000/sysv4.h
    9.83 ++++ b/gcc/config/rs6000/sysv4.h
    9.84 +@@ -763,12 +763,12 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
    9.85 + #define	STARTFILE_LINUX_SPEC \
    9.86 +   "%{shared:; \
    9.87 +      pg|p|profile:gcrt1.o%s; \
    9.88 +-     static:crt1.o%s; \
    9.89 +-     static-pie|" PIE_SPEC ":Scrt1.o%s; \
    9.90 ++     static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \
    9.91 ++     " PIE_SPEC ":Scrt1.o%s; \
    9.92 +      :crt1.o%s} \
    9.93 +    %{mnewlib:ecrti.o%s;:crti.o%s} \
    9.94 +-   %{static:crtbeginT.o%s; \
    9.95 +-     shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
    9.96 ++   %{shared|" PIE_SPEC ":crtbeginS.o%s; \
    9.97 ++     static:crtbeginT.o%s; \
    9.98 +      :crtbegin.o%s} \
    9.99 +    %{fvtable-verify=none:%s; \
   9.100 +      fvtable-verify=preinit:vtv_start_preinit.o%s; \
   9.101 +@@ -781,8 +781,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
   9.102 +   "%{fvtable-verify=none:%s; \
   9.103 +      fvtable-verify=preinit:vtv_end_preinit.o%s; \
   9.104 +      fvtable-verify=std:vtv_end.o%s} \
   9.105 +-   %{static:crtend.o%s; \
   9.106 +-     shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
   9.107 ++   %{shared|" PIE_SPEC ":crtendS.o%s; \
   9.108 +      :crtend.o%s} \
   9.109 +    %{mnewlib:ecrtn.o%s;:crtn.o%s} \
   9.110 +    " CRTOFFLOADEND
   9.111 +diff --git a/gcc/gcc.c b/gcc/gcc.c
   9.112 +index eb1610ba8b0..87560afb03c 100644
   9.113 +--- a/gcc/gcc.c
   9.114 ++++ b/gcc/gcc.c
   9.115 +@@ -900,7 +900,7 @@ proper position among the other output files.  */
   9.116 + #define NO_FPIE_AND_FPIC_SPEC	NO_FPIE_SPEC "|" NO_FPIC_SPEC
   9.117 + #define FPIE_OR_FPIC_SPEC	NO_FPIE_AND_FPIC_SPEC ":;"
   9.118 + #else
   9.119 +-#define PIE_SPEC		"pie"
   9.120 ++#define PIE_SPEC		"pie|static-pie"
   9.121 + #define FPIE1_SPEC		"fpie"
   9.122 + #define NO_FPIE1_SPEC		FPIE1_SPEC ":;"
   9.123 + #define FPIE2_SPEC		"fPIE"
   9.124 +@@ -924,12 +924,12 @@ proper position among the other output files.  */
   9.125 + #ifndef LINK_PIE_SPEC
   9.126 + #ifdef HAVE_LD_PIE
   9.127 + #ifndef LD_PIE_SPEC
   9.128 +-#define LD_PIE_SPEC "-pie"
   9.129 ++#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}"
   9.130 + #endif
   9.131 + #else
   9.132 + #define LD_PIE_SPEC ""
   9.133 + #endif
   9.134 +-#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
   9.135 ++#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} "
   9.136 + #endif
   9.137 + 
   9.138 + #ifndef LINK_BUILDID_SPEC
   9.139 +-- 
   9.140 +2.17.1
   9.141 +
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/gcc/stuff/patches/002_all_default-relro.patch	Wed Dec 05 02:04:28 2018 +0200
    10.3 @@ -0,0 +1,33 @@
    10.4 +# Turn on -Wl,-z,relro,-z,now by default.
    10.5 +
    10.6 +---
    10.7 + gcc/doc/invoke.texi |    3 +++
    10.8 + gcc/gcc.c           |    1 +
    10.9 + 2 files changed, 4 insertions(+), 0 deletions(-)
   10.10 +
   10.11 +Index: b/gcc/doc/invoke.texi
   10.12 +===================================================================
   10.13 +--- a/gcc/doc/invoke.texi
   10.14 ++++ b/gcc/doc/invoke.texi
   10.15 +@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map
   10.16 + linker.  When using the GNU linker, you can also get the same effect with
   10.17 + @option{-Wl,-Map=output.map}.
   10.18 + 
   10.19 ++NOTE: In Alpine Linux, for LDFLAGS, the option
   10.20 ++@option{-Wl,-z,relro,now} is used.  To disable, use @option{-Wl,-z,norelro}.
   10.21 ++
   10.22 + @item -u @var{symbol}
   10.23 + @opindex u
   10.24 + Pretend the symbol @var{symbol} is undefined, to force linking of
   10.25 +Index: b/gcc/gcc.c
   10.26 +===================================================================
   10.27 +--- a/gcc/gcc.c
   10.28 ++++ b/gcc/gcc.c
   10.29 +@@ -890,6 +890,7 @@ proper position among the other output f
   10.30 +    "%{flto|flto=*:%<fcompare-debug*} \
   10.31 +     %{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
   10.32 +    "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
   10.33 ++   "-z relro -z now " \
   10.34 +    "%X %{o*} %{e*} %{N} %{n} %{r}\
   10.35 +     %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
   10.36 +     %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/gcc/stuff/patches/003_all_default-fortify-source.patch	Wed Dec 05 02:04:28 2018 +0200
    11.3 @@ -0,0 +1,40 @@
    11.4 +# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
    11.5 +# DP: if the optimization level is > 0
    11.6 +
    11.7 +---
    11.8 + gcc/doc/invoke.texi          |    6 ++++++
    11.9 + gcc/c-family/c-cppbuiltin.c  |    3 +
   11.10 + 2 files changed, 9 insertions(+), 0 deletions(-)
   11.11 +
   11.12 +Index: b/gcc/doc/invoke.texi
   11.13 +===================================================================
   11.14 +--- a/gcc/doc/invoke.texi
   11.15 ++++ b/gcc/doc/invoke.texi
   11.16 +@@ -7840,6 +7840,12 @@ also turns on the following optimization
   11.17 + Please note the warning under @option{-fgcse} about
   11.18 + invoking @option{-O2} on programs that use computed gotos.
   11.19 + 
   11.20 ++NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
   11.21 ++set by default, and is activated when @option{-O} is set to 2 or higher.
   11.22 ++This enables additional compile-time and run-time checks for several libc
   11.23 ++functions.  To disable, specify either @option{-U_FORTIFY_SOURCE} or
   11.24 ++@option{-D_FORTIFY_SOURCE=0}.
   11.25 ++
   11.26 + @item -O3
   11.27 + @opindex O3
   11.28 + Optimize yet more.  @option{-O3} turns on all optimizations specified
   11.29 +Index: b/gcc/c-family/c-cppbuiltin.c
   11.30 +===================================================================
   11.31 +--- a/gcc/c-family/c-cppbuiltin.c
   11.32 ++++ b/gcc/c-family/c-cppbuiltin.c
   11.33 +@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile)
   11.34 +   builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
   11.35 +   builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
   11.36 + 
   11.37 ++  /* Fortify Source enabled by default for optimization levels > 0 */
   11.38 ++  if (optimize)
   11.39 ++    builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
   11.40 ++
   11.41 +   /* Misc.  */
   11.42 +   if (flag_gnu89_inline)
   11.43 +     cpp_define (pfile, "__GNUC_GNU_INLINE__");
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/gcc/stuff/patches/005_all_default-as-needed.patch	Wed Dec 05 02:04:28 2018 +0200
    12.3 @@ -0,0 +1,244 @@
    12.4 +# DP: On linux targets pass --as-needed by default to the linker, but always
    12.5 +# DP: link the sanitizer libraries with --no-as-needed.
    12.6 +
    12.7 +Index: b/gcc/gcc.c
    12.8 +===================================================================
    12.9 +--- a/gcc/gcc.c
   12.10 ++++ b/gcc/gcc.c
   12.11 +@@ -692,8 +692,11 @@ proper position among the other output f
   12.12 + #ifdef LIBASAN_EARLY_SPEC
   12.13 + #define LIBASAN_SPEC STATIC_LIBASAN_LIBS
   12.14 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   12.15 +-#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \
   12.16 +-		     "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \
   12.17 ++#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
   12.18 ++		     " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   12.19 ++		     " -lasan " \
   12.20 ++		     " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
   12.21 ++		     " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   12.22 + 		     STATIC_LIBASAN_LIBS
   12.23 + #else
   12.24 + #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
   12.25 +@@ -710,8 +713,11 @@ proper position among the other output f
   12.26 + #ifdef LIBTSAN_EARLY_SPEC
   12.27 + #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
   12.28 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   12.29 +-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
   12.30 +-		     "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
   12.31 ++#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
   12.32 ++		     " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   12.33 ++		     " -ltsan " \
   12.34 ++		     " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
   12.35 ++		     " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   12.36 + 		     STATIC_LIBTSAN_LIBS
   12.37 + #else
   12.38 + #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
   12.39 +@@ -728,8 +734,11 @@ proper position among the other output f
   12.40 + #ifdef LIBLSAN_EARLY_SPEC
   12.41 + #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
   12.42 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   12.43 +-#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \
   12.44 +-		     "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
   12.45 ++#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
   12.46 ++		     " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   12.47 ++		     " -llsan " \
   12.48 ++		     " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
   12.49 ++		     " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   12.50 + 		     STATIC_LIBLSAN_LIBS
   12.51 + #else
   12.52 + #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
   12.53 +@@ -744,8 +753,11 @@ proper position among the other output f
   12.54 + #define STATIC_LIBUBSAN_LIBS \
   12.55 +   " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
   12.56 + #ifdef HAVE_LD_STATIC_DYNAMIC
   12.57 +-#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \
   12.58 +-		     "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
   12.59 ++#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
   12.60 ++		     " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   12.61 ++		     " -lubsan " \
   12.62 ++		     " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
   12.63 ++		     " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   12.64 + 		     STATIC_LIBUBSAN_LIBS
   12.65 + #else
   12.66 + #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
   12.67 +Index: b/gcc/config/gnu-user.h
   12.68 +===================================================================
   12.69 +--- a/gcc/config/gnu-user.h
   12.70 ++++ b/gcc/config/gnu-user.h
   12.71 +@@ -161,15 +161,15 @@ see the files COPYING3 and COPYING.RUNTI
   12.72 + #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
   12.73 +   "%{static-libasan:%{!shared:" \
   12.74 +   LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
   12.75 +-  LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
   12.76 ++  LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
   12.77 + #undef LIBTSAN_EARLY_SPEC
   12.78 + #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
   12.79 +   "%{static-libtsan:%{!shared:" \
   12.80 +   LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
   12.81 +-  LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
   12.82 ++  LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
   12.83 + #undef LIBLSAN_EARLY_SPEC
   12.84 + #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
   12.85 +   "%{static-liblsan:%{!shared:" \
   12.86 +   LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
   12.87 +-  LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
   12.88 ++  LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
   12.89 + #endif
   12.90 +Index: b/gcc/config/aarch64/aarch64-linux.h
   12.91 +===================================================================
   12.92 +--- a/gcc/config/aarch64/aarch64-linux.h
   12.93 ++++ b/gcc/config/aarch64/aarch64-linux.h
   12.94 +@@ -35,6 +35,7 @@
   12.95 + #define CPP_SPEC "%{pthread:-D_REENTRANT}"
   12.96 + 
   12.97 + #define LINUX_TARGET_LINK_SPEC  "%{h*}		\
   12.98 ++   --as-needed					\
   12.99 +    %{static:-Bstatic}				\
  12.100 +    %{shared:-shared}				\
  12.101 +    %{symbolic:-Bsymbolic}			\
  12.102 +Index: b/gcc/config/ia64/linux.h
  12.103 +===================================================================
  12.104 +--- a/gcc/config/ia64/linux.h
  12.105 ++++ b/gcc/config/ia64/linux.h
  12.106 +@@ -58,7 +58,7 @@ do {						\
  12.107 + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
  12.108 + 
  12.109 + #undef LINK_SPEC
  12.110 +-#define LINK_SPEC "\
  12.111 ++#define LINK_SPEC " --as-needed \
  12.112 +   %{shared:-shared} \
  12.113 +   %{!shared: \
  12.114 +     %{!static: \
  12.115 +Index: b/gcc/config/sparc/linux.h
  12.116 +===================================================================
  12.117 +--- a/gcc/config/sparc/linux.h
  12.118 ++++ b/gcc/config/sparc/linux.h
  12.119 +@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu
  12.120 + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
  12.121 + 
  12.122 + #undef  LINK_SPEC
  12.123 +-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
  12.124 ++#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
  12.125 +   %{!mno-relax:%{!r:-relax}} \
  12.126 +   %{!shared: \
  12.127 +     %{!static: \
  12.128 +Index: b/gcc/config/s390/linux.h
  12.129 +===================================================================
  12.130 +--- a/gcc/config/s390/linux.h
  12.131 ++++ b/gcc/config/s390/linux.h
  12.132 +@@ -78,7 +78,7 @@ along with GCC; see the file COPYING3.
  12.133 + 
  12.134 + #undef  LINK_SPEC
  12.135 + #define LINK_SPEC \
  12.136 +-  "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
  12.137 ++  "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
  12.138 +    %{shared:-shared} \
  12.139 +    %{!shared: \
  12.140 +       %{static:-static} \
  12.141 +Index: b/gcc/config/rs6000/linux64.h
  12.142 +===================================================================
  12.143 +--- a/gcc/config/rs6000/linux64.h
  12.144 ++++ b/gcc/config/rs6000/linux64.h
  12.145 +@@ -490,13 +490,13 @@ extern int dot_symbols;
  12.146 + 					   " -m elf64ppc")
  12.147 + #endif
  12.148 + 
  12.149 +-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
  12.150 ++#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
  12.151 +   %{!static-pie: \
  12.152 +     %{rdynamic:-export-dynamic} \
  12.153 +     -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
  12.154 +   %(link_os_extra_spec32)"
  12.155 + 
  12.156 +-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
  12.157 ++#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
  12.158 +   %{!static-pie: \
  12.159 +     %{rdynamic:-export-dynamic} \
  12.160 +     -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
  12.161 +Index: b/gcc/config/rs6000/sysv4.h
  12.162 +===================================================================
  12.163 +--- a/gcc/config/rs6000/sysv4.h
  12.164 ++++ b/gcc/config/rs6000/sysv4.h
  12.165 +@@ -811,7 +811,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
  12.166 +   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
  12.167 + 			 MUSL_DYNAMIC_LINKER)
  12.168 + 
  12.169 +-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
  12.170 ++#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
  12.171 +   %{rdynamic:-export-dynamic} \
  12.172 +   -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
  12.173 + 
  12.174 +Index: b/gcc/config/i386/gnu-user64.h
  12.175 +===================================================================
  12.176 +--- a/gcc/config/i386/gnu-user64.h
  12.177 ++++ b/gcc/config/i386/gnu-user64.h
  12.178 +@@ -56,6 +56,7 @@
  12.179 +                   "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \
  12.180 +                    %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
  12.181 +                    %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
  12.182 ++  --as-needed \
  12.183 +   %{shared:-shared} \
  12.184 +   %{!shared: \
  12.185 +     %{!static: \
  12.186 +Index: b/gcc/config/i386/gnu-user.h
  12.187 +===================================================================
  12.188 +--- a/gcc/config/i386/gnu-user.h
  12.189 ++++ b/gcc/config/i386/gnu-user.h
  12.190 +@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.
  12.191 +   { "link_emulation", GNU_USER_LINK_EMULATION },\
  12.192 +   { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
  12.193 + 
  12.194 +-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
  12.195 ++#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
  12.196 +   %{!shared: \
  12.197 +     %{!static: \
  12.198 +       %{!static-pie: \
  12.199 +Index: b/gcc/config/alpha/linux-elf.h
  12.200 +===================================================================
  12.201 +--- a/gcc/config/alpha/linux-elf.h
  12.202 ++++ b/gcc/config/alpha/linux-elf.h
  12.203 +@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.
  12.204 + 
  12.205 + #define ELF_DYNAMIC_LINKER	GNU_USER_DYNAMIC_LINKER
  12.206 + 
  12.207 +-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}		\
  12.208 ++#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax}		\
  12.209 +   %{O*:-O3} %{!O*:-O1}						\
  12.210 +   %{shared:-shared}						\
  12.211 +   %{!shared:							\
  12.212 +Index: b/gcc/config/arm/linux-elf.h
  12.213 +===================================================================
  12.214 +--- a/gcc/config/arm/linux-elf.h
  12.215 ++++ b/gcc/config/arm/linux-elf.h
  12.216 +@@ -70,6 +70,7 @@
  12.217 +      %{rdynamic:-export-dynamic} \
  12.218 +      %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
  12.219 +    -X \
  12.220 ++   --as-needed \
  12.221 +    %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
  12.222 +    SUBTARGET_EXTRA_LINK_SPEC
  12.223 + 
  12.224 +Index: b/gcc/config/mips/gnu-user.h
  12.225 +===================================================================
  12.226 +--- a/gcc/config/mips/gnu-user.h
  12.227 ++++ b/gcc/config/mips/gnu-user.h
  12.228 +@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.
  12.229 + #undef GNU_USER_TARGET_LINK_SPEC
  12.230 + #define GNU_USER_TARGET_LINK_SPEC "\
  12.231 +   %{G*} %{EB} %{EL} %{mips*} %{shared} \
  12.232 ++ -as-needed \
  12.233 +   %{!shared: \
  12.234 +     %{!static: \
  12.235 +       %{rdynamic:-export-dynamic} \
  12.236 +Index: b/gcc/config/riscv/linux.h
  12.237 +===================================================================
  12.238 +--- a/gcc/config/riscv/linux.h
  12.239 ++++ b/gcc/config/riscv/linux.h
  12.240 +@@ -50,6 +50,7 @@
  12.241 + #define CPP_SPEC "%{pthread:-D_REENTRANT}"
  12.242 + 
  12.243 + #define LINK_SPEC "\
  12.244 ++-as-needed \
  12.245 + -melf" XLEN_SPEC "lriscv \
  12.246 + %{mno-relax:--no-relax} \
  12.247 + %{shared} \
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/gcc/stuff/patches/011_all_default-warn-format-security.patch	Wed Dec 05 02:04:28 2018 +0200
    13.3 @@ -0,0 +1,22 @@
    13.4 +Enable -Wformat and -Wformat-security by default.
    13.5 +
    13.6 +--- a/gcc/c-family/c.opt	2016-03-23 18:51:56.000000000 +0100
    13.7 ++++ b/gcc/c-family/c.opt	2016-04-28 23:45:54.063351272 +0200
    13.8 +@@ -459,7 +459,7 @@ C ObjC C++ ObjC++ Var(warn_format_nonlit
    13.9 + Warn about format strings that are not literals.
   13.10 + 
   13.11 + Wformat-security
   13.12 +-C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
   13.13 ++C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
   13.14 + Warn about possible security problems with format functions.
   13.15 + 
   13.16 + Wformat-signedness
   13.17 +@@ -475,7 +475,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_l
   13.18 + Warn about zero-length formats.
   13.19 + 
   13.20 + Wformat=
   13.21 +-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
   13.22 ++C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2)
   13.23 + Warn about printf/scanf/strftime/strfmon format string anomalies.
   13.24 + 
   13.25 + Wignored-qualifiers
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/gcc/stuff/patches/012_all_default-warn-trampolines.patch	Wed Dec 05 02:04:28 2018 +0200
    14.3 @@ -0,0 +1,13 @@
    14.4 +Enable -Wtrampolines by default.
    14.5 +
    14.6 +--- a/gcc/common.opt
    14.7 ++++ b/gcc/common.opt
    14.8 +@@ -712,7 +712,7 @@ Common Var(warn_system_headers) Warning
    14.9 + Do not suppress warnings from system headers.
   14.10 + 
   14.11 + Wtrampolines
   14.12 +-Common Var(warn_trampolines) Warning
   14.13 ++Common Var(warn_trampolines) Init(1) Warning
   14.14 + Warn whenever a trampoline is generated.
   14.15 + 
   14.16 + Wtype-limits
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/gcc/stuff/patches/013_all_default-ssp-fix.patch	Wed Dec 05 02:04:28 2018 +0200
    15.3 @@ -0,0 +1,38 @@
    15.4 +Disable ssp on -nostdlib, -nodefaultlibs and -ffreestanding 
    15.5 +Change the buffer size.
    15.6 +
    15.7 +--- a/gcc/gcc.c	2017-07-04 09:15:57.740793000 +0200
    15.8 ++++ b/gcc/gcc.c	2018-03-02 13:58:44.387741114 +0100
    15.9 +@@ -857,6 +857,12 @@ proper position among the other output f
   15.10 + #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
   15.11 + #endif
   15.12 + 
   15.13 ++#ifdef ENABLE_DEFAULT_SSP
   15.14 ++#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
   15.15 ++#else
   15.16 ++#define NO_SSP_SPEC ""
   15.17 ++#endif
   15.18 ++
   15.19 + #ifndef LINK_SSP_SPEC
   15.20 + #ifdef TARGET_LIBC_PROVIDES_SSP
   15.21 + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
   15.22 +@@ -1131,7 +1148,7 @@ static const char *cc1_options =
   15.23 +  %{-version:--version}\
   15.24 +  %{-help=*:--help=%*}\
   15.25 +  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}\
   15.26 +- %{fsyntax-only:-o %j} %{-param*}\
   15.27 ++ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
   15.28 +  %{coverage:-fprofile-arcs -ftest-coverage}\
   15.29 +  %{fprofile-arcs|fprofile-generate*|coverage:\
   15.30 +    %{!fprofile-update=singel:\
   15.31 +--- a/gcc/params.def	2016-03-30 09:47:40.000000000 +0200
   15.32 ++++ b/gcc/params.def	2016-09-19 12:56:58.443179039 +0200
   15.33 +@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
   15.34 + DEFPARAM (PARAM_SSP_BUFFER_SIZE,
   15.35 + 	  "ssp-buffer-size",
   15.36 + 	  "The lower bound for a buffer to be considered for stack smashing protection.",
   15.37 +-	  8, 1, 0)
   15.38 ++	  4, 1, 0)
   15.39 + 
   15.40 + DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
   15.41 + 	  "min-size-for-stack-sharing",
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/gcc/stuff/patches/020_all_msgfmt-libstdc++-link.patch	Wed Dec 05 02:04:28 2018 +0200
    16.3 @@ -0,0 +1,39 @@
    16.4 +Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
    16.5 +
    16.6 +Solves error messages like the following:
    16.7 +
    16.8 +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)
    16.9 +
   16.10 +The libgcc_s.so used during build doesn't satisfy the needs of the
   16.11 +libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
   16.12 +is used as a stand-alone application here, and what library it uses
   16.13 +behind the scenes is of no concern to the gcc build process.
   16.14 +Therefore, simply invoking it "as usual", i.e. without any special
   16.15 +library path, will make it work as expected here.
   16.16 +
   16.17 +2011-09-19 Martin von Gagern
   16.18 +
   16.19 +References:
   16.20 +https://bugs.gentoo.org/372377
   16.21 +https://bugs.gentoo.org/295480
   16.22 +
   16.23 +--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
   16.24 ++++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
   16.25 +@@ -39,6 +39,7 @@ MSGFMT = msgfmt
   16.26 + EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
   16.27 + 
   16.28 + .po.mo:
   16.29 ++	env --unset=LD_LIBRARY_PATH \
   16.30 + 	$(MSGFMT) -o $@ $<
   16.31 + 
   16.32 + all-local: all-local-$(USE_NLS)
   16.33 +--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
   16.34 ++++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
   16.35 +@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
   16.36 + 
   16.37 + 
   16.38 + .po.mo:
   16.39 ++	env --unset=LD_LIBRARY_PATH \
   16.40 + 	$(MSGFMT) -o $@ $<
   16.41 + 
   16.42 + all-local: all-local-$(USE_NLS)
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/gcc/stuff/patches/050_all_libiberty-asprintf.patch	Wed Dec 05 02:04:28 2018 +0200
    17.3 @@ -0,0 +1,18 @@
    17.4 +2008-07-25  Magnus Granberg  <zorry@ume.nu>
    17.5 +
    17.6 +	* include/libiberty.h (asprintf): Don't declare if defined as a macro
    17.7 +
    17.8 +--- a/include/libiberty.h
    17.9 ++++ b/include/libiberty.h
   17.10 +@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
   17.11 + /* Like sprintf but provides a pointer to malloc'd storage, which must
   17.12 +    be freed by the caller.  */
   17.13 + 
   17.14 ++/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL.  */
   17.15 ++#ifndef asprintf
   17.16 + extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
   17.17 + #endif
   17.18 ++#endif
   17.19 + 
   17.20 + #if !HAVE_DECL_VASPRINTF
   17.21 + /* Like vsprintf but provides a pointer to malloc'd storage, which
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/gcc/stuff/patches/051_all_libiberty-pic.patch	Wed Dec 05 02:04:28 2018 +0200
    18.3 @@ -0,0 +1,10 @@
    18.4 +--- a/libiberty/Makefile.in
    18.5 ++++ b/libiberty/Makefile.in
    18.6 +@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
    18.7 + 	  $(AR) $(AR_FLAGS) $(TARGETLIB) \
    18.8 + 	    $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
    18.9 + 	  $(RANLIB) $(TARGETLIB); \
   18.10 ++	  cp $(TARGETLIB) ../ ; \
   18.11 + 	  cd ..; \
   18.12 + 	else true; fi
   18.13 + 
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/gcc/stuff/patches/053_all_libitm-no-fortify-source.patch	Wed Dec 05 02:04:28 2018 +0200
    19.3 @@ -0,0 +1,27 @@
    19.4 +https://bugs.gentoo.org/508852
    19.5 +https://gcc.gnu.org/PR61164
    19.6 +
    19.7 +2014-04-27  Magnus Granberg  <zorry@gentoo.org>
    19.8 +
    19.9 +	#508852
   19.10 +	* libitm/configure.tgt: Disable FORTIFY
   19.11 +
   19.12 +--- a/libitm/configure.tgt
   19.13 ++++ b/libitm/configure.tgt
   19.14 +@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
   19.15 +   esac
   19.16 + fi
   19.17 + 
   19.18 ++# FIXME: error: inlining failed in call to always_inline 
   19.19 ++# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’
   19.20 ++# : function body can be overwritten at link time
   19.21 ++# Disable Fortify in libitm for now. #508852
   19.22 ++case "${target}" in
   19.23 ++    *-*-linux*)
   19.24 ++	XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
   19.25 ++	;;
   19.26 ++esac
   19.27 ++
   19.28 + # Map the target cpu to an ARCH sub-directory.  At the same time,
   19.29 + # work out any special compilation flags as necessary.
   19.30 + case "${target_cpu}" in
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/gcc/stuff/patches/090_all_pr55930-dependency-tracking.patch	Wed Dec 05 02:04:28 2018 +0200
    20.3 @@ -0,0 +1,18 @@
    20.4 +libatomic build failure if configured with --disable-dependency-tracking
    20.5 +load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory
    20.6 +
    20.7 +https://bugs.gentoo.org/463463
    20.8 +http://gcc.gnu.org/PR55930
    20.9 +
   20.10 +--- a/libatomic/Makefile.in
   20.11 ++++ b/libatomic/Makefile.in
   20.12 +@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
   20.13 + PAT_S = $(word 3,$(PAT_SPLIT))
   20.14 + IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
   20.15 + IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
   20.16 +-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
   20.17 ++@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
   20.18 ++@AMDEP_FALSE@M_DEPS =
   20.19 + M_SIZE = -DN=$(PAT_N)
   20.20 + M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
   20.21 + M_FILE = $(PAT_BASE)_n.c
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/gcc/stuff/patches/203-libgcc_s.patch	Wed Dec 05 02:04:28 2018 +0200
    21.3 @@ -0,0 +1,57 @@
    21.4 +From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001
    21.5 +From: Szabolcs Nagy <nsz@port70.net>
    21.6 +Date: Sat, 24 Oct 2015 20:09:53 +0000
    21.7 +Subject: [PATCH 3/6] libgcc_s
    21.8 +
    21.9 +---
   21.10 + gcc/config/i386/i386.c       | 4 ++--
   21.11 + libgcc/config/i386/cpuinfo.c | 6 +++---
   21.12 + libgcc/config/i386/t-linux   | 2 +-
   21.13 + 3 files changed, 6 insertions(+), 6 deletions(-)
   21.14 +
   21.15 +diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
   21.16 +index 3d044e8..82523e1 100644
   21.17 +--- a/gcc/config/i386/i386.c
   21.18 ++++ b/gcc/config/i386/i386.c
   21.19 +@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
   21.20 +     {
   21.21 +     case IX86_BUILTIN_CPU_INIT:
   21.22 +       {
   21.23 +-	/* Make it call __cpu_indicator_init in libgcc. */
   21.24 ++	/* Make it call __cpu_indicator_init_local in libgcc.a. */
   21.25 + 	tree call_expr, fndecl, type;
   21.26 +         type = build_function_type_list (integer_type_node, NULL_TREE); 
   21.27 +-	fndecl = build_fn_decl ("__cpu_indicator_init", type);
   21.28 ++	fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
   21.29 + 	call_expr = build_call_expr (fndecl, 0); 
   21.30 + 	return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
   21.31 +       }
   21.32 +diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
   21.33 +index 8c2248d..6c82f15 100644
   21.34 +--- a/libgcc/config/i386/cpuinfo.c
   21.35 ++++ b/libgcc/config/i386/cpuinfo.c
   21.36 +@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
   21.37 +   return 0;
   21.38 + }
   21.39 + 
   21.40 +-#if defined SHARED && defined USE_ELF_SYMVER
   21.41 +-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
   21.42 +-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
   21.43 ++#ifndef SHARED
   21.44 ++int __cpu_indicator_init_local (void)
   21.45 ++  __attribute__ ((weak, alias ("__cpu_indicator_init")));
   21.46 + #endif
   21.47 +diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
   21.48 +index 11bb46e..4f47f7b 100644
   21.49 +--- a/libgcc/config/i386/t-linux
   21.50 ++++ b/libgcc/config/i386/t-linux
   21.51 +@@ -3,5 +3,5 @@
   21.52 + # t-slibgcc-elf-ver and t-linux
   21.53 + SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
   21.54 + 
   21.55 +-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
   21.56 ++HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
   21.57 + CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
   21.58 +-- 
   21.59 +2.8.1
   21.60 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/gcc/stuff/patches/205-nopie.patch	Wed Dec 05 02:04:28 2018 +0200
    22.3 @@ -0,0 +1,75 @@
    22.4 +From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001
    22.5 +From: Szabolcs Nagy <nsz@port70.net>
    22.6 +Date: Sat, 7 Nov 2015 02:08:05 +0000
    22.7 +Subject: [PATCH 5/6] nopie
    22.8 +
    22.9 +---
   22.10 + gcc/configure    | 27 +++++++++++++++++++++++++++
   22.11 + gcc/configure.ac | 13 +++++++++++++
   22.12 + 2 files changed, 40 insertions(+)
   22.13 +
   22.14 +diff --git a/gcc/configure b/gcc/configure
   22.15 +index 1c6e340..7e8b5d6 100755
   22.16 +--- a/gcc/configure
   22.17 ++++ b/gcc/configure
   22.18 +@@ -29390,6 +29390,33 @@ fi
   22.19 + $as_echo "$gcc_cv_no_pie" >&6; }
   22.20 + if test "$gcc_cv_no_pie" = "yes"; then
   22.21 +   NO_PIE_FLAG="-no-pie"
   22.22 ++else
   22.23 ++  # Check if -nopie works.
   22.24 ++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5
   22.25 ++$as_echo_n "checking for -nopie option... " >&6; }
   22.26 ++if test "${gcc_cv_nopie+set}" = set; then :
   22.27 ++  $as_echo_n "(cached) " >&6
   22.28 ++else
   22.29 ++  saved_LDFLAGS="$LDFLAGS"
   22.30 ++     LDFLAGS="$LDFLAGS -nopie"
   22.31 ++     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
   22.32 ++/* end confdefs.h.  */
   22.33 ++int main(void) {return 0;}
   22.34 ++_ACEOF
   22.35 ++if ac_fn_cxx_try_link "$LINENO"; then :
   22.36 ++  gcc_cv_nopie=yes
   22.37 ++else
   22.38 ++  gcc_cv_nopie=no
   22.39 ++fi
   22.40 ++rm -f core conftest.err conftest.$ac_objext \
   22.41 ++    conftest$ac_exeext conftest.$ac_ext
   22.42 ++     LDFLAGS="$saved_LDFLAGS"
   22.43 ++fi
   22.44 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5
   22.45 ++$as_echo "$gcc_cv_nopie" >&6; }
   22.46 ++  if test "$gcc_cv_nopie" = "yes"; then
   22.47 ++    NO_PIE_FLAG="-nopie"
   22.48 ++  fi
   22.49 + fi
   22.50 + 
   22.51 + 
   22.52 +diff --git a/gcc/configure.ac b/gcc/configure.ac
   22.53 +index 6c1dcd9..0ca7647 100644
   22.54 +--- a/gcc/configure.ac
   22.55 ++++ b/gcc/configure.ac
   22.56 +@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option],
   22.57 +    LDFLAGS="$saved_LDFLAGS"])
   22.58 + if test "$gcc_cv_no_pie" = "yes"; then
   22.59 +   NO_PIE_FLAG="-no-pie"
   22.60 ++else
   22.61 ++  # Check if -nopie works.
   22.62 ++  AC_CACHE_CHECK([for -nopie option],
   22.63 ++    [gcc_cv_nopie],
   22.64 ++    [saved_LDFLAGS="$LDFLAGS"
   22.65 ++     LDFLAGS="$LDFLAGS -nopie"
   22.66 ++     AC_LINK_IFELSE([int main(void) {return 0;}],
   22.67 ++       [gcc_cv_nopie=yes],
   22.68 ++       [gcc_cv_nopie=no])
   22.69 ++     LDFLAGS="$saved_LDFLAGS"])
   22.70 ++  if test "$gcc_cv_nopie" = "yes"; then
   22.71 ++    NO_PIE_FLAG="-nopie"
   22.72 ++  fi
   22.73 + fi
   22.74 + AC_SUBST([NO_PIE_FLAG])
   22.75 + 
   22.76 +-- 
   22.77 +2.8.1
   22.78 +
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/gcc/stuff/patches/320-libffi-gnulinux.patch	Wed Dec 05 02:04:28 2018 +0200
    23.3 @@ -0,0 +1,13 @@
    23.4 +diff --git a/libffi/closures.c.orig b/libffi/closures.c
    23.5 +index 721ff00..22a699c 100644
    23.6 +--- a/libffi/src/closures.c.orig
    23.7 ++++ b/libffi/src/closures.c
    23.8 +@@ -34,7 +34,7 @@
    23.9 + #include <ffi_common.h>
   23.10 +
   23.11 + #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
   23.12 +-# if __gnu_linux__ && !defined(__ANDROID__)
   23.13 ++# if __linux__ && !defined(__ANDROID__)
   23.14 + /* This macro indicates it may be forbidden to map anonymous memory
   23.15 +    with both write and execute permission.  Code compiled when this
   23.16 +    option is defined will attempt to map such pages once, but if it
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/gcc/stuff/patches/ada-musl.patch	Wed Dec 05 02:04:28 2018 +0200
    24.3 @@ -0,0 +1,217 @@
    24.4 +diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
    24.5 +index 3b0aea9..ee0bb69 100644
    24.6 +--- a/gcc/ada/adaint.c
    24.7 ++++ b/gcc/ada/adaint.c
    24.8 +@@ -76,6 +76,11 @@
    24.9 + #include <sys/param.h>
   24.10 + #include <sys/pstat.h>
   24.11 + #endif
   24.12 ++ 
   24.13 ++#if defined (linux)
   24.14 ++#define _GNU_SOURCE 1
   24.15 ++#include <sched.h>
   24.16 ++#endif
   24.17 + 
   24.18 + #ifdef __PikeOS__
   24.19 + #define __BSD_VISIBLE 1
   24.20 +@@ -3255,7 +3260,6 @@ __gnat_lwp_self (void)
   24.21 + #endif
   24.22 + 
   24.23 + #if defined (__linux__)
   24.24 +-#include <sched.h>
   24.25 + 
   24.26 + /* glibc versions earlier than 2.7 do not define the routines to handle
   24.27 +    dynamically allocated CPU sets. For these targets, we use the static
   24.28 +@@ -3265,7 +3269,7 @@ __gnat_lwp_self (void)
   24.29 + 
   24.30 + /* Dynamic cpu sets */
   24.31 + 
   24.32 +-cpu_set_t *
   24.33 ++void *
   24.34 + __gnat_cpu_alloc (size_t count)
   24.35 + {
   24.36 +   return CPU_ALLOC (count);
   24.37 +@@ -3278,33 +3282,33 @@ __gnat_cpu_alloc_size (size_t count)
   24.38 + }
   24.39 + 
   24.40 + void
   24.41 +-__gnat_cpu_free (cpu_set_t *set)
   24.42 ++__gnat_cpu_free (void *set)
   24.43 + {
   24.44 +-  CPU_FREE (set);
   24.45 ++  CPU_FREE ((cpu_set_t *) set);
   24.46 + }
   24.47 + 
   24.48 + void
   24.49 +-__gnat_cpu_zero (size_t count, cpu_set_t *set)
   24.50 ++__gnat_cpu_zero (size_t count, void *set)
   24.51 + {
   24.52 +-  CPU_ZERO_S (count, set);
   24.53 ++  CPU_ZERO_S (count, (cpu_set_t *) set);
   24.54 + }
   24.55 + 
   24.56 + void
   24.57 +-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
   24.58 ++__gnat_cpu_set (int cpu, size_t count, void *set)
   24.59 + {
   24.60 +   /* Ada handles CPU numbers starting from 1, while C identifies the first
   24.61 +      CPU by a 0, so we need to adjust. */
   24.62 +-  CPU_SET_S (cpu - 1, count, set);
   24.63 ++  CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
   24.64 + }
   24.65 + 
   24.66 + #else /* !CPU_ALLOC */
   24.67 + 
   24.68 + /* Static cpu sets */
   24.69 + 
   24.70 +-cpu_set_t *
   24.71 ++void *
   24.72 + __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
   24.73 + {
   24.74 +-  return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
   24.75 ++  return xmalloc (sizeof (cpu_set_t));
   24.76 + }
   24.77 + 
   24.78 + size_t
   24.79 +@@ -3314,23 +3318,23 @@ __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
   24.80 + }
   24.81 + 
   24.82 + void
   24.83 +-__gnat_cpu_free (cpu_set_t *set)
   24.84 ++__gnat_cpu_free (void *set)
   24.85 + {
   24.86 +   free (set);
   24.87 + }
   24.88 + 
   24.89 + void
   24.90 +-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
   24.91 ++__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
   24.92 + {
   24.93 +-  CPU_ZERO (set);
   24.94 ++  CPU_ZERO ((cpu_set_t *) set);
   24.95 + }
   24.96 + 
   24.97 + void
   24.98 +-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
   24.99 ++__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
  24.100 + {
  24.101 +   /* Ada handles CPU numbers starting from 1, while C identifies the first
  24.102 +      CPU by a 0, so we need to adjust. */
  24.103 +-  CPU_SET (cpu - 1, set);
  24.104 ++  CPU_SET (cpu - 1, (cpu_set_t *) set);
  24.105 + }
  24.106 + #endif /* !CPU_ALLOC */
  24.107 + #endif /* __linux__ */
  24.108 +diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
  24.109 +index 0d12f7e..a063b47 100644
  24.110 +--- a/gcc/ada/adaint.h
  24.111 ++++ b/gcc/ada/adaint.h
  24.112 +@@ -316,13 +316,11 @@ extern void   *__gnat_lwp_self			   (void);
  24.113 + 
  24.114 + /* Routines for interface to required CPU set primitives */
  24.115 + 
  24.116 +-#include <sched.h>
  24.117 +-
  24.118 +-extern cpu_set_t *__gnat_cpu_alloc                 (size_t);
  24.119 ++extern void * __gnat_cpu_alloc                 (size_t);
  24.120 + extern size_t __gnat_cpu_alloc_size                (size_t);
  24.121 +-extern void   __gnat_cpu_free                  (cpu_set_t *);
  24.122 +-extern void   __gnat_cpu_zero                      (size_t, cpu_set_t *);
  24.123 +-extern void   __gnat_cpu_set                       (int, size_t, cpu_set_t *);
  24.124 ++extern void   __gnat_cpu_free                  (void *);
  24.125 ++extern void   __gnat_cpu_zero                      (size_t, void *);
  24.126 ++extern void   __gnat_cpu_set                       (int, size_t, void *);
  24.127 + #endif
  24.128 + 
  24.129 + #if defined (_WIN32)
  24.130 +diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
  24.131 +index 7025f57..207b50d 100644
  24.132 +--- a/gcc/ada/terminals.c
  24.133 ++++ b/gcc/ada/terminals.c
  24.134 +@@ -1108,13 +1108,6 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
  24.135 + #include <stdio.h>
  24.136 + #include <stdlib.h>
  24.137 + 
  24.138 +-/* On some system termio is either absent or including it will disable termios
  24.139 +-   (HP-UX) */
  24.140 +-#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
  24.141 +-  && !defined (__rtems__) && !defined (__QNXNTO__)
  24.142 +-#   include <termio.h>
  24.143 +-#endif
  24.144 +-
  24.145 + #include <sys/ioctl.h>
  24.146 + #include <termios.h>
  24.147 + #include <fcntl.h>
  24.148 +diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
  24.149 +index ebb955e..08cfbee 100644
  24.150 +--- a/gcc/ada/gcc-interface/Makefile.in
  24.151 ++++ b/gcc/ada/gcc-interface/Makefile.in
  24.152 +@@ -1028,7 +1028,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
  24.153 +   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  24.154 +   $(TRASYM_DWARF_UNIX_PAIRS) \
  24.155 +   g-sercom.adb<libgnat/g-sercom__linux.adb \
  24.156 +-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  24.157 ++  s-tsmona.adb<libgnat/s-tsmona.adb \
  24.158 +   a-exetim.adb<libgnarl/a-exetim__posix.adb \
  24.159 +   a-exetim.ads<libgnarl/a-exetim__default.ads \
  24.160 +   s-linux.ads<libgnarl/s-linux.ads \
  24.161 +@@ -1545,7 +1545,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
  24.162 +   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
  24.163 +   g-sercom.adb<libgnat/g-sercom__linux.adb \
  24.164 +   $(TRASYM_DWARF_UNIX_PAIRS) \
  24.165 +-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  24.166 ++  s-tsmona.adb<libgnat/s-tsmona.adb \
  24.167 +   $(ATOMICS_TARGET_PAIRS) \
  24.168 +   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
  24.169 +   system.ads<libgnat/system-linux-ppc.ads
  24.170 +@@ -1574,7 +1574,7 @@ ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
  24.171 + endif
  24.172 + 
  24.173 + # ARM linux, GNU eabi
  24.174 +-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
  24.175 ++ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
  24.176 +   LIBGNAT_TARGET_PAIRS = \
  24.177 +   a-intnam.ads<libgnarl/a-intnam__linux.ads \
  24.178 +   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
  24.179 +@@ -1774,7 +1774,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
  24.180 +   s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
  24.181 +   g-sercom.adb<libgnat/g-sercom__linux.adb \
  24.182 +   $(TRASYM_DWARF_UNIX_PAIRS) \
  24.183 +-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  24.184 ++  s-tsmona.adb<libgnat/s-tsmona.adb \
  24.185 +   $(ATOMICS_TARGET_PAIRS) \
  24.186 +   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
  24.187 +   system.ads<libgnat/system-linux-ia64.ads
  24.188 +@@ -1871,7 +1871,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
  24.189 +   s-taspri.ads<libgnarl/s-taspri__posix.ads \
  24.190 +   g-sercom.adb<libgnat/g-sercom__linux.adb \
  24.191 +   $(TRASYM_DWARF_UNIX_PAIRS) \
  24.192 +-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
  24.193 ++  s-tsmona.adb<libgnat/s-tsmona.adb \
  24.194 +   $(ATOMICS_TARGET_PAIRS) \
  24.195 +   $(X86_64_TARGET_PAIRS) \
  24.196 +   system.ads<libgnat/system-linux-x86.ads
  24.197 +diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c
  24.198 +index 207b50d..bd3a02c 100644
  24.199 +--- a/gcc/ada/terminals.c
  24.200 ++++ b/gcc/ada/terminals.c
  24.201 +@@ -1152,7 +1152,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
  24.202 + #if defined (__APPLE__) || defined (BSD)
  24.203 + #define USE_OPENPTY
  24.204 + #elif defined (__linux__)
  24.205 +-#define USE_GETPT
  24.206 ++#define USE_POSIX_OPENPT
  24.207 + #elif defined (__sun__)
  24.208 + #define USE_CLONE_DEVICE "/dev/ptmx"
  24.209 + #elif defined (_AIX)
  24.210 +@@ -1201,8 +1201,8 @@ allocate_pty_desc (pty_desc **desc) {
  24.211 +    int  master_fd   = -1;
  24.212 +    char *slave_name = NULL;
  24.213 + 
  24.214 +-#ifdef USE_GETPT
  24.215 +-  master_fd = getpt ();
  24.216 ++#ifdef USE_POSIX_OPENPT
  24.217 ++  master_fd = posix_openpt(O_RDWR | O_NOCTTY);
  24.218 + #elif defined (USE_OPENPTY)
  24.219 +   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
  24.220 + #elif defined (USE_CLONE_DEVICE)
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/gcc/stuff/patches/ada-shared.patch	Wed Dec 05 02:04:28 2018 +0200
    25.3 @@ -0,0 +1,30 @@
    25.4 +Index: b/gcc/ada/link.c
    25.5 +===================================================================
    25.6 +--- a/gcc/ada/link.c
    25.7 ++++ b/gcc/ada/link.c
    25.8 +@@ -105,9 +105,9 @@
    25.9 + 
   25.10 + #elif defined (__FreeBSD__)
   25.11 + const char *__gnat_object_file_option = "-Wl,@";
   25.12 +-const char *__gnat_run_path_option = "-Wl,-rpath,";
   25.13 +-char __gnat_shared_libgnat_default = STATIC;
   25.14 +-char __gnat_shared_libgcc_default = STATIC;
   25.15 ++const char *__gnat_run_path_option = "";
   25.16 ++char __gnat_shared_libgnat_default = SHARED;
   25.17 ++char __gnat_shared_libgcc_default = SHARED;
   25.18 + int __gnat_link_max = 8192;
   25.19 + unsigned char __gnat_objlist_file_supported = 1;
   25.20 + const char *__gnat_object_library_extension = ".a";
   25.21 +@@ -127,9 +127,9 @@
   25.22 + 
   25.23 + #elif defined (linux) || defined(__GLIBC__)
   25.24 + const char *__gnat_object_file_option = "-Wl,@";
   25.25 +-const char *__gnat_run_path_option = "-Wl,-rpath,";
   25.26 +-char __gnat_shared_libgnat_default = STATIC;
   25.27 +-char __gnat_shared_libgcc_default = STATIC;
   25.28 ++const char *__gnat_run_path_option = "";
   25.29 ++char __gnat_shared_libgnat_default = SHARED;
   25.30 ++char __gnat_shared_libgcc_default = SHARED;
   25.31 + int __gnat_link_max = 8192;
   25.32 + unsigned char __gnat_objlist_file_supported = 1;
   25.33 + const char *__gnat_object_library_extension = ".a";
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/gcc/stuff/patches/fix-cxxflags-passing.patch	Wed Dec 05 02:04:28 2018 +0200
    26.3 @@ -0,0 +1,10 @@
    26.4 +--- gcc-4.8.1/Makefile.in.orig
    26.5 ++++ gcc-4.8.1/Makefile.in
    26.6 +@@ -169,6 +169,7 @@
    26.7 + # built for the build system to override those in BASE_FLAGS_TO_PASSS.
    26.8 + EXTRA_BUILD_FLAGS = \
    26.9 + 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
   26.10 ++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
   26.11 + 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
   26.12 + 
   26.13 + # This is the list of directories to built for the host system.
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/gcc/stuff/patches/gcc-4.9-musl-fortify.patch	Wed Dec 05 02:04:28 2018 +0200
    27.3 @@ -0,0 +1,11 @@
    27.4 +--- gcc-4.9.2/gcc/config/linux.h.orig	2015-03-09 13:27:13.289736710 +0000
    27.5 ++++ gcc-4.9.2/gcc/config/linux.h	2015-03-09 13:29:32.295625046 +0000
    27.6 +@@ -146,6 +146,8 @@
    27.7 + 
    27.8 + #ifdef NATIVE_SYSTEM_HEADER_DIR
    27.9 + #define INCLUDE_DEFAULTS_MUSL_NATIVE			\
   27.10 ++    { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 },	\
   27.11 ++    { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 },	\
   27.12 +     { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 },	\
   27.13 +     { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
   27.14 + #else
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/gcc/stuff/patches/gcc-6.1-musl-libssp.patch	Wed Dec 05 02:04:28 2018 +0200
    28.3 @@ -0,0 +1,20 @@
    28.4 +Author: Timo Teräs <timo.teras@iki.fi>
    28.5 +
    28.6 +Alpine musl package provides libssp_nonshared.a. We link to it unconditionally,
    28.7 +as otherwise we get link failures if some objects are -fstack-protector built
    28.8 +and final link happens with -fno-stack-protector. This seems to be the common
    28.9 +case when bootstrapping gcc, the piepatches do not seem to fully fix the
   28.10 +crosstoolchain and  bootstrap sequence wrt. stack-protector flag usage.
   28.11 +
   28.12 +--- gcc-6.1.0/gcc/gcc.c.orig
   28.13 ++++ gcc-6.1.0/gcc/gcc.c
   28.14 +@@ -870,8 +870,7 @@
   28.15 + 
   28.16 + #ifndef LINK_SSP_SPEC
   28.17 + #ifdef TARGET_LIBC_PROVIDES_SSP
   28.18 +-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
   28.19 +-		       "|fstack-protector-strong|fstack-protector-explicit:}"
   28.20 ++#define LINK_SSP_SPEC "-lssp_nonshared"
   28.21 + #else
   28.22 + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
   28.23 + 		       "|fstack-protector-strong|fstack-protector-explicit" \
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/gcc/stuff/patches/gcc-as-needed-gold.patch	Wed Dec 05 02:04:28 2018 +0200
    29.3 @@ -0,0 +1,58 @@
    29.4 +# DP: Use --push-state/--pop-state for gold as well when linking libtsan.
    29.5 +
    29.6 +Index: b/gcc/gcc.c
    29.7 +===================================================================
    29.8 +--- a/gcc/gcc.c
    29.9 ++++ b/gcc/gcc.c
   29.10 +@@ -693,10 +693,10 @@ proper position among the other output f
   29.11 + #define LIBASAN_SPEC STATIC_LIBASAN_LIBS
   29.12 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   29.13 + #define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \
   29.14 +-		     " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   29.15 ++		     " %{!static-libasan:--push-state --no-as-needed}" \
   29.16 + 		     " -lasan " \
   29.17 + 		     " %{static-libasan:" LD_DYNAMIC_OPTION "}" \
   29.18 +-		     " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   29.19 ++		     " %{!static-libasan:--pop-state}" \
   29.20 + 		     STATIC_LIBASAN_LIBS
   29.21 + #else
   29.22 + #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS
   29.23 +@@ -714,10 +714,10 @@ proper position among the other output f
   29.24 + #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
   29.25 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   29.26 + #define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
   29.27 +-		     " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   29.28 ++		     " %{!static-libtsan:--push-state --no-as-needed}" \
   29.29 + 		     " -ltsan " \
   29.30 + 		     " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
   29.31 +-		     " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   29.32 ++		     " %{!static-libtsan:--pop-state}" \
   29.33 + 		     STATIC_LIBTSAN_LIBS
   29.34 + #else
   29.35 + #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
   29.36 +@@ -735,10 +735,10 @@ proper position among the other output f
   29.37 + #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS
   29.38 + #elif defined(HAVE_LD_STATIC_DYNAMIC)
   29.39 + #define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \
   29.40 +-		     " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   29.41 ++		     " %{!static-liblsan:--push-state --no-as-needed}" \
   29.42 + 		     " -llsan " \
   29.43 + 		     " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \
   29.44 +-		     " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   29.45 ++		     " %{!static-liblsan:--pop-state}" \
   29.46 + 		     STATIC_LIBLSAN_LIBS
   29.47 + #else
   29.48 + #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS
   29.49 +@@ -754,10 +754,10 @@ proper position among the other output f
   29.50 +   " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}"
   29.51 + #ifdef HAVE_LD_STATIC_DYNAMIC
   29.52 + #define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \
   29.53 +-		     " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
   29.54 ++		     " %{!static-libubsan:--push-state --no-as-needed}" \
   29.55 + 		     " -lubsan " \
   29.56 + 		     " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \
   29.57 +-		     " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
   29.58 ++		     " %{!static-libubsan:--pop-state}" \
   29.59 + 		     STATIC_LIBUBSAN_LIBS
   29.60 + #else
   29.61 + #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/gcc/stuff/patches/gcc-as-needed-push-pop.patch	Wed Dec 05 02:04:28 2018 +0200
    30.3 @@ -0,0 +1,43 @@
    30.4 +From: Jakub Jelinek <jakub@redhat.com>
    30.5 +Subject: [PATCH] Use --push-state --as-needed and --pop-state instead of --as-needed and --no-as-needed for libgcc
    30.6 +
    30.7 +As discussed, using --as-needed and --no-as-needed is dangerous, because
    30.8 +it results in --no-as-needed even for libraries after -lgcc_s, even when the
    30.9 +default is --as-needed or --as-needed has been specified earlier on the
   30.10 +command line.
   30.11 +
   30.12 +If the linker supports --push-state/--pop-state, we should IMHO use it.
   30.13 +
   30.14 +2018-04-11  Jakub Jelinek  <jakub@redhat.com>
   30.15 +
   30.16 +	* configure.ac (LD_AS_NEEDED_OPTION, LD_NO_AS_NEEDED_OPTION): Use
   30.17 +	--push-state --as-needed and --pop-state instead of --as-needed and
   30.18 +	--no-as-needed if ld supports it.
   30.19 +	* configure: Regenerated.
   30.20 +
   30.21 +Index: b/gcc/configure.ac
   30.22 +===================================================================
   30.23 +--- a/gcc/configure.ac
   30.24 ++++ b/gcc/configure.ac
   30.25 +@@ -5518,11 +5518,21 @@ if test $in_tree_ld = yes ; then
   30.26 +   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \
   30.27 +      && test $in_tree_ld_is_elf = yes; then
   30.28 +     gcc_cv_ld_as_needed=yes
   30.29 ++    if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 28; then
   30.30 ++      gcc_cv_ld_as_needed_option='--push-state --as-needed'
   30.31 ++      gcc_cv_ld_no_as_needed_option='--pop-state'
   30.32 ++    fi
   30.33 +   fi
   30.34 + elif test x$gcc_cv_ld != x; then
   30.35 +   # Check if linker supports --as-needed and --no-as-needed options
   30.36 +   if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then
   30.37 +     gcc_cv_ld_as_needed=yes
   30.38 ++    if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null; then
   30.39 ++      if $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null; then
   30.40 ++	gcc_cv_ld_as_needed_option='--push-state --as-needed'
   30.41 ++	gcc_cv_ld_no_as_needed_option='--pop-state'
   30.42 ++      fi
   30.43 ++    fi
   30.44 +   fi
   30.45 +   case "$target:$gnu_ld" in
   30.46 +     *-*-solaris2*:no)
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/gcc/stuff/patches/gcc-pure64-mips.patch	Wed Dec 05 02:04:28 2018 +0200
    31.3 @@ -0,0 +1,47 @@
    31.4 +From b8c4e45d052adc247341066f748421743704b481 Mon Sep 17 00:00:00 2001
    31.5 +From: Nils Andreas Svee <me@lochnair.net>
    31.6 +Date: Thu, 21 Dec 2017 03:14:33 +0100
    31.7 +Subject: [PATCH] Pure 64-bit MIPS
    31.8 +
    31.9 +---
   31.10 + gcc/config/mips/mips.h    | 8 ++++----
   31.11 + gcc/config/mips/t-linux64 | 6 +++---
   31.12 + 2 files changed, 7 insertions(+), 7 deletions(-)
   31.13 +
   31.14 +diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
   31.15 +index 803ab98e7..afd74752f 100644
   31.16 +--- a/gcc/config/mips/mips.h
   31.17 ++++ b/gcc/config/mips/mips.h
   31.18 +@@ -3330,11 +3330,11 @@ struct GTY(())  machine_function {
   31.19 + /* If we are *not* using multilibs and the default ABI is not ABI_32 we
   31.20 +    need to change these from /lib and /usr/lib.  */
   31.21 + #if MIPS_ABI_DEFAULT == ABI_N32
   31.22 +-#define STANDARD_STARTFILE_PREFIX_1 "/lib32/"
   31.23 +-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/"
   31.24 ++#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
   31.25 ++#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
   31.26 + #elif MIPS_ABI_DEFAULT == ABI_64
   31.27 +-#define STANDARD_STARTFILE_PREFIX_1 "/lib64/"
   31.28 +-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/"
   31.29 ++#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
   31.30 ++#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
   31.31 + #endif
   31.32 + 
   31.33 + /* Load store bonding is not supported by micromips and fix_24k.  The
   31.34 +diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
   31.35 +index 16c8adf85..bb46204db 100644
   31.36 +--- a/gcc/config/mips/t-linux64
   31.37 ++++ b/gcc/config/mips/t-linux64
   31.38 +@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
   31.39 + MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
   31.40 + MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
   31.41 + MULTILIB_OSDIRNAMES = \
   31.42 +-	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
   31.43 +-	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
   31.44 +-	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
   31.45 ++        ../lib \
   31.46 ++        ../lib32 \
   31.47 ++        ../lib
   31.48 +-- 
   31.49 +2.15.1
   31.50 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/gcc/stuff/patches/gcc-pure64.patch	Wed Dec 05 02:04:28 2018 +0200
    32.3 @@ -0,0 +1,89 @@
    32.4 +--- ./gcc/config/i386/t-linux64.orig	2013-01-14 16:32:37.000000000 +0000
    32.5 ++++ ./gcc/config/i386/t-linux64	2013-04-22 06:12:32.984439677 +0000
    32.6 +@@ -34,6 +34,6 @@
    32.7 + comma=,
    32.8 + MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
    32.9 + MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
   32.10 +-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
   32.11 +-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
   32.12 ++MULTILIB_OSDIRNAMES = m64=../lib
   32.13 ++MULTILIB_OSDIRNAMES+= m32=../lib32
   32.14 + MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
   32.15 +--- ./gcc/config/aarch64/t-aarch64-linux.orig
   32.16 ++++ ./gcc/config/aarch64/t-aarch64-linux
   32.17 +@@ -22,7 +22,7 @@
   32.18 + LIB1ASMFUNCS = _aarch64_sync_cache_range
   32.19 + 
   32.20 + AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
   32.21 +-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
   32.22 ++MULTILIB_OSDIRNAMES = mabi.lp64=../lib
   32.23 + MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
   32.24 + 
   32.25 + MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
   32.26 +--- ./gcc/config/s390/t-linux64.orig
   32.27 ++++ ./gcc/config/s390/t-linux64
   32.28 +@@ -7,5 +7,5 @@
   32.29 + MULTILIB_OPTIONS = m64/m31
   32.30 + MULTILIB_DIRNAMES = 64 32
   32.31 +-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
   32.32 +-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
   32.33 ++MULTILIB_OSDIRNAMES = m64=../lib
   32.34 ++MULTILIB_OSDIRNAMES+= m32=../lib32
   32.35 +
   32.36 +--- ./gcc/config/rs6000/t-linux.orig
   32.37 ++++ ./gcc/config/rs6000/t-linux
   32.38 +@@ -2,7 +2,8 @@
   32.39 + # or soft-float.
   32.40 + ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
   32.41 + ifneq (,$(findstring powerpc64,$(target)))
   32.42 +-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
   32.43 ++MULTILIB_OSDIRNAMES := m64=../lib
   32.44 ++MULTILIB_OSDIRNAMES += m32=../lib32
   32.45 + else
   32.46 + ifneq (,$(findstring spe,$(target)))
   32.47 + MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
   32.48 +@@ -14,7 +15,8 @@
   32.49 + MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
   32.50 + endif
   32.51 + ifneq (,$(findstring powerpc64le,$(target)))
   32.52 +-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
   32.53 ++MULTILIB_OSDIRNAMES := m64=../lib
   32.54 ++MULTILIB_OSDIRNAMES += m32=../lib32
   32.55 + endif
   32.56 + endif
   32.57 + 
   32.58 +--- ./gcc/config/rs6000/t-linux64.orig
   32.59 ++++ ./gcc/config/rs6000/t-linux64
   32.60 +@@ -28,8 +28,8 @@
   32.61 + MULTILIB_OPTIONS    := m64/m32
   32.62 + MULTILIB_DIRNAMES   := 64 32
   32.63 + MULTILIB_EXTRA_OPTS := 
   32.64 +-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
   32.65 +-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
   32.66 ++MULTILIB_OSDIRNAMES := m64=../lib
   32.67 ++MULTILIB_OSDIRNAMES += m32=../lib32
   32.68 + 
   32.69 + rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
   32.70 + 	$(COMPILE) $<
   32.71 +--- ./gcc/config/rs6000/t-linux64bele.orig
   32.72 ++++ ./gcc/config/rs6000/t-linux64bele
   32.73 +@@ -2,6 +2,6 @@
   32.74 + 
   32.75 + MULTILIB_OPTIONS    += mlittle
   32.76 + MULTILIB_DIRNAMES   += le
   32.77 +-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
   32.78 +-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
   32.79 ++MULTILIB_OSDIRNAMES = m64=../lib
   32.80 ++MULTILIB_OSDIRNAMES+= m32=../lib32
   32.81 + MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
   32.82 +--- ./gcc/config/rs6000/t-linux64lebe.orig
   32.83 ++++ ./gcc/config/rs6000/t-linux64lebe
   32.84 +@@ -2,6 +2,6 @@
   32.85 + 
   32.86 + MULTILIB_OPTIONS    += mbig
   32.87 + MULTILIB_DIRNAMES   += be
   32.88 +-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
   32.89 +-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
   32.90 ++MULTILIB_OSDIRNAMES := m64=../lib
   32.91 ++MULTILIB_OSDIRNAMES += m32=../lib32
   32.92 + MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/gcc/stuff/patches/libgcc-always-build-gcceh.a.patch	Wed Dec 05 02:04:28 2018 +0200
    33.3 @@ -0,0 +1,39 @@
    33.4 +Highly inspired by:
    33.5 +  http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
    33.6 +
    33.7 +diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
    33.8 +--- gcc-4.6.0.orig/libgcc/Makefile.in	2011-01-26 05:19:58.000000000 +0100
    33.9 ++++ gcc-4.6.0/libgcc/Makefile.in	2011-09-12 18:17:12.743718974 +0200
   33.10 +@@ -772,8 +772,9 @@
   33.11 + libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
   33.12 + endif
   33.13 + 
   33.14 ++all: libgcc_eh.a
   33.15 + ifeq ($(enable_shared),yes)
   33.16 +-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
   33.17 ++all: libgcc_s$(SHLIB_EXT)
   33.18 + ifneq ($(LIBUNWIND),)
   33.19 + all: libunwind$(SHLIB_EXT)
   33.20 + endif
   33.21 +@@ -950,10 +951,6 @@
   33.22 + install-shared:
   33.23 + 	$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
   33.24 + 
   33.25 +-	$(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
   33.26 +-	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
   33.27 +-	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
   33.28 +-
   33.29 + 	$(subst @multilib_dir@,$(MULTIDIR),$(subst \
   33.30 + 		@shlib_base_name@,libgcc_s,$(subst \
   33.31 + 		@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
   33.32 +@@ -968,6 +965,10 @@
   33.33 + 	chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
   33.34 + 	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
   33.35 + 
   33.36 ++	$(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
   33.37 ++	chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
   33.38 ++	$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
   33.39 ++
   33.40 + 	parts="$(INSTALL_PARTS)";				\
   33.41 + 	for file in $$parts; do					\
   33.42 + 	  rm -f $(DESTDIR)$(inst_libdir)/$$file;		\
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/gcc/stuff/patches/libgnarl-musl.patch	Wed Dec 05 02:04:28 2018 +0200
    34.3 @@ -0,0 +1,120 @@
    34.4 +diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads
    34.5 +--- gcc-8.2.0/gcc/ada/libgnarl/s-osinte__linux.ads	2018-01-11 00:55:25.000000000 -0800
    34.6 ++++ gcc-8.2.0-new/gcc/ada/libgnarl/s-osinte__linux.ads	2018-11-01 16:16:23.372452951 -0700
    34.7 +@@ -394,12 +394,6 @@ package System.OS_Interface is
    34.8 +    PTHREAD_RWLOCK_PREFER_WRITER_NP              : constant := 1;
    34.9 +    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
   34.10 + 
   34.11 +-   function pthread_rwlockattr_setkind_np
   34.12 +-     (attr : access pthread_rwlockattr_t;
   34.13 +-      pref : int) return int;
   34.14 +-   pragma Import
   34.15 +-     (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
   34.16 +-
   34.17 +    function pthread_rwlock_init
   34.18 +      (mutex : access pthread_rwlock_t;
   34.19 +       attr  : access pthread_rwlockattr_t) return int;
   34.20 +@@ -464,11 +458,6 @@ package System.OS_Interface is
   34.21 +       protocol : int) return int;
   34.22 +    pragma Import (C, pthread_mutexattr_setprotocol);
   34.23 + 
   34.24 +-   function pthread_mutexattr_setprioceiling
   34.25 +-     (attr        : access pthread_mutexattr_t;
   34.26 +-      prioceiling : int) return int;
   34.27 +-   pragma Import (C, pthread_mutexattr_setprioceiling);
   34.28 +-
   34.29 +    type struct_sched_param is record
   34.30 +       sched_priority : int;  --  scheduling priority
   34.31 +    end record;
   34.32 +diff -rup gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb
   34.33 +--- gcc-8.2.0/gcc/ada/libgnarl/s-taprop__linux.adb	2018-01-11 00:55:25.000000000 -0800
   34.34 ++++ gcc-8.2.0-new/gcc/ada/libgnarl/s-taprop__linux.adb	2018-11-13 11:28:36.433964449 -0800
   34.35 +@@ -202,9 +202,6 @@ package body System.Task_Primitives.Oper
   34.36 +    pragma Import
   34.37 +      (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
   34.38 + 
   34.39 +-   function GNAT_has_cap_sys_nice return C.int;
   34.40 +-   pragma Import
   34.41 +-     (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
   34.42 +    --  We do not have pragma Linker_Options ("-lcap"); here, because this
   34.43 +    --  library is not present on many Linux systems. 'libcap' is the Linux
   34.44 +    --  "capabilities" library, called by __gnat_has_cap_sys_nice.
   34.45 +@@ -214,38 +211,6 @@ package body System.Task_Primitives.Oper
   34.46 +    --  Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
   34.47 +    --  GNU/Linux, so we map 0 .. 98 to 1 .. 99.
   34.48 + 
   34.49 +-   function Get_Ceiling_Support return Boolean;
   34.50 +-   --  Get the value of the Ceiling_Support constant (see below).
   34.51 +-   --  Note well: If this function or related code is modified, it should be
   34.52 +-   --  tested by hand, because automated testing doesn't exercise it.
   34.53 +-
   34.54 +-   -------------------------
   34.55 +-   -- Get_Ceiling_Support --
   34.56 +-   -------------------------
   34.57 +-
   34.58 +-   function Get_Ceiling_Support return Boolean is
   34.59 +-      Ceiling_Support : Boolean := False;
   34.60 +-   begin
   34.61 +-      if Locking_Policy /= 'C' then
   34.62 +-         return False;
   34.63 +-      end if;
   34.64 +-
   34.65 +-      declare
   34.66 +-         function geteuid return Integer;
   34.67 +-         pragma Import (C, geteuid, "geteuid");
   34.68 +-         Superuser : constant Boolean := geteuid = 0;
   34.69 +-         Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
   34.70 +-         pragma Assert (Has_Cap in 0 | 1);
   34.71 +-      begin
   34.72 +-         Ceiling_Support := Superuser or else Has_Cap = 1;
   34.73 +-      end;
   34.74 +-
   34.75 +-      return Ceiling_Support;
   34.76 +-   end Get_Ceiling_Support;
   34.77 +-
   34.78 +-   pragma Warnings (Off, "non-static call not allowed in preelaborated unit");
   34.79 +-   Ceiling_Support : constant Boolean := Get_Ceiling_Support;
   34.80 +-   pragma Warnings (On, "non-static call not allowed in preelaborated unit");
   34.81 +    --  True if the locking policy is Ceiling_Locking, and the current process
   34.82 +    --  has permission to use this policy. The process has permission if it is
   34.83 +    --  running as 'root', or if the capability was set by the setcap command,
   34.84 +@@ -348,7 +313,9 @@ package body System.Task_Primitives.Oper
   34.85 +    -- Init_Mutex --
   34.86 +    ----------------
   34.87 + 
   34.88 ++   pragma Warnings (Off, "formal parameter * is not referenced");
   34.89 +    function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
   34.90 ++   pragma Warnings (On, "formal parameter * is not referenced");
   34.91 +       Mutex_Attr : aliased pthread_mutexattr_t;
   34.92 +       Result, Result_2 : C.int;
   34.93 + 
   34.94 +@@ -360,16 +327,7 @@ package body System.Task_Primitives.Oper
   34.95 +          return Result;
   34.96 +       end if;
   34.97 + 
   34.98 +-      if Ceiling_Support then
   34.99 +-         Result := pthread_mutexattr_setprotocol
  34.100 +-           (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
  34.101 +-         pragma Assert (Result = 0);
  34.102 +-
  34.103 +-         Result := pthread_mutexattr_setprioceiling
  34.104 +-           (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
  34.105 +-         pragma Assert (Result = 0);
  34.106 +-
  34.107 +-      elsif Locking_Policy = 'I' then
  34.108 ++      if Locking_Policy = 'I' then
  34.109 +          Result := pthread_mutexattr_setprotocol
  34.110 +            (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
  34.111 +          pragma Assert (Result = 0);
  34.112 +@@ -409,11 +367,6 @@ package body System.Task_Primitives.Oper
  34.113 +             Result := pthread_rwlockattr_init (RWlock_Attr'Access);
  34.114 +             pragma Assert (Result = 0);
  34.115 + 
  34.116 +-            Result := pthread_rwlockattr_setkind_np
  34.117 +-              (RWlock_Attr'Access,
  34.118 +-               PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
  34.119 +-            pragma Assert (Result = 0);
  34.120 +-
  34.121 +             Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
  34.122 + 
  34.123 +             pragma Assert (Result in 0 | ENOMEM);
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/gcc/stuff/patches/series	Wed Dec 05 02:04:28 2018 +0200
    35.3 @@ -0,0 +1,37 @@
    35.4 +# From Alpine Linux: https://git.alpinelinux.org/cgit/aports/tree/main/gcc
    35.5 +
    35.6 +002_all_default-relro.patch
    35.7 +003_all_default-fortify-source.patch
    35.8 +005_all_default-as-needed.patch
    35.9 +gcc-as-needed-gold.patch
   35.10 +gcc-as-needed-push-pop.patch
   35.11 +011_all_default-warn-format-security.patch
   35.12 +012_all_default-warn-trampolines.patch
   35.13 +013_all_default-ssp-fix.patch
   35.14 +020_all_msgfmt-libstdc++-link.patch
   35.15 +050_all_libiberty-asprintf.patch
   35.16 +051_all_libiberty-pic.patch
   35.17 +053_all_libitm-no-fortify-source.patch
   35.18 +090_all_pr55930-dependency-tracking.patch
   35.19 +0003-gcc-poison-system-directories.patch
   35.20 +
   35.21 +203-libgcc_s.patch
   35.22 +205-nopie.patch
   35.23 +0002-posix_memalign.patch
   35.24 +0008-s390x-muslldso.patch
   35.25 +0010-ldbl128-config.patch
   35.26 +0012-static-pie.patch
   35.27 +
   35.28 +libgcc-always-build-gcceh.a.patch
   35.29 +gcc-4.9-musl-fortify.patch
   35.30 +gcc-6.1-musl-libssp.patch
   35.31 +gcc-pure64.patch
   35.32 +
   35.33 +fix-cxxflags-passing.patch
   35.34 +ada-shared.patch
   35.35 +ada-musl.patch
   35.36 +libgnarl-musl.patch
   35.37 +
   35.38 +320-libffi-gnulinux.patch
   35.39 +
   35.40 +gcc-pure64-mips.patch
    36.1 --- a/glibc/receipt	Tue Dec 04 13:43:21 2018 +0200
    36.2 +++ b/glibc/receipt	Wed Dec 05 02:04:28 2018 +0200
    36.3 @@ -1,7 +1,7 @@
    36.4  # SliTaz package receipt v2.
    36.5  
    36.6  PACKAGE="glibc"
    36.7 -VERSION="2.26"
    36.8 +VERSION="2.28"
    36.9  CATEGORY="meta"
   36.10  SHORT_DESC="The GNU C libraries"
   36.11  MAINTAINER="devel@slitaz.org"
   36.12 @@ -91,12 +91,12 @@
   36.13  	make install_root=$install install || return 1
   36.14  
   36.15  	# nscd
   36.16 -	cp ../nscd/nscd.conf $install/etc/nscd.conf
   36.17 +	install -Dm644 ../nscd/nscd.conf $install/etc/nscd.conf
   36.18  	mkdir -p $install/var/cache/nscd $install/var/db
   36.19  	install -Dm755 $stuff/nscd $install/etc/init.d/nscd
   36.20  
   36.21  	# nsswitch.conf
   36.22 -	cp $stuff/nsswitch.conf $install/etc
   36.23 +	install -Dm644 $stuff/nsswitch.conf $install/etc/nsswitch.conf
   36.24  
   36.25  	# ld.so.conf
   36.26  	install -Dm644 $stuff/ld.so.conf $install/etc/ld.so.conf
   36.27 @@ -128,10 +128,10 @@
   36.28  
   36.29  	# Place the debugging symbols for selected libraries in separate files.
   36.30  	# This debugging information is needed if running regression tests that use valgrind or gdb.
   36.31 -	# http://www.linuxfromscratch.org/lfs/view/stable/chapter06/strippingagain.html
   36.32 +	# http://www.linuxfromscratch.org/lfs/view/development/chapter06/strippingagain.html
   36.33  
   36.34 +	cd $install/lib/
   36.35  	for i in ld-$VERSION.so libc-$VERSION.so libpthread-$VERSION.so libthread_db-1.0.so; do
   36.36 -		cd $install/lib/
   36.37  		objcopy --only-keep-debug $i $i.dbg
   36.38  		strip   --strip-unneeded  $i
   36.39  		objcopy --add-gnu-debuglink=$i.dbg $i
    37.1 --- a/glibc/stuff/patches/glibc-2.26-fhs-1.patch	Tue Dec 04 13:43:21 2018 +0200
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,72 +0,0 @@
    37.4 -Submitted By:            Armin K. <krejzi at email dot com>
    37.5 -Date:                    2013-02-11
    37.6 -Initial Package Version: 2.17
    37.7 -Upstream Status:         Not Applicable
    37.8 -Origin:                  Self
    37.9 -Description:             This patch removes references to /var/db directory which is not part
   37.10 -                         of FHS and replaces them with more suitable directories in /var
   37.11 -                         hierarchy - /var/cache/nscd for nscd and /var/lib/nss_db for nss_db.
   37.12 -
   37.13 ---- a/Makeconfig	2012-12-25 04:02:13.000000000 +0100
   37.14 -+++ b/Makeconfig	2013-02-11 01:32:32.500667439 +0100
   37.15 -@@ -250,7 +250,7 @@
   37.16 - 
   37.17 - # Directory for the database files and Makefile for nss_db.
   37.18 - ifndef vardbdir
   37.19 --vardbdir = $(localstatedir)/db
   37.20 -+vardbdir = $(localstatedir)/lib/nss_db
   37.21 - endif
   37.22 - inst_vardbdir = $(install_root)$(vardbdir)
   37.23 - 
   37.24 ---- a/nscd/nscd.h	2012-12-25 04:02:13.000000000 +0100
   37.25 -+++ b/nscd/nscd.h	2013-02-11 01:32:32.500667439 +0100
   37.26 -@@ -112,11 +112,11 @@
   37.27 - 
   37.28 - 
   37.29 - /* Paths of the file for the persistent storage.  */
   37.30 --#define _PATH_NSCD_PASSWD_DB	"/var/db/nscd/passwd"
   37.31 --#define _PATH_NSCD_GROUP_DB	"/var/db/nscd/group"
   37.32 --#define _PATH_NSCD_HOSTS_DB	"/var/db/nscd/hosts"
   37.33 --#define _PATH_NSCD_SERVICES_DB	"/var/db/nscd/services"
   37.34 --#define _PATH_NSCD_NETGROUP_DB	"/var/db/nscd/netgroup"
   37.35 -+#define _PATH_NSCD_PASSWD_DB	"/var/cache/nscd/passwd"
   37.36 -+#define _PATH_NSCD_GROUP_DB	"/var/cache/nscd/group"
   37.37 -+#define _PATH_NSCD_HOSTS_DB	"/var/cache/nscd/hosts"
   37.38 -+#define _PATH_NSCD_SERVICES_DB	"/var/cache/nscd/services"
   37.39 -+#define _PATH_NSCD_NETGROUP_DB	"/var/cache/nscd/netgroup"
   37.40 - 
   37.41 - /* Path used when not using persistent storage.  */
   37.42 - #define _PATH_NSCD_XYZ_DB_TMP	"/var/run/nscd/dbXXXXXX"
   37.43 ---- a/nss/db-Makefile	2012-12-25 04:02:13.000000000 +0100
   37.44 -+++ b/nss/db-Makefile	2013-02-11 01:32:32.500667439 +0100
   37.45 -@@ -22,7 +22,7 @@
   37.46 - 		       /etc/rpc /etc/services /etc/shadow /etc/gshadow \
   37.47 - 		       /etc/netgroup)
   37.48 - 
   37.49 --VAR_DB = /var/db
   37.50 -+VAR_DB = /var/lib/nss_db
   37.51 - 
   37.52 - AWK = awk
   37.53 - MAKEDB = makedb --quiet
   37.54 ---- a/sysdeps/generic/paths.h	2012-12-25 04:02:13.000000000 +0100
   37.55 -+++ b/sysdeps/generic/paths.h	2013-02-11 01:32:32.500667439 +0100
   37.56 -@@ -68,7 +68,7 @@
   37.57 - /* Provide trailing slash, since mostly used for building pathnames. */
   37.58 - #define	_PATH_DEV	"/dev/"
   37.59 - #define	_PATH_TMP	"/tmp/"
   37.60 --#define	_PATH_VARDB	"/var/db/"
   37.61 -+#define	_PATH_VARDB	"/var/lib/nss_db/"
   37.62 - #define	_PATH_VARRUN	"/var/run/"
   37.63 - #define	_PATH_VARTMP	"/var/tmp/"
   37.64 - 
   37.65 ---- a/sysdeps/unix/sysv/linux/paths.h	2012-12-25 04:02:13.000000000 +0100
   37.66 -+++ b/sysdeps/unix/sysv/linux/paths.h	2013-02-11 01:32:32.504000831 +0100
   37.67 -@@ -68,7 +68,7 @@
   37.68 - /* Provide trailing slash, since mostly used for building pathnames. */
   37.69 - #define	_PATH_DEV	"/dev/"
   37.70 - #define	_PATH_TMP	"/tmp/"
   37.71 --#define	_PATH_VARDB	"/var/db/"
   37.72 -+#define	_PATH_VARDB	"/var/lib/nss_db/"
   37.73 - #define	_PATH_VARRUN	"/var/run/"
   37.74 - #define	_PATH_VARTMP	"/var/tmp/"
   37.75 - 
    38.1 --- a/glibc/stuff/patches/glibc-2.26-math-1.patch	Tue Dec 04 13:43:21 2018 +0200
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,46 +0,0 @@
    38.4 -    From: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
    38.5 -    To: libc-alpha at sourceware dot org
    38.6 -    Date: Tue, 15 Aug 2017 14:44:59 -0300
    38.7 -    Subject: [PATCH 1/3] Do not use __builtin_types_compatible_p in C++ mode (bug 21930)
    38.8 -    Authentication-results: sourceware.org; auth=none
    38.9 -    References: <20170815174501.4143-1-gftg@linux.vnet.ibm.com>
   38.10 -
   38.11 -The logic to define isinf for float128 depends on the availability of
   38.12 -__builtin_types_compatible_p, which is only available in C mode,
   38.13 -however, the conditionals do not check for C or C++ mode.  This lead to
   38.14 -an error in libstdc++ configure, as reported by bug 21930.
   38.15 -
   38.16 -This patch adds a conditional for C mode in the definition of isinf for
   38.17 -float128.  No definition is provided in C++ mode, since libstdc++
   38.18 -headers undefine isinf.
   38.19 -
   38.20 -Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).
   38.21 -
   38.22 -	[BZ #21930]
   38.23 -	* math/math.h (isinf): Check if in C or C++ mode before using
   38.24 -	__builtin_types_compatible_p, since this is a C mode feature.
   38.25 ----
   38.26 - math/math.h | 8 ++++++--
   38.27 - 1 file changed, 6 insertions(+), 2 deletions(-)
   38.28 -
   38.29 -diff --git a/math/math.h b/math/math.h
   38.30 -index e21708045a..dea8dbe1ae 100644
   38.31 ---- a/math/math.h
   38.32 -+++ b/math/math.h
   38.33 -@@ -442,8 +442,12 @@ enum
   38.34 - 
   38.35 - /* Return nonzero value if X is positive or negative infinity.  */
   38.36 - # if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
   38.37 --     && !defined __SUPPORT_SNAN__
   38.38 --   /* __builtin_isinf_sign is broken for float128 only before GCC 7.0.  */
   38.39 -+     && !defined __SUPPORT_SNAN__ && !defined __cplusplus
   38.40 -+   /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
   38.41 -+      use the helper function, __isinff128, with older compilers.  This is
   38.42 -+      only provided for C mode, because in C++ mode, GCC has no support
   38.43 -+      for __builtin_types_compatible_p (and when in C++ mode, this macro is
   38.44 -+      not used anyway, because libstdc++ headers undefine it).  */
   38.45 - #  define isinf(x) \
   38.46 -     (__builtin_types_compatible_p (__typeof (x), _Float128) \
   38.47 -      ? __isinff128 (x) : __builtin_isinf_sign (x))
   38.48 --- 
   38.49 -2.13.5
    39.1 --- a/glibc/stuff/patches/glibc-2.26-math-2.patch	Tue Dec 04 13:43:21 2018 +0200
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,58 +0,0 @@
    39.4 -    From: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
    39.5 -    To: libc-alpha at sourceware dot org
    39.6 -    Date: Tue, 15 Aug 2017 14:45:00 -0300
    39.7 -    Subject: [PATCH 2/3] Provide a C++ version of issignaling that does not use __MATH_TG
    39.8 -    Authentication-results: sourceware.org; auth=none
    39.9 -    References: <20170815174501.4143-1-gftg@linux.vnet.ibm.com>
   39.10 -
   39.11 -The macro __MATH_TG contains the logic to select between long double and
   39.12 -_Float128, when these types are ABI-distinct.  This logic relies on
   39.13 -__builtin_types_compatible_p, which is not available in C++ mode.
   39.14 -
   39.15 -On the other hand, C++ function overloading provides the means to
   39.16 -distinguish between the floating-point types.  The overloading
   39.17 -resolution will match the correct parameter regardless of type
   39.18 -qualifiers, i.e.: const and volatile.
   39.19 -
   39.20 -Tested for powerpc64le.
   39.21 -
   39.22 -	* math/math.h [defined __cplusplus] (issignaling): Provide a C++
   39.23 -	definition for issignaling that does not rely on __MATH_TG,
   39.24 -	since __MATH_TG uses __builtin_types_compatible_p, which is only
   39.25 -	available in C mode.
   39.26 ----
   39.27 - math/math.h | 19 ++++++++++++++++++-
   39.28 - 1 file changed, 18 insertions(+), 1 deletion(-)
   39.29 -
   39.30 -diff --git a/math/math.h b/math/math.h
   39.31 -index dea8dbe1ae..1d6cdb0685 100644
   39.32 ---- a/math/math.h
   39.33 -+++ b/math/math.h
   39.34 -@@ -474,7 +474,24 @@ enum
   39.35 - # include <bits/iscanonical.h>
   39.36 - 
   39.37 - /* Return nonzero value if X is a signaling NaN.  */
   39.38 --# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
   39.39 -+# ifndef __cplusplus
   39.40 -+#  define issignaling(x) __MATH_TG ((x), __issignaling, (x))
   39.41 -+# else
   39.42 -+   /* In C++ mode, __MATH_TG cannot be used, because it relies on
   39.43 -+      __builtin_types_compatible_p, which is a C-only builtin.  On the
   39.44 -+      other hand, overloading provides the means to distinguish between
   39.45 -+      the floating-point types.  The overloading resolution will match
   39.46 -+      the correct parameter (regardless of type qualifiers (i.e.: const
   39.47 -+      and volatile).  */
   39.48 -+extern "C++" {
   39.49 -+int issignaling (float __val) { return __issignalingf (__val); }
   39.50 -+int issignaling (double __val) { return __issignaling (__val); }
   39.51 -+int issignaling (long double __val) { return __issignalingl (__val); }
   39.52 -+#if __HAVE_DISTINCT_FLOAT128
   39.53 -+int issignaling (_Float128  __val) { return __issignalingf128 (__val); }
   39.54 -+#endif
   39.55 -+} /* extern C++ */
   39.56 -+# endif
   39.57 - 
   39.58 - /* Return nonzero value if X is subnormal.  */
   39.59 - # define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
   39.60 --- 
   39.61 -2.13.5
    40.1 --- a/glibc/stuff/patches/glibc-2.26-math-3.patch	Tue Dec 04 13:43:21 2018 +0200
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,53 +0,0 @@
    40.4 -    From: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
    40.5 -    To: libc-alpha at sourceware dot org
    40.6 -    Date: Tue, 15 Aug 2017 14:45:01 -0300
    40.7 -    Subject: [PATCH 3/3] Do not use generic selection in C++ mode
    40.8 -    Authentication-results: sourceware.org; auth=none
    40.9 -    References: <20170815174501.4143-1-gftg@linux.vnet.ibm.com>
   40.10 -
   40.11 -The logic to protect the use of generic selection (_Generic) does not
   40.12 -check for C or C++ mode, however, generic selection is a C-only
   40.13 -feature.
   40.14 -
   40.15 -Tested for powerpc64le.
   40.16 -
   40.17 -	* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
   40.18 -	in C++ mode.
   40.19 ----
   40.20 - misc/sys/cdefs.h | 19 ++++++++++---------
   40.21 - 1 file changed, 10 insertions(+), 9 deletions(-)
   40.22 -
   40.23 -diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
   40.24 -index b3e7f3be96..cfd39d5302 100644
   40.25 ---- a/misc/sys/cdefs.h
   40.26 -+++ b/misc/sys/cdefs.h
   40.27 -@@ -463,17 +463,18 @@
   40.28 - # define __glibc_macro_warning(msg)
   40.29 - #endif
   40.30 - 
   40.31 --/* Support for generic selection (ISO C11) is available in GCC since
   40.32 --   version 4.9.  Previous versions do not provide generic selection,
   40.33 --   even though they might set __STDC_VERSION__ to 201112L, when in
   40.34 --   -std=c11 mode.  Thus, we must check for !defined __GNUC__ when
   40.35 --   testing __STDC_VERSION__ for generic selection support.
   40.36 -+/* Generic selection (ISO C11) is a C-only feature, available in GCC
   40.37 -+   since version 4.9.  Previous versions do not provide generic
   40.38 -+   selection, even though they might set __STDC_VERSION__ to 201112L,
   40.39 -+   when in -std=c11 mode.  Thus, we must check for !defined __GNUC__
   40.40 -+   when testing __STDC_VERSION__ for generic selection support.
   40.41 -    On the other hand, Clang also defines __GNUC__, so a clang-specific
   40.42 -    check is required to enable the use of generic selection.  */
   40.43 --#if __GNUC_PREREQ (4, 9) \
   40.44 --    || __glibc_clang_has_extension (c_generic_selections) \
   40.45 --    || (!defined __GNUC__ && defined __STDC_VERSION__ \
   40.46 --	&& __STDC_VERSION__ >= 201112L)
   40.47 -+#if !defined __cplusplus \
   40.48 -+    && (__GNUC_PREREQ (4, 9) \
   40.49 -+	|| __glibc_clang_has_extension (c_generic_selections) \
   40.50 -+	|| (!defined __GNUC__ && defined __STDC_VERSION__ \
   40.51 -+	    && __STDC_VERSION__ >= 201112L))
   40.52 - # define __HAVE_GENERIC_SELECTION 1
   40.53 - #else
   40.54 - # define __HAVE_GENERIC_SELECTION 0
   40.55 --- 
   40.56 -2.13.5
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/glibc/stuff/patches/glibc-2.28-fhs-1.patch	Wed Dec 05 02:04:28 2018 +0200
    41.3 @@ -0,0 +1,72 @@
    41.4 +Submitted By:            Armin K. <krejzi at email dot com>
    41.5 +Date:                    2013-02-11
    41.6 +Initial Package Version: 2.17
    41.7 +Upstream Status:         Not Applicable
    41.8 +Origin:                  Self
    41.9 +Description:             This patch removes references to /var/db directory which is not part
   41.10 +                         of FHS and replaces them with more suitable directories in /var
   41.11 +                         hierarchy - /var/cache/nscd for nscd and /var/lib/nss_db for nss_db.
   41.12 +
   41.13 +--- a/Makeconfig	2012-12-25 04:02:13.000000000 +0100
   41.14 ++++ b/Makeconfig	2013-02-11 01:32:32.500667439 +0100
   41.15 +@@ -250,7 +250,7 @@
   41.16 + 
   41.17 + # Directory for the database files and Makefile for nss_db.
   41.18 + ifndef vardbdir
   41.19 +-vardbdir = $(localstatedir)/db
   41.20 ++vardbdir = $(localstatedir)/lib/nss_db
   41.21 + endif
   41.22 + inst_vardbdir = $(install_root)$(vardbdir)
   41.23 + 
   41.24 +--- a/nscd/nscd.h	2012-12-25 04:02:13.000000000 +0100
   41.25 ++++ b/nscd/nscd.h	2013-02-11 01:32:32.500667439 +0100
   41.26 +@@ -112,11 +112,11 @@
   41.27 + 
   41.28 + 
   41.29 + /* Paths of the file for the persistent storage.  */
   41.30 +-#define _PATH_NSCD_PASSWD_DB	"/var/db/nscd/passwd"
   41.31 +-#define _PATH_NSCD_GROUP_DB	"/var/db/nscd/group"
   41.32 +-#define _PATH_NSCD_HOSTS_DB	"/var/db/nscd/hosts"
   41.33 +-#define _PATH_NSCD_SERVICES_DB	"/var/db/nscd/services"
   41.34 +-#define _PATH_NSCD_NETGROUP_DB	"/var/db/nscd/netgroup"
   41.35 ++#define _PATH_NSCD_PASSWD_DB	"/var/cache/nscd/passwd"
   41.36 ++#define _PATH_NSCD_GROUP_DB	"/var/cache/nscd/group"
   41.37 ++#define _PATH_NSCD_HOSTS_DB	"/var/cache/nscd/hosts"
   41.38 ++#define _PATH_NSCD_SERVICES_DB	"/var/cache/nscd/services"
   41.39 ++#define _PATH_NSCD_NETGROUP_DB	"/var/cache/nscd/netgroup"
   41.40 + 
   41.41 + /* Path used when not using persistent storage.  */
   41.42 + #define _PATH_NSCD_XYZ_DB_TMP	"/var/run/nscd/dbXXXXXX"
   41.43 +--- a/nss/db-Makefile	2012-12-25 04:02:13.000000000 +0100
   41.44 ++++ b/nss/db-Makefile	2013-02-11 01:32:32.500667439 +0100
   41.45 +@@ -22,7 +22,7 @@
   41.46 + 		       /etc/rpc /etc/services /etc/shadow /etc/gshadow \
   41.47 + 		       /etc/netgroup)
   41.48 + 
   41.49 +-VAR_DB = /var/db
   41.50 ++VAR_DB = /var/lib/nss_db
   41.51 + 
   41.52 + AWK = awk
   41.53 + MAKEDB = makedb --quiet
   41.54 +--- a/sysdeps/generic/paths.h	2012-12-25 04:02:13.000000000 +0100
   41.55 ++++ b/sysdeps/generic/paths.h	2013-02-11 01:32:32.500667439 +0100
   41.56 +@@ -68,7 +68,7 @@
   41.57 + /* Provide trailing slash, since mostly used for building pathnames. */
   41.58 + #define	_PATH_DEV	"/dev/"
   41.59 + #define	_PATH_TMP	"/tmp/"
   41.60 +-#define	_PATH_VARDB	"/var/db/"
   41.61 ++#define	_PATH_VARDB	"/var/lib/nss_db/"
   41.62 + #define	_PATH_VARRUN	"/var/run/"
   41.63 + #define	_PATH_VARTMP	"/var/tmp/"
   41.64 + 
   41.65 +--- a/sysdeps/unix/sysv/linux/paths.h	2012-12-25 04:02:13.000000000 +0100
   41.66 ++++ b/sysdeps/unix/sysv/linux/paths.h	2013-02-11 01:32:32.504000831 +0100
   41.67 +@@ -68,7 +68,7 @@
   41.68 + /* Provide trailing slash, since mostly used for building pathnames. */
   41.69 + #define	_PATH_DEV	"/dev/"
   41.70 + #define	_PATH_TMP	"/tmp/"
   41.71 +-#define	_PATH_VARDB	"/var/db/"
   41.72 ++#define	_PATH_VARDB	"/var/lib/nss_db/"
   41.73 + #define	_PATH_VARRUN	"/var/run/"
   41.74 + #define	_PATH_VARTMP	"/var/tmp/"
   41.75 + 
    42.1 --- a/glibc/stuff/patches/series	Tue Dec 04 13:43:21 2018 +0200
    42.2 +++ b/glibc/stuff/patches/series	Wed Dec 05 02:04:28 2018 +0200
    42.3 @@ -1,8 +1,2 @@
    42.4  # LFS
    42.5 -glibc-2.26-fhs-1.patch
    42.6 -
    42.7 -# https://sourceware.org/ml/libc-alpha/2017-08/msg00586.html
    42.8 -#glibc-2.26-math-1.patch
    42.9 -#glibc-2.26-math-2.patch
   42.10 -#glibc-2.26-math-3.patch
   42.11 -# also see: https://github.com/voidlinux/void-packages/issues/7307
   42.12 +glibc-2.28-fhs-1.patch
    43.1 --- a/linux/receipt	Tue Dec 04 13:43:21 2018 +0200
    43.2 +++ b/linux/receipt	Wed Dec 05 02:04:28 2018 +0200
    43.3 @@ -1,7 +1,7 @@
    43.4  # SliTaz package receipt v2.
    43.5  
    43.6  PACKAGE="linux"
    43.7 -VERSION="4.14.76"
    43.8 +VERSION="4.14.85"
    43.9  KBASEVER="$(echo $VERSION | cut -d. -f1,2)"
   43.10  CATEGORY="base-system"
   43.11  SHORT_DESC="The Linux Kernel"
    44.1 --- a/slitaz-toolchain/receipt	Tue Dec 04 13:43:21 2018 +0200
    44.2 +++ b/slitaz-toolchain/receipt	Wed Dec 05 02:04:28 2018 +0200
    44.3 @@ -1,7 +1,7 @@
    44.4  # SliTaz package receipt v2.
    44.5  
    44.6  PACKAGE="slitaz-toolchain"
    44.7 -VERSION="20180210"
    44.8 +VERSION="20181205"
    44.9  CATEGORY="meta"
   44.10  SHORT_DESC="SliTaz meta package to rebuild or install current toolchain"
   44.11  MAINTAINER="devel@slitaz.org"