Update to GCC 6.3.0 + fix for PR80180

New upstream release, fiddle patches to apply on it.
Also apply upstream fix for rdseed/rdrand intrinsics code
generation (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80180).

Change-Id: Ib4dec62b4c7a537220e8755a2bc9a6a11181e000
diff --git a/patches/gcc-patch.txt b/patches/gcc-patch.txt
index e3598a5..eb4deda 100644
--- a/patches/gcc-patch.txt
+++ b/patches/gcc-patch.txt
@@ -1,67 +1,271 @@
---- gcc-4.8.2.orig/gcc/config/arm/t-arm-elf	2013-01-10 20:38:27.000000000 +0000
-+++ gcc-4.8.2/gcc/config/arm/t-arm-elf	2013-12-28 22:54:59.000000000 +0000
-@@ -25,22 +25,36 @@
- #MULTILIB_DIRNAMES    += fa526 fa626 fa606te fa626te fmp626 fa726te
- #MULTILIB_EXCEPTIONS  += *mthumb*/*mcpu=fa526 *mthumb*/*mcpu=fa626
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/config.sub gcc-6.3.0/config.sub
+--- gcc-6.3.0-fsf/config.sub	2017-03-30 16:18:19.117238667 -0700
++++ gcc-6.3.0/config.sub	2017-03-30 16:23:21.688074247 -0700
+@@ -1531,6 +1531,9 @@ case $os in
+ 		;;
+ 	-nacl*)
+ 		;;
++	-fuchsia*)
++		os=-fuchsia
++		;;
+ 	-none)
+ 		;;
+ 	*)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/collect2.c gcc-6.3.0/gcc/collect2.c
+--- gcc-6.3.0-fsf/gcc/collect2.c	2017-03-30 16:18:18.781239956 -0700
++++ gcc-6.3.0/gcc/collect2.c	2017-03-30 16:23:21.692074232 -0700
+@@ -1067,8 +1067,10 @@ main (int argc, char **argv)
+   if (signal (SIGQUIT, SIG_IGN) != SIG_IGN)
+     signal (SIGQUIT, handler);
+ #endif
++#ifdef SIGINT
+   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+     signal (SIGINT, handler);
++#endif
+ #ifdef SIGALRM
+   if (signal (SIGALRM, SIG_IGN) != SIG_IGN)
+     signal (SIGALRM, handler);
+@@ -1077,8 +1079,10 @@ main (int argc, char **argv)
+   if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
+     signal (SIGHUP, handler);
+ #endif
++#ifdef SIGSEGV
+   if (signal (SIGSEGV, SIG_IGN) != SIG_IGN)
+     signal (SIGSEGV, handler);
++#endif
+ #ifdef SIGBUS
+   if (signal (SIGBUS, SIG_IGN) != SIG_IGN)
+     signal (SIGBUS, handler);
+@@ -2307,7 +2311,9 @@ static void
+ scan_prog_file (const char *prog_name, scanpass which_pass,
+ 		scanfilter filter)
+ {
++#ifdef SIGINT
+   void (*int_handler) (int);
++#endif
+ #ifdef SIGQUIT
+   void (*quit_handler) (int);
+ #endif
+@@ -2373,7 +2379,9 @@ scan_prog_file (const char *prog_name, s
+ 	fatal_error (input_location, errmsg);
+     }
  
-+# build a bunch of specialized versions of libcc for particular cores
-+#MULTILIB_OPTIONS    += mcpu=arm7tdmi/mcpu=arm9tdmi/mcpu=arm920t/mcpu=arm926ej-s/mcpu=arm1136j-s/mcpu=arm1136jf-s/mcpu=arm1176jz-s/mcpu=arm1176jzf-s/mcpu=xscale/mcpu=mpcore/mcpu=cortex-a8/cortex-a9/march=armv4t/march=armv5t/march=armv5te/march=armv6/march=armv6j/march=armv6k/march=armv6z/march=armv6zk/march=armv7-a/march=armv7-r
-+#MULTILIB_DIRNAMES   += arm7tdmi arm9tdmi arm920t arm926ej-s arm1136j-s arm1136jf-s arm1176jz-s arm1176jzf-s xscale mpcore cortex-a8 cortex-a9 cortex-m3 armv4t armv5t armv5te armv6 armv6j armv6k armv6z armv6zk armv7-a armv7-r
-+#MULTILIB_OPTIONS    += mcpu=arm7tdmi/mcpu=arm9tdmi/mcpu=arm920t/mcpu=arm926ej-s/mcpu=arm1136j-s/mcpu=arm1136jf-s/mcpu=arm1176jz-s/mcpu=arm1176jzf-s/mcpu=xscale/mcpu=mpcore/mcpu=cortex-a8/mcpu=cortex-a9
-+#MULTILIB_DIRNAMES   += arm7tdmi arm9tdmi arm920t arm926ej-s arm1136j-s arm1136jf-s arm1176jz-s arm1176jzf-s xscale mpcore cortex-a8 cortex-a9
++#ifdef SIGINT
+   int_handler  = (void (*) (int)) signal (SIGINT,  SIG_IGN);
++#endif
+ #ifdef SIGQUIT
+   quit_handler = (void (*) (int)) signal (SIGQUIT, SIG_IGN);
+ #endif
+@@ -2499,7 +2507,9 @@ scan_prog_file (const char *prog_name, s
+ 
+   do_wait (nm_file_name, pex);
+ 
++#ifdef SIGINT
+   signal (SIGINT,  int_handler);
++#endif
+ #ifdef SIGQUIT
+   signal (SIGQUIT, quit_handler);
+ #endif
+@@ -2571,7 +2581,9 @@ scan_libraries (const char *prog_name)
+ 	fatal_error (input_location, errmsg);
+     }
+ 
++#ifdef SIGINT
+   int_handler  = (void (*) (int)) signal (SIGINT,  SIG_IGN);
++#endif
+ #ifdef SIGQUIT
+   quit_handler = (void (*) (int)) signal (SIGQUIT, SIG_IGN);
+ #endif
+@@ -2619,7 +2631,9 @@ scan_libraries (const char *prog_name)
+ 
+   do_wait (ldd_file_name, pex);
+ 
++#ifdef SIGINT
+   signal (SIGINT,  int_handler);
++#endif
+ #ifdef SIGQUIT
+   signal (SIGQUIT, quit_handler);
+ #endif
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/config/fuchsia.h gcc-6.3.0/gcc/config/fuchsia.h
+--- gcc-6.3.0-fsf/gcc/config/fuchsia.h	1969-12-31 16:00:00.000000000 -0800
++++ gcc-6.3.0/gcc/config/fuchsia.h	2017-03-30 16:23:21.692074232 -0700
+@@ -0,0 +1,105 @@
++/* Base configuration file for all Fuchsia targets.
++   Copyright (C) 2016 Free Software Foundation, Inc.
 +
-+MULTILIB_OPTIONS      += march=armv7
-+MULTILIB_DIRNAMES     += thumb2
-+MULTILIB_EXCEPTIONS   += march=armv7* marm/*march=armv7*
-+MULTILIB_MATCHES      += march?armv7=march?armv7-a
-+MULTILIB_MATCHES      += march?armv7=march?armv7-r
-+MULTILIB_MATCHES      += march?armv7=march?armv7-m
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-a15
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-a9
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-a8
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-r4
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-m4
-+MULTILIB_MATCHES      += march?armv7=mcpu?cortex-m3
++This file is part of GCC.
 +
-+#MULTILIB_OPTIONS      += mfpu=vfp
-+#MULTILIB_DIRNAMES     += vfp
-+#MULTILIB_MATCHES      += mfpu?vfp=mcpu?arm1136jf-s
-+#MULTILIB_MATCHES      += mfpu?vfp=mcpu?arm1136jzf-s
--#MULTILIB_OPTIONS      += march=armv7
--#MULTILIB_DIRNAMES     += thumb2
--#MULTILIB_EXCEPTIONS   += march=armv7* marm/*march=armv7*
--#MULTILIB_MATCHES      += march?armv7=march?armv7-a
--#MULTILIB_MATCHES      += march?armv7=march?armv7-r
--#MULTILIB_MATCHES      += march?armv7=march?armv7-m
--#MULTILIB_MATCHES      += march?armv7=mcpu?cortex-a8
--#MULTILIB_MATCHES      += march?armv7=mcpu?cortex-r4
--#MULTILIB_MATCHES      += march?armv7=mcpu?cortex-m3
++GCC is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 3, or (at your option)
++any later version.
++
++GCC is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with GCC; see the file COPYING3.  If not see
++<http://www.gnu.org/licenses/>.  */
++
++/* Common Fuchsia configuration.  */
++
++/* In case we need to know.  */
++#define USING_CONFIG_FUCHSIA 1
++
++#undef  STARTFILE_SPEC
++#define STARTFILE_SPEC "%{!shared: crt1%O%s} crtbegin%O%s"
++
++#undef  ENDFILE_SPEC
++#define ENDFILE_SPEC "crtend%O%s"
++
++/* When neither pic nor pie has been specified, use PIE by default.  */
++#undef  CC1_SPEC
++#define CC1_SPEC "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC:" \
++                   "%{!fno-pie:%{!fno-PIE:%{!fpie:%{!fPIE: -fPIE}}}}}}}}"
++
++#undef  LIB_SPEC
++#define LIB_SPEC "--start-group" \
++		 " -lmxio -lmagenta -lc -llaunchpad" \
++		 "%{!static: -lgcc_s}" \
++		 " --end-group"
++
++#undef  LINK_SPEC
++#define LINK_SPEC "-z max-page-size=4096" \
++		  " -z combreloc" \
++		  " -z relro" \
++		  " -z now" \
++		  " -z text" \
++		  "%{!hash-style: --hash-style=gnu}" \
++		  "%{!no-eh-frame-hdr: --eh-frame-hdr}" \
++		  "%{!no-build-id: --build-id}" \
++		  "%{shared: -shared}" \
++		  "%{!shared:%{!static:%{!dynamic-linker: -dynamic-linker=ld.so.1}}}"
++
++/* We are using MUSL as our libc.  */
++#undef  OPTION_MUSL
++#define OPTION_MUSL 1
++
++#ifndef TARGET_SUB_OS_CPP_BUILTINS
++#define TARGET_SUB_OS_CPP_BUILTINS()
++#endif
++
++#undef  TARGET_OS_CPP_BUILTINS
++#define TARGET_OS_CPP_BUILTINS()		\
++  do						\
++    {						\
++      builtin_define ("__Fuchsia__");		\
++      TARGET_SUB_OS_CPP_BUILTINS();		\
++    }						\
++  while (false)
++
++/* /dev/null is unwritable, at the moment. Use this as a workaround.  */
++#undef  HOST_BIT_BUCKET
++#define HOST_BIT_BUCKET "/tmp/.null"
++
++/* Inode numbers are not available to us.  */
++#define HOST_LACKS_INODE_NUMBERS
++
++/* In fact we have ftw.h, but the function itself is unimplemented.  */
++#undef HAVE_FTW_H
++
++/* Functions that are implemented as stubs in libc.  */
++#undef HAVE_GETRLIMIT
++#undef HAVE_GETRUSAGE
++#undef HAVE_REALPATH
++#undef HAVE_SETRLIMIT
++#undef HAVE_TIMES
++
++/* No ioctl() support.  */
++#undef TIOCGWINSZ
++
++/* No signal() support.  */
++#undef SIGABRT
++#undef SIGALRM
++#undef SIGBUS
++#undef SIGCHLD
++#undef SIGFPE
++#undef SIGHUP
++#undef SIGILL
++#undef SIGINT
++#undef SIGIOT
++#undef SIGPIPE
++#undef SIGQUIT
++#undef SIGSEGV
++#undef SIGTERM
++
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/config/i386/i386.c gcc-6.3.0/gcc/config/i386/i386.c
+--- gcc-6.3.0-fsf/gcc/config/i386/i386.c	2017-03-30 16:18:17.521244794 -0700
++++ gcc-6.3.0/gcc/config/i386/i386.c	2017-03-30 16:23:21.708074170 -0700
+@@ -41322,9 +41322,6 @@ ix86_expand_builtin (tree exp, rtx targe
+       mode0 = DImode;
  
- # Not quite true.  We can support hard-vfp calling in Thumb2, but how do we
- # express that here?  Also, we really need architecture v5e or later
- # (mcrr etc).
-+#MULTILIB_OPTIONS       += mfloat-abi=hard
-+#MULTILIB_DIRNAMES      += fpu
-+#MULTILIB_EXCEPTIONS    += *mthumb/*mfloat-abi=hard*
--MULTILIB_OPTIONS       += mfloat-abi=hard
--MULTILIB_DIRNAMES      += fpu
--MULTILIB_EXCEPTIONS    += *mthumb/*mfloat-abi=hard*
- #MULTILIB_EXCEPTIONS    += *mcpu=fa526/*mfloat-abi=hard*
- #MULTILIB_EXCEPTIONS    += *mcpu=fa626/*mfloat-abi=hard*
+ rdrand_step:
+-      op0 = gen_reg_rtx (mode0);
+-      emit_insn (GEN_FCN (icode) (op0));
+-
+       arg0 = CALL_EXPR_ARG (exp, 0);
+       op1 = expand_normal (arg0);
+       if (!address_operand (op1, VOIDmode))
+@@ -41332,6 +41329,10 @@ rdrand_step:
+ 	  op1 = convert_memory_address (Pmode, op1);
+ 	  op1 = copy_addr_to_reg (op1);
+ 	}
++
++      op0 = gen_reg_rtx (mode0);
++      emit_insn (GEN_FCN (icode) (op0));
++
+       emit_move_insn (gen_rtx_MEM (mode0, op1), op0);
  
-@@ -56,8 +70,8 @@
- # MULTILIB_DIRNAMES   += fpu soft
- # MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
- # 
-+MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork
-+MULTILIB_DIRNAMES   += normal interwork
--# MULTILIB_OPTIONS    += mno-thumb-interwork/mthumb-interwork
--# MULTILIB_DIRNAMES   += normal interwork
- # 
- # MULTILIB_OPTIONS    += fno-leading-underscore/fleading-underscore
- # MULTILIB_DIRNAMES   += elf under
---- gcc-4.8.2.orig/gcc/config/i386/t-x86_64-elf	1970-01-01 01:00:00.000000000 +0100
-+++ gcc-4.8.2/gcc/config/i386/t-x86_64-elf	2013-12-29 12:47:35.000000000 +0000
+       op1 = gen_reg_rtx (SImode);
+@@ -41340,8 +41341,20 @@ rdrand_step:
+       /* Emit SImode conditional move.  */
+       if (mode0 == HImode)
+ 	{
+-	  op2 = gen_reg_rtx (SImode);
+-	  emit_insn (gen_zero_extendhisi2 (op2, op0));
++	  if (TARGET_ZERO_EXTEND_WITH_AND
++	      && optimize_function_for_speed_p (cfun))
++	    {
++	      op2 = force_reg (SImode, const0_rtx);
++
++	      emit_insn (gen_movstricthi
++			 (gen_lowpart (HImode, op2), op0));
++	    }
++	  else
++	    {
++	      op2 = gen_reg_rtx (SImode);
++
++	      emit_insn (gen_zero_extendhisi2 (op2, op0));
++	    }
+ 	}
+       else if (mode0 == SImode)
+ 	op2 = op0;
+@@ -41373,9 +41386,6 @@ rdrand_step:
+       mode0 = DImode;
+ 
+ rdseed_step:
+-      op0 = gen_reg_rtx (mode0);
+-      emit_insn (GEN_FCN (icode) (op0));
+-
+       arg0 = CALL_EXPR_ARG (exp, 0);
+       op1 = expand_normal (arg0);
+       if (!address_operand (op1, VOIDmode))
+@@ -41383,6 +41393,10 @@ rdseed_step:
+ 	  op1 = convert_memory_address (Pmode, op1);
+ 	  op1 = copy_addr_to_reg (op1);
+ 	}
++
++      op0 = gen_reg_rtx (mode0);
++      emit_insn (GEN_FCN (icode) (op0));
++
+       emit_move_insn (gen_rtx_MEM (mode0, op1), op0);
+ 
+       op2 = gen_reg_rtx (QImode);
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/config/i386/t-x86_64-elf gcc-6.3.0/gcc/config/i386/t-x86_64-elf
+--- gcc-6.3.0-fsf/gcc/config/i386/t-x86_64-elf	1969-12-31 16:00:00.000000000 -0800
++++ gcc-6.3.0/gcc/config/i386/t-x86_64-elf	2017-03-30 16:23:21.712074155 -0700
 @@ -0,0 +1,8 @@
 +# Add redzoneless libgcc
 +
@@ -72,19 +276,416 @@
 +MULTILIB_OPTIONS  += m32
 +MULTILIB_DIRNAMES += 32
 \ No newline at end of file
-2016-09-27  Roland McGrath  <roland@hack.frob.com>
-
-	PR other/77609
-	* varasm.c (default_section_type_flags): Set SECTION_NOTYPE for
-	any section for which we don't know a specific type it should have,
-	regardless of name.  Previously this was done only for the exact
-	names ".init_array", ".fini_array", and ".preinit_array".
-
-diff --git a/gcc/varasm.c b/gcc/varasm.c
-index b0f2af0..dcc9976 100644
---- a/gcc/varasm.c
-+++ b/gcc/varasm.c
-@@ -6193,15 +6193,20 @@ default_section_type_flags (tree decl, const char *name, int reloc)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/config.gcc gcc-6.3.0/gcc/config.gcc
+--- gcc-6.3.0-fsf/gcc/config.gcc	2017-03-30 16:18:18.853239681 -0700
++++ gcc-6.3.0/gcc/config.gcc	2017-03-31 18:27:18.774027678 -0700
+@@ -710,6 +710,9 @@ case ${target} in
+   esac
+   use_gcc_stdint=wrap
+   ;;
++*-*-fuchsia*)
++  native_system_header_dir=/include
++  ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+   extra_options="$extra_options gnu-user.opt"
+   gas=yes
+@@ -912,7 +915,7 @@ case ${target} in
+ esac
+ 
+ case ${target} in
+-aarch64*-*-elf | aarch64*-*-rtems*)
++aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
+ 	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
+ 	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
+ 	tmake_file="${tmake_file} aarch64/t-aarch64"
+@@ -920,6 +923,9 @@ aarch64*-*-elf | aarch64*-*-rtems*)
+ 	aarch64-*-elf*)
+ 		use_gcc_stdint=wrap
+ 		;;
++        aarch64-*-fuchsia*)
++                tm_file="${tm_file} fuchsia.h"
++                ;;
+ 	aarch64-*-rtems*)
+ 	  	tm_file="${tm_file} rtems.h aarch64/rtems.h"
+ 		;;
+@@ -1429,6 +1435,7 @@ i[34567]86-*-elf*)
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
+ 	;;
+ x86_64-*-elf*)
++	tmake_file="${tmake_file} i386/t-x86_64-elf"
+ 	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
+ 	;;
+ x86_64-*-rtems*)
+@@ -1802,6 +1809,10 @@ i[34567]86-*-interix[3-9]*)
+ 		tm_file="${tm_file} dbxcoff.h"
+ 	fi
+ 	;;
++x86_64-*-fuchsia*)
++	tmake_file="${tmake_file} i386/t-x86_64-elf"
++	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h fuchsia.h"
++	;;
+ ia64*-*-elf*)
+ 	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h"
+ 	tmake_file="ia64/t-ia64"
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/config.host gcc-6.3.0/gcc/config.host
+--- gcc-6.3.0-fsf/gcc/config.host	2017-03-30 16:18:17.569244610 -0700
++++ gcc-6.3.0/gcc/config.host	2017-03-31 18:27:55.833878360 -0700
+@@ -99,7 +99,7 @@ case ${host} in
+ esac
+ 
+ case ${host} in
+-  aarch64*-*-linux*)
++  aarch64*-*-linux* | aarch64*-*-fuchsia*)
+     case ${target} in
+       aarch64*-*-*)
+ 	host_extra_gcc_objs="driver-aarch64.o"
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/configure gcc-6.3.0/gcc/configure
+--- gcc-6.3.0-fsf/gcc/configure	2017-03-30 16:18:18.769240003 -0700
++++ gcc-6.3.0/gcc/configure	2017-03-31 06:43:15.446595972 -0700
+@@ -13387,6 +13387,10 @@ freebsd* | dragonfly*)
+   fi
+   ;;
+ 
++fuchsia*)
++  lt_cv_deplibs_check_method=pass_all
++  ;;
++
+ gnu*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -17645,6 +17649,15 @@ freebsd* | dragonfly*)
+   esac
+   ;;
+ 
++fuchsia*)
++  need_lib_prefix=no
++  need_version=no
++  dynamic_linker="$host_os ld.so.1"
++  library_names_spec='$libname$shared_ext'
++  soname_spec='$libname$shared_ext'
++  sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
++  ;;
++
+ gnu*)
+   version_type=linux
+   need_lib_prefix=no
+@@ -18248,6 +18261,11 @@ fi
+ 
+     ;;
+ 
++  fuchsia*)
++    lt_cv_dlopen="dlopen"
++    lt_cv_dlopen_libs=
++    ;;
++
+   *)
+     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+ if test "x$ac_cv_func_shl_load" = x""yes; then :
+@@ -18460,7 +18478,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 18463 "configure"
++#line 18481 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -18566,7 +18584,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 18569 "configure"
++#line 18587 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -20470,6 +20488,10 @@ $as_echo_n "checking for $compiler optio
+       freebsd* | dragonfly*)
+ 	# FreeBSD uses GNU C++
+ 	;;
++      fuchsia* )
++	lt_prog_compiler_wl_CXX='-Wl,'
++	lt_prog_compiler_static_CXX='-static'
++	;;
+       hpux9* | hpux10* | hpux11*)
+ 	case $cc_basename in
+ 	  CC*)
+@@ -21305,6 +21327,15 @@ freebsd* | dragonfly*)
+   esac
+   ;;
+ 
++fuchsia*)
++  need_lib_prefix=no
++  need_version=no
++  dynamic_linker="$host_os ld.so.1"
++  library_names_spec='$libname$shared_ext'
++  soname_spec='$libname$shared_ext'
++  sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
++  ;;
++
+ gnu*)
+   version_type=linux
+   need_lib_prefix=no
+@@ -29486,14 +29517,19 @@ fi
+ 
+ 
+ # Check if -fno-PIE works.
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5
++case $host_os in
++  fuchsia*)
++    # Fuchsia requires PIE binaries
++    ;;
++  *)
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5
+ $as_echo_n "checking for -fno-PIE option... " >&6; }
+ if test "${gcc_cv_c_no_fpie+set}" = set; then :
+   $as_echo_n "(cached) " >&6
+ else
+   saved_CXXFLAGS="$CXXFLAGS"
+-   CXXFLAGS="$CXXFLAGS -fno-PIE"
+-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++       CXXFLAGS="$CXXFLAGS -fno-PIE"
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int main(void) {return 0;}
+ _ACEOF
+@@ -29503,24 +29539,31 @@ else
+   gcc_cv_c_no_fpie=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-   CXXFLAGS="$saved_CXXFLAGS"
++       CXXFLAGS="$saved_CXXFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5
+ $as_echo "$gcc_cv_c_no_fpie" >&6; }
+-if test "$gcc_cv_c_no_fpie" = "yes"; then
+-  NO_PIE_CFLAGS="-fno-PIE"
+-fi
++    if test "$gcc_cv_c_no_fpie" = "yes"; then
++      NO_PIE_CFLAGS="-fno-PIE"
++    fi
++    ;;
++esac
+ 
+ 
+ # Check if -no-pie works.
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
++case $host_os in
++  fuchsia*)
++    # Fuchsia requires PIE binaries
++    ;;
++  *)
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
+ $as_echo_n "checking for -no-pie option... " >&6; }
+ if test "${gcc_cv_no_pie+set}" = set; then :
+   $as_echo_n "(cached) " >&6
+ else
+   saved_LDFLAGS="$LDFLAGS"
+-   LDFLAGS="$LDFLAGS -no-pie"
+-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++       LDFLAGS="$LDFLAGS -no-pie"
++       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int main(void) {return 0;}
+ _ACEOF
+@@ -29531,13 +29574,15 @@ else
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+-   LDFLAGS="$saved_LDFLAGS"
++       LDFLAGS="$saved_LDFLAGS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
+ $as_echo "$gcc_cv_no_pie" >&6; }
+-if test "$gcc_cv_no_pie" = "yes"; then
+-  NO_PIE_FLAG="-no-pie"
+-fi
++    if test "$gcc_cv_no_pie" = "yes"; then
++      NO_PIE_FLAG="-no-pie"
++    fi
++    ;;
++esac
+ 
+ 
+ # Check linker supports '-z bndplt'
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/configure.ac gcc-6.3.0/gcc/configure.ac
+--- gcc-6.3.0-fsf/gcc/configure.ac	2017-03-30 16:18:18.865239634 -0700
++++ gcc-6.3.0/gcc/configure.ac	2017-03-30 16:23:21.720074124 -0700
+@@ -6160,31 +6160,45 @@ fi
+ AC_SUBST([enable_default_pie])
+ 
+ # Check if -fno-PIE works.
+-AC_CACHE_CHECK([for -fno-PIE option],
+-  [gcc_cv_c_no_fpie],
+-  [saved_CXXFLAGS="$CXXFLAGS"
+-   CXXFLAGS="$CXXFLAGS -fno-PIE"
+-   AC_COMPILE_IFELSE([int main(void) {return 0;}],
+-     [gcc_cv_c_no_fpie=yes],
+-     [gcc_cv_c_no_fpie=no])
+-   CXXFLAGS="$saved_CXXFLAGS"])
+-if test "$gcc_cv_c_no_fpie" = "yes"; then
+-  NO_PIE_CFLAGS="-fno-PIE"
+-fi
++case $host_os in
++  fuchsia*)
++    # Fuchsia requires PIE binaries
++    ;;
++  *)
++    AC_CACHE_CHECK([for -fno-PIE option],
++      [gcc_cv_c_no_fpie],
++      [saved_CXXFLAGS="$CXXFLAGS"
++       CXXFLAGS="$CXXFLAGS -fno-PIE"
++       AC_COMPILE_IFELSE([int main(void) {return 0;}],
++         [gcc_cv_c_no_fpie=yes],
++         [gcc_cv_c_no_fpie=no])
++       CXXFLAGS="$saved_CXXFLAGS"])
++    if test "$gcc_cv_c_no_fpie" = "yes"; then
++      NO_PIE_CFLAGS="-fno-PIE"
++    fi
++    ;;
++esac
+ AC_SUBST([NO_PIE_CFLAGS])
+ 
+ # Check if -no-pie works.
+-AC_CACHE_CHECK([for -no-pie option],
+-  [gcc_cv_no_pie],
+-  [saved_LDFLAGS="$LDFLAGS"
+-   LDFLAGS="$LDFLAGS -no-pie"
+-   AC_LINK_IFELSE([int main(void) {return 0;}],
+-     [gcc_cv_no_pie=yes],
+-     [gcc_cv_no_pie=no])
+-   LDFLAGS="$saved_LDFLAGS"])
+-if test "$gcc_cv_no_pie" = "yes"; then
+-  NO_PIE_FLAG="-no-pie"
+-fi
++case $host_os in
++  fuchsia*)
++    # Fuchsia requires PIE binaries
++    ;;
++  *)
++    AC_CACHE_CHECK([for -no-pie option],
++      [gcc_cv_no_pie],
++      [saved_LDFLAGS="$LDFLAGS"
++       LDFLAGS="$LDFLAGS -no-pie"
++       AC_LINK_IFELSE([int main(void) {return 0;}],
++         [gcc_cv_no_pie=yes],
++         [gcc_cv_no_pie=no])
++       LDFLAGS="$saved_LDFLAGS"])
++    if test "$gcc_cv_no_pie" = "yes"; then
++      NO_PIE_FLAG="-no-pie"
++    fi
++    ;;
++esac
+ AC_SUBST([NO_PIE_FLAG])
+ 
+ # Check linker supports '-z bndplt'
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/gcc.c gcc-6.3.0/gcc/gcc.c
+--- gcc-6.3.0-fsf/gcc/gcc.c	2017-03-30 16:18:18.805239865 -0700
++++ gcc-6.3.0/gcc/gcc.c	2017-03-30 16:23:21.724074108 -0700
+@@ -7255,14 +7255,18 @@ driver::global_initializations ()
+   if (atexit (delete_temp_files) != 0)
+     fatal_error (input_location, "atexit failed");
+ 
++#ifdef SIGINT
+   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
+     signal (SIGINT, fatal_signal);
++#endif
+ #ifdef SIGHUP
+   if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
+     signal (SIGHUP, fatal_signal);
+ #endif
++#ifdef SIGTERM
+   if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
+     signal (SIGTERM, fatal_signal);
++#endif
+ #ifdef SIGPIPE
+   if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
+     signal (SIGPIPE, fatal_signal);
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/gcov-tool.c gcc-6.3.0/gcc/gcov-tool.c
+--- gcc-6.3.0-fsf/gcc/gcov-tool.c	2017-03-30 16:18:18.793239910 -0700
++++ gcc-6.3.0/gcc/gcov-tool.c	2017-03-30 16:23:21.724074108 -0700
+@@ -51,7 +51,8 @@ extern void gcov_set_verbose (void);
+ /* Set to verbose output mode.  */
+ static bool verbose;
+ 
+-#if HAVE_FTW_H
++/* Fuchsia: remove when nftw has been implemented.  */
++#if HAVE_FTW_H && !defined(__Fuchsia__)
+ 
+ /* Remove file NAME if it has a gcda suffix. */
+ 
+@@ -80,7 +81,8 @@ unlink_gcda_file (const char *name,
+ static int
+ unlink_profile_dir (const char *path ATTRIBUTE_UNUSED)
+ {
+-#if HAVE_FTW_H
++/* Fuchsia: remove when nftw has been implemented.  */
++#if HAVE_FTW_H && !defined(__Fuchsia__)
+     return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
+ #else
+     return -1;
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/ggc-common.c gcc-6.3.0/gcc/ggc-common.c
+--- gcc-6.3.0-fsf/gcc/ggc-common.c	2017-03-30 16:18:17.565244626 -0700
++++ gcc-6.3.0/gcc/ggc-common.c	2017-03-30 16:23:21.724074108 -0700
+@@ -728,7 +728,8 @@ mmap_gt_pch_use_address (void *base, siz
+ static double
+ ggc_rlimit_bound (double limit)
+ {
+-#if defined(HAVE_GETRLIMIT)
++/* Fuchsia: getrlimit is not fully implemented yet.  */
++#if !defined(__Fuchsia__) && defined(HAVE_GETRLIMIT)
+   struct rlimit rlim;
+ # if defined (RLIMIT_AS)
+   /* RLIMIT_AS is what POSIX says is the limit on mmap.  Presumably
+@@ -752,7 +753,7 @@ ggc_rlimit_bound (double limit)
+       && rlim.rlim_cur >= 8 * 1024 * 1024)
+     limit = rlim.rlim_cur;
+ # endif /* RLIMIT_AS or RLIMIT_DATA */
+-#endif /* HAVE_GETRLIMIT */
++#endif /* !Fuchsia && HAVE_GETRLIMIT */
+ 
+   return limit;
+ }
+@@ -790,7 +791,8 @@ ggc_min_heapsize_heuristic (void)
+      bound of 128M (when RAM >= 1GB).  */
+   phys_kbytes /= 8;
+ 
+-#if defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS)
++/* Fuchsia: getrlimit is not fully implemented yet.  */
++#if !defined(__Fuchsia__) && defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS)
+   /* Try not to overrun the RSS limit while doing garbage collection.
+      The RSS limit is only advisory, so no margin is subtracted.  */
+  {
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/opts.c gcc-6.3.0/gcc/opts.c
+--- gcc-6.3.0-fsf/gcc/opts.c	2017-03-30 16:18:18.789239926 -0700
++++ gcc-6.3.0/gcc/opts.c	2017-03-30 16:23:21.724074108 -0700
+@@ -2386,7 +2386,8 @@ setup_core_dumping (diagnostic_context *
+ #ifdef SIGABRT
+   signal (SIGABRT, SIG_DFL);
+ #endif
+-#if defined(HAVE_SETRLIMIT)
++/* Fuchsia: remove when getrlimit/setrlimit have been implemented.  */
++#if !defined(__Fuchsia__) && defined(HAVE_SETRLIMIT)
+   {
+     struct rlimit rlim;
+     if (getrlimit (RLIMIT_CORE, &rlim) != 0)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/timevar.c gcc-6.3.0/gcc/timevar.c
+--- gcc-6.3.0-fsf/gcc/timevar.c	2017-03-30 16:18:18.869239620 -0700
++++ gcc-6.3.0/gcc/timevar.c	2017-03-30 16:23:21.724074108 -0700
+@@ -69,7 +69,8 @@ struct tms
+ # define HAVE_SYS_TIME
+ # define HAVE_WALL_TIME
+ #else
+-#ifdef HAVE_GETRUSAGE
++/* Fuchsia: remove when getrusage has been implemented.  */
++#if !defined(__Fuchsia__) && defined(HAVE_GETRUSAGE)
+ # if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
+   extern int getrusage (int, struct rusage *);
+ # endif
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/gcc/varasm.c gcc-6.3.0/gcc/varasm.c
+--- gcc-6.3.0-fsf/gcc/varasm.c	2017-03-30 16:18:17.549244687 -0700
++++ gcc-6.3.0/gcc/varasm.c	2017-03-30 16:23:21.724074108 -0700
+@@ -6193,15 +6193,20 @@ default_section_type_flags (tree decl, c
        || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
      flags |= SECTION_TLS | SECTION_BSS;
  
@@ -114,1578 +715,499 @@
      flags |= SECTION_NOTYPE;
  
    return flags;
-diff -dcprN gcc-6.2.0/config.sub gcc-6.2.0-fuchsia/config.sub
-*** gcc-6.2.0/config.sub	2015-12-31 13:13:28.000000000 -0800
---- gcc-6.2.0-fuchsia/config.sub	2016-10-24 17:07:48.244523443 -0700
-*************** case $os in
-*** 1531,1536 ****
---- 1531,1539 ----
-  		;;
-  	-nacl*)
-  		;;
-+ 	-fuchsia*)
-+ 		os=-fuchsia
-+ 		;;
-  	-none)
-  		;;
-  	*)
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/collect2.c gcc-6.2.0/gcc/collect2.c
-*** gcc-6.2.0-fsf/gcc/collect2.c	2016-11-23 09:11:05.324188090 -0800
---- gcc-6.2.0/gcc/collect2.c	2016-11-30 13:50:14.585469484 -0800
-*************** main (int argc, char **argv)
-*** 1067,1074 ****
---- 1067,1076 ----
-    if (signal (SIGQUIT, SIG_IGN) != SIG_IGN)
-      signal (SIGQUIT, handler);
-  #endif
-+ #ifdef SIGINT
-    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
-      signal (SIGINT, handler);
-+ #endif
-  #ifdef SIGALRM
-    if (signal (SIGALRM, SIG_IGN) != SIG_IGN)
-      signal (SIGALRM, handler);
-*************** main (int argc, char **argv)
-*** 1077,1084 ****
---- 1079,1088 ----
-    if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
-      signal (SIGHUP, handler);
-  #endif
-+ #ifdef SIGSEGV
-    if (signal (SIGSEGV, SIG_IGN) != SIG_IGN)
-      signal (SIGSEGV, handler);
-+ #endif
-  #ifdef SIGBUS
-    if (signal (SIGBUS, SIG_IGN) != SIG_IGN)
-      signal (SIGBUS, handler);
-*************** static void
-*** 2307,2313 ****
---- 2311,2319 ----
-  scan_prog_file (const char *prog_name, scanpass which_pass,
-  		scanfilter filter)
-  {
-+ #ifdef SIGINT
-    void (*int_handler) (int);
-+ #endif
-  #ifdef SIGQUIT
-    void (*quit_handler) (int);
-  #endif
-*************** scan_prog_file (const char *prog_name, s
-*** 2373,2379 ****
---- 2379,2387 ----
-  	fatal_error (input_location, errmsg);
-      }
-  
-+ #ifdef SIGINT
-    int_handler  = (void (*) (int)) signal (SIGINT,  SIG_IGN);
-+ #endif
-  #ifdef SIGQUIT
-    quit_handler = (void (*) (int)) signal (SIGQUIT, SIG_IGN);
-  #endif
-*************** scan_prog_file (const char *prog_name, s
-*** 2499,2505 ****
---- 2507,2515 ----
-  
-    do_wait (nm_file_name, pex);
-  
-+ #ifdef SIGINT
-    signal (SIGINT,  int_handler);
-+ #endif
-  #ifdef SIGQUIT
-    signal (SIGQUIT, quit_handler);
-  #endif
-*************** scan_libraries (const char *prog_name)
-*** 2571,2577 ****
---- 2581,2589 ----
-  	fatal_error (input_location, errmsg);
-      }
-  
-+ #ifdef SIGINT
-    int_handler  = (void (*) (int)) signal (SIGINT,  SIG_IGN);
-+ #endif
-  #ifdef SIGQUIT
-    quit_handler = (void (*) (int)) signal (SIGQUIT, SIG_IGN);
-  #endif
-*************** scan_libraries (const char *prog_name)
-*** 2619,2625 ****
---- 2631,2639 ----
-  
-    do_wait (ldd_file_name, pex);
-  
-+ #ifdef SIGINT
-    signal (SIGINT,  int_handler);
-+ #endif
-  #ifdef SIGQUIT
-    signal (SIGQUIT, quit_handler);
-  #endif
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/config/arm/fuchsia-elf.h gcc-6.2.0/gcc/config/arm/fuchsia-elf.h
-*** gcc-6.2.0-fsf/gcc/config/arm/fuchsia-elf.h	1969-12-31 16:00:00.000000000 -0800
---- gcc-6.2.0/gcc/config/arm/fuchsia-elf.h	2016-11-21 19:10:12.382326720 -0800
-***************
-*** 0 ****
---- 1,31 ----
-+ /* Configuration file for ARM Fuchsia ELF targets.
-+    Copyright (C) 2016 Free Software Foundation, Inc.
-+    Contributed by Google.
-+ 
-+    This file is part of GCC.
-+ 
-+    GCC is free software; you can redistribute it and/or modify it
-+    under the terms of the GNU General Public License as published
-+    by the Free Software Foundation; either version 3, or (at your
-+    option) any later version.
-+ 
-+    GCC is distributed in the hope that it will be useful, but WITHOUT
-+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-+    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-+    License for more details.
-+ 
-+    You should have received a copy of the GNU General Public License
-+    along with GCC; see the file COPYING3.  If not see
-+    <http://www.gnu.org/licenses/>.  */
-+ 
-+ /* Use the BPABI builtins and the generic OS builtins.  */
-+ #undef  TARGET_SUB_OS_CPP_BUILTINS
-+ #define TARGET_SUB_OS_CPP_BUILTINS() 		\
-+   TARGET_BPABI_CPP_BUILTINS()
-+ 
-+ /* Use the AAPCS ABI by default.  */
-+ #undef ARM_DEFAULT_ABI
-+ #define ARM_DEFAULT_ABI ARM_ABI_AAPCS
-+ 
-+ #define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect)
-+ 
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/config/fuchsia.h gcc-6.2.0/gcc/config/fuchsia.h
-*** gcc-6.2.0-fsf/gcc/config/fuchsia.h	1969-12-31 16:00:00.000000000 -0800
---- gcc-6.2.0/gcc/config/fuchsia.h	2017-01-10 09:07:12.943847114 -0800
-***************
-*** 0 ****
---- 1,105 ----
-+ /* Base configuration file for all Fuchsia targets.
-+    Copyright (C) 2016 Free Software Foundation, Inc.
-+ 
-+ This file is part of GCC.
-+ 
-+ GCC is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 3, or (at your option)
-+ any later version.
-+ 
-+ GCC is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ GNU General Public License for more details.
-+ 
-+ You should have received a copy of the GNU General Public License
-+ along with GCC; see the file COPYING3.  If not see
-+ <http://www.gnu.org/licenses/>.  */
-+ 
-+ /* Common Fuchsia configuration.  */
-+ 
-+ /* In case we need to know.  */
-+ #define USING_CONFIG_FUCHSIA 1
-+ 
-+ #undef  STARTFILE_SPEC
-+ #define STARTFILE_SPEC "%{!shared: crt1%O%s} crtbegin%O%s"
-+ 
-+ #undef  ENDFILE_SPEC
-+ #define ENDFILE_SPEC "crtend%O%s"
-+ 
-+ /* When neither pic nor pie has been specified, use PIE by default.  */
-+ #undef  CC1_SPEC
-+ #define CC1_SPEC "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC:" \
-+                    "%{!fno-pie:%{!fno-PIE:%{!fpie:%{!fPIE: -fPIE}}}}}}}}"
-+ 
-+ #undef  LIB_SPEC
-+ #define LIB_SPEC "--start-group" \
-+ 		 " -lmxio -lmagenta -lc -llaunchpad" \
-+ 		 "%{!static: -lgcc_s}" \
-+ 		 " --end-group"
-+ 
-+ #undef  LINK_SPEC
-+ #define LINK_SPEC "-z max-page-size=4096" \
-+ 		  " -z combreloc" \
-+ 		  " -z relro" \
-+ 		  " -z now" \
-+ 		  " -z text" \
-+ 		  "%{!hash-style: --hash-style=gnu}" \
-+ 		  "%{!no-eh-frame-hdr: --eh-frame-hdr}" \
-+ 		  "%{!no-build-id: --build-id}" \
-+ 		  "%{shared: -shared}" \
-+ 		  "%{!shared:%{!static:%{!dynamic-linker: -dynamic-linker=ld.so.1}}}"
-+ 
-+ /* We are using MUSL as our libc.  */
-+ #undef  OPTION_MUSL
-+ #define OPTION_MUSL 1
-+ 
-+ #ifndef TARGET_SUB_OS_CPP_BUILTINS
-+ #define TARGET_SUB_OS_CPP_BUILTINS()
-+ #endif
-+ 
-+ #undef  TARGET_OS_CPP_BUILTINS
-+ #define TARGET_OS_CPP_BUILTINS()		\
-+   do						\
-+     {						\
-+       builtin_define ("__Fuchsia__");		\
-+       TARGET_SUB_OS_CPP_BUILTINS();		\
-+     }						\
-+   while (false)
-+ 
-+ /* /dev/null is unwritable, at the moment. Use this as a workaround.  */
-+ #undef  HOST_BIT_BUCKET
-+ #define HOST_BIT_BUCKET "/tmp/.null"
-+ 
-+ /* Inode numbers are not available to us.  */
-+ #define HOST_LACKS_INODE_NUMBERS
-+ 
-+ /* In fact we have ftw.h, but the function itself is unimplemented.  */
-+ #undef HAVE_FTW_H
-+ 
-+ /* Functions that are implemented as stubs in libc.  */
-+ #undef HAVE_GETRLIMIT
-+ #undef HAVE_GETRUSAGE
-+ #undef HAVE_REALPATH
-+ #undef HAVE_SETRLIMIT
-+ #undef HAVE_TIMES
-+ 
-+ /* No ioctl() support.  */
-+ #undef TIOCGWINSZ
-+ 
-+ /* No signal() support.  */
-+ #undef SIGABRT
-+ #undef SIGALRM
-+ #undef SIGBUS
-+ #undef SIGCHLD
-+ #undef SIGFPE
-+ #undef SIGHUP
-+ #undef SIGILL
-+ #undef SIGINT
-+ #undef SIGIOT
-+ #undef SIGPIPE
-+ #undef SIGQUIT
-+ #undef SIGSEGV
-+ #undef SIGTERM
-+ 
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/config.gcc gcc-6.2.0/gcc/config.gcc
-*** gcc-6.2.0-fsf/gcc/config.gcc	2016-11-23 09:11:05.804186203 -0800
---- gcc-6.2.0/gcc/config.gcc	2016-11-21 16:05:55.706051533 -0800
-*************** case ${target} in
-*** 710,715 ****
---- 710,718 ----
-    esac
-    use_gcc_stdint=wrap
-    ;;
-+ *-*-fuchsia*)
-+   native_system_header_dir=/include
-+   ;;
-  *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
-    extra_options="$extra_options gnu-user.opt"
-    gas=yes
-*************** case ${target} in
-*** 907,913 ****
-  esac
-  
-  case ${target} in
-! aarch64*-*-elf | aarch64*-*-rtems*)
-  	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
-  	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
-  	tmake_file="${tmake_file} aarch64/t-aarch64"
---- 910,916 ----
-  esac
-  
-  case ${target} in
-! aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
-  	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
-  	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-elf-raw.h"
-  	tmake_file="${tmake_file} aarch64/t-aarch64"
-*************** aarch64*-*-elf | aarch64*-*-rtems*)
-*** 915,920 ****
---- 918,926 ----
-  	aarch64-*-elf*)
-  		use_gcc_stdint=wrap
-  		;;
-+         aarch64-*-fuchsia*)
-+                 tm_file="${tm_file} fuchsia.h"
-+                 ;;
-  	aarch64-*-rtems*)
-  	  	tm_file="${tm_file} rtems.h aarch64/rtems.h"
-  		;;
-*************** arm*-*-uclinux*eabi*)		# ARM ucLinux
-*** 1097,1103 ****
-  	# The EABI requires the use of __cxa_atexit.
-  	default_use_cxa_atexit=yes
-  	;;
-! arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
-  	case ${target} in
-  	arm*eb-*-eabi*)
-  	  tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
---- 1103,1109 ----
-  	# The EABI requires the use of __cxa_atexit.
-  	default_use_cxa_atexit=yes
-  	;;
-! arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*)
-  	case ${target} in
-  	arm*eb-*-eabi*)
-  	  tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
-*************** arm*-*-eabi* | arm*-*-symbianelf* | arm*
-*** 1111,1116 ****
---- 1117,1126 ----
-  	  tmake_file="${tmake_file} arm/t-bpabi"
-  	  use_gcc_stdint=wrap
-  	  ;;
-+ 	arm*-*-fuchsia*)
-+ 	  tm_file="${tm_file} fuchsia.h arm/fuchsia-elf.h glibc-stdint.h"
-+ 	  tmake_file="${tmake_file} arm/t-bpabi"
-+ 	  ;;
-  	arm*-*-rtems*)
-  	  tm_file="${tm_file} rtems.h arm/rtems.h newlib-stdint.h"
-  	  tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems"
-*************** i[34567]86-*-elf*)
-*** 1418,1423 ****
---- 1428,1434 ----
-  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
-  	;;
-  x86_64-*-elf*)
-+ 	tmake_file="${tmake_file} i386/t-x86_64-elf"
-  	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
-  	;;
-  x86_64-*-rtems*)
-*************** i[34567]86-*-interix[3-9]*)
-*** 1791,1796 ****
---- 1802,1811 ----
-  		tm_file="${tm_file} dbxcoff.h"
-  	fi
-  	;;
-+ x86_64-*-fuchsia*)
-+ 	tmake_file="${tmake_file} i386/t-x86_64-elf"
-+ 	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h fuchsia.h"
-+ 	;;
-  ia64*-*-elf*)
-  	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h"
-  	tmake_file="ia64/t-ia64"
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/config.host gcc-6.2.0/gcc/config.host
-*** gcc-6.2.0-fsf/gcc/config.host	2016-11-23 09:10:49.908248680 -0800
---- gcc-6.2.0/gcc/config.host	2016-11-21 18:57:29.749649894 -0800
-*************** case ${host} in
-*** 99,105 ****
-  esac
-  
-  case ${host} in
-!   aarch64*-*-linux*)
-      case ${target} in
-        aarch64*-*-*)
-  	host_extra_gcc_objs="driver-aarch64.o"
---- 99,105 ----
-  esac
-  
-  case ${host} in
-!   aarch64*-*-linux* | aarch64*-*-fuchsia*)
-      case ${target} in
-        aarch64*-*-*)
-  	host_extra_gcc_objs="driver-aarch64.o"
-*************** case ${host} in
-*** 107,113 ****
-  	;;
-      esac
-      ;;
-!   arm*-*-freebsd* | arm*-*-linux*)
-      case ${target} in
-        arm*-*-*)
-  	host_extra_gcc_objs="driver-arm.o"
---- 107,113 ----
-  	;;
-      esac
-      ;;
-!   arm*-*-freebsd* | arm*-*-linux* | arm*-*-fuchsia*)
-      case ${target} in
-        arm*-*-*)
-  	host_extra_gcc_objs="driver-arm.o"
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/configure gcc-6.2.0/gcc/configure
-*** gcc-6.2.0-fsf/gcc/configure	2016-11-23 09:11:05.200188577 -0800
---- gcc-6.2.0/gcc/configure	2016-11-30 12:34:30.868394376 -0800
-*************** if test -z "$aix_libpath"; then aix_libp
-*** 16703,16708 ****
---- 16703,16715 ----
-        hardcode_shlibpath_var=no
-        ;;
-  
-+     fuchsia*)
-+       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-+       hardcode_libdir_flag_spec='-R$libdir'
-+       hardcode_direct=yes
-+       hardcode_shlibpath_var=no
-+       ;;
-+ 
-      hpux9*)
-        if test "$GCC" = yes; then
-  	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-*************** freebsd* | dragonfly*)
-*** 17638,17643 ****
---- 17645,17656 ----
-    esac
-    ;;
-  
-+ fuchsia*)
-+   library_names_spec='${libname}${shared_ext}'
-+   need_lib_prefix=no
-+   need_version=no
-+   ;;
-+ 
-  gnu*)
-    version_type=linux
-    need_lib_prefix=no
-*************** fi
-*** 18241,18246 ****
---- 18254,18264 ----
-  
-      ;;
-  
-+   fuchsia*)
-+     lt_cv_dlopen="dlopen"
-+     lt_cv_dlopen_libs=
-+     ;;
-+ 
-    *)
-      ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-  if test "x$ac_cv_func_shl_load" = x""yes; then :
-*************** else
-*** 18453,18459 ****
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 18456 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
---- 18471,18477 ----
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 18474 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
-*************** else
-*** 18559,18565 ****
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 18562 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
---- 18577,18583 ----
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 18580 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
-*************** freebsd* | dragonfly*)
-*** 21298,21303 ****
---- 21316,21327 ----
-    esac
-    ;;
-  
-+ fuchsia*)
-+   library_names_spec='${libname}${shared_ext}'
-+   need_lib_prefix=no
-+   need_version=no
-+   ;;
-+ 
-  gnu*)
-    version_type=linux
-    need_lib_prefix=no
-*************** fi
-*** 29375,29388 ****
-  
-  
-  # Check if -fno-PIE works.
-! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5
-  $as_echo_n "checking for -fno-PIE option... " >&6; }
-  if test "${gcc_cv_c_no_fpie+set}" = set; then :
-    $as_echo_n "(cached) " >&6
-  else
-    saved_CXXFLAGS="$CXXFLAGS"
-!    CXXFLAGS="$CXXFLAGS -fno-PIE"
-!    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-  /* end confdefs.h.  */
-  int main(void) {return 0;}
-  _ACEOF
---- 29399,29417 ----
-  
-  
-  # Check if -fno-PIE works.
-! case $host_os in
-!   fuchsia*)
-!     # Fuchsia requires PIE binaries
-!     ;;
-!   *)
-!     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-PIE option" >&5
-  $as_echo_n "checking for -fno-PIE option... " >&6; }
-  if test "${gcc_cv_c_no_fpie+set}" = set; then :
-    $as_echo_n "(cached) " >&6
-  else
-    saved_CXXFLAGS="$CXXFLAGS"
-!        CXXFLAGS="$CXXFLAGS -fno-PIE"
-!        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-  /* end confdefs.h.  */
-  int main(void) {return 0;}
-  _ACEOF
-*************** else
-*** 29392,29415 ****
-    gcc_cv_c_no_fpie=no
-  fi
-  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-!    CXXFLAGS="$saved_CXXFLAGS"
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5
-  $as_echo "$gcc_cv_c_no_fpie" >&6; }
-! if test "$gcc_cv_c_no_fpie" = "yes"; then
-!   NO_PIE_CFLAGS="-fno-PIE"
-! fi
-  
-  
-  # Check if -no-pie works.
-! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
-  $as_echo_n "checking for -no-pie option... " >&6; }
-  if test "${gcc_cv_no_pie+set}" = set; then :
-    $as_echo_n "(cached) " >&6
-  else
-    saved_LDFLAGS="$LDFLAGS"
-!    LDFLAGS="$LDFLAGS -no-pie"
-!    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-  /* end confdefs.h.  */
-  int main(void) {return 0;}
-  _ACEOF
---- 29421,29451 ----
-    gcc_cv_c_no_fpie=no
-  fi
-  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-!        CXXFLAGS="$saved_CXXFLAGS"
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_c_no_fpie" >&5
-  $as_echo "$gcc_cv_c_no_fpie" >&6; }
-!     if test "$gcc_cv_c_no_fpie" = "yes"; then
-!       NO_PIE_CFLAGS="-fno-PIE"
-!     fi
-!     ;;
-! esac
-  
-  
-  # Check if -no-pie works.
-! case $host_os in
-!   fuchsia*)
-!     # Fuchsia requires PIE binaries
-!     ;;
-!   *)
-!     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -no-pie option" >&5
-  $as_echo_n "checking for -no-pie option... " >&6; }
-  if test "${gcc_cv_no_pie+set}" = set; then :
-    $as_echo_n "(cached) " >&6
-  else
-    saved_LDFLAGS="$LDFLAGS"
-!        LDFLAGS="$LDFLAGS -no-pie"
-!        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-  /* end confdefs.h.  */
-  int main(void) {return 0;}
-  _ACEOF
-*************** else
-*** 29420,29432 ****
-  fi
-  rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-!    LDFLAGS="$saved_LDFLAGS"
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
-  $as_echo "$gcc_cv_no_pie" >&6; }
-! if test "$gcc_cv_no_pie" = "yes"; then
-!   NO_PIE_FLAG="-no-pie"
-! fi
-  
-  
-  # Check linker supports '-z bndplt'
---- 29456,29470 ----
-  fi
-  rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-!        LDFLAGS="$saved_LDFLAGS"
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5
-  $as_echo "$gcc_cv_no_pie" >&6; }
-!     if test "$gcc_cv_no_pie" = "yes"; then
-!       NO_PIE_FLAG="-no-pie"
-!     fi
-!     ;;
-! esac
-  
-  
-  # Check linker supports '-z bndplt'
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/configure.ac gcc-6.2.0/gcc/configure.ac
-*** gcc-6.2.0-fsf/gcc/configure.ac	2016-11-23 09:11:05.952185621 -0800
---- gcc-6.2.0/gcc/configure.ac	2016-11-30 12:31:48.821079660 -0800
-*************** fi
-*** 6086,6116 ****
-  AC_SUBST([enable_default_pie])
-  
-  # Check if -fno-PIE works.
-! AC_CACHE_CHECK([for -fno-PIE option],
-!   [gcc_cv_c_no_fpie],
-!   [saved_CXXFLAGS="$CXXFLAGS"
-!    CXXFLAGS="$CXXFLAGS -fno-PIE"
-!    AC_COMPILE_IFELSE([int main(void) {return 0;}],
-!      [gcc_cv_c_no_fpie=yes],
-!      [gcc_cv_c_no_fpie=no])
-!    CXXFLAGS="$saved_CXXFLAGS"])
-! if test "$gcc_cv_c_no_fpie" = "yes"; then
-!   NO_PIE_CFLAGS="-fno-PIE"
-! fi
-  AC_SUBST([NO_PIE_CFLAGS])
-  
-  # Check if -no-pie works.
-! AC_CACHE_CHECK([for -no-pie option],
-!   [gcc_cv_no_pie],
-!   [saved_LDFLAGS="$LDFLAGS"
-!    LDFLAGS="$LDFLAGS -no-pie"
-!    AC_LINK_IFELSE([int main(void) {return 0;}],
-!      [gcc_cv_no_pie=yes],
-!      [gcc_cv_no_pie=no])
-!    LDFLAGS="$saved_LDFLAGS"])
-! if test "$gcc_cv_no_pie" = "yes"; then
-!   NO_PIE_FLAG="-no-pie"
-! fi
-  AC_SUBST([NO_PIE_FLAG])
-  
-  # Check linker supports '-z bndplt'
---- 6086,6130 ----
-  AC_SUBST([enable_default_pie])
-  
-  # Check if -fno-PIE works.
-! case $host_os in
-!   fuchsia*)
-!     # Fuchsia requires PIE binaries
-!     ;;
-!   *)
-!     AC_CACHE_CHECK([for -fno-PIE option],
-!       [gcc_cv_c_no_fpie],
-!       [saved_CXXFLAGS="$CXXFLAGS"
-!        CXXFLAGS="$CXXFLAGS -fno-PIE"
-!        AC_COMPILE_IFELSE([int main(void) {return 0;}],
-!          [gcc_cv_c_no_fpie=yes],
-!          [gcc_cv_c_no_fpie=no])
-!        CXXFLAGS="$saved_CXXFLAGS"])
-!     if test "$gcc_cv_c_no_fpie" = "yes"; then
-!       NO_PIE_CFLAGS="-fno-PIE"
-!     fi
-!     ;;
-! esac
-  AC_SUBST([NO_PIE_CFLAGS])
-  
-  # Check if -no-pie works.
-! case $host_os in
-!   fuchsia*)
-!     # Fuchsia requires PIE binaries
-!     ;;
-!   *)
-!     AC_CACHE_CHECK([for -no-pie option],
-!       [gcc_cv_no_pie],
-!       [saved_LDFLAGS="$LDFLAGS"
-!        LDFLAGS="$LDFLAGS -no-pie"
-!        AC_LINK_IFELSE([int main(void) {return 0;}],
-!          [gcc_cv_no_pie=yes],
-!          [gcc_cv_no_pie=no])
-!        LDFLAGS="$saved_LDFLAGS"])
-!     if test "$gcc_cv_no_pie" = "yes"; then
-!       NO_PIE_FLAG="-no-pie"
-!     fi
-!     ;;
-! esac
-  AC_SUBST([NO_PIE_FLAG])
-  
-  # Check linker supports '-z bndplt'
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/gcc.c gcc-6.2.0/gcc/gcc.c
-*** gcc-6.2.0-fsf/gcc/gcc.c	2016-11-23 09:11:05.472187508 -0800
---- gcc-6.2.0/gcc/gcc.c	2016-11-30 13:46:59.158288993 -0800
-*************** driver::global_initializations ()
-*** 7255,7268 ****
---- 7255,7272 ----
-    if (atexit (delete_temp_files) != 0)
-      fatal_error (input_location, "atexit failed");
-  
-+ #ifdef SIGINT
-    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
-      signal (SIGINT, fatal_signal);
-+ #endif
-  #ifdef SIGHUP
-    if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
-      signal (SIGHUP, fatal_signal);
-  #endif
-+ #ifdef SIGTERM
-    if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
-      signal (SIGTERM, fatal_signal);
-+ #endif
-  #ifdef SIGPIPE
-    if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
-      signal (SIGPIPE, fatal_signal);
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/gcov-tool.c gcc-6.2.0/gcc/gcov-tool.c
-*** gcc-6.2.0-fsf/gcc/gcov-tool.c	2017-02-10 09:48:15.342343009 -0800
---- gcc-6.2.0/gcc/gcov-tool.c	2017-02-10 10:58:43.887925206 -0800
-*************** extern void gcov_set_verbose (void);
-*** 51,57 ****
-  /* Set to verbose output mode.  */
-  static bool verbose;
-  
-! #if HAVE_FTW_H
-  
-  /* Remove file NAME if it has a gcda suffix. */
-  
---- 51,58 ----
-  /* Set to verbose output mode.  */
-  static bool verbose;
-  
-! /* Fuchsia: remove when nftw has been implemented.  */
-! #if HAVE_FTW_H && !defined(__Fuchsia__)
-  
-  /* Remove file NAME if it has a gcda suffix. */
-  
-*************** unlink_gcda_file (const char *name,
-*** 80,86 ****
-  static int
-  unlink_profile_dir (const char *path ATTRIBUTE_UNUSED)
-  {
-! #if HAVE_FTW_H
-      return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
-  #else
-      return -1;
---- 81,88 ----
-  static int
-  unlink_profile_dir (const char *path ATTRIBUTE_UNUSED)
-  {
-! /* Fuchsia: remove when nftw has been implemented.  */
-! #if HAVE_FTW_H && !defined(__Fuchsia__)
-      return nftw(path, unlink_gcda_file, 64, FTW_DEPTH | FTW_PHYS);
-  #else
-      return -1;
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/ggc-common.c gcc-6.2.0/gcc/ggc-common.c
-*** gcc-6.2.0-fsf/gcc/ggc-common.c	2016-12-20 13:59:53.022879377 -0800
---- gcc-6.2.0/gcc/ggc-common.c	2017-01-10 14:54:17.969607414 -0800
-*************** mmap_gt_pch_use_address (void *base, siz
-*** 728,734 ****
-  static double
-  ggc_rlimit_bound (double limit)
-  {
-! #if defined(HAVE_GETRLIMIT)
-    struct rlimit rlim;
-  # if defined (RLIMIT_AS)
-    /* RLIMIT_AS is what POSIX says is the limit on mmap.  Presumably
---- 728,735 ----
-  static double
-  ggc_rlimit_bound (double limit)
-  {
-! /* Fuchsia: getrlimit is not fully implemented yet.  */
-! #if !defined(__Fuchsia__) && defined(HAVE_GETRLIMIT)
-    struct rlimit rlim;
-  # if defined (RLIMIT_AS)
-    /* RLIMIT_AS is what POSIX says is the limit on mmap.  Presumably
-*************** ggc_rlimit_bound (double limit)
-*** 752,758 ****
-        && rlim.rlim_cur >= 8 * 1024 * 1024)
-      limit = rlim.rlim_cur;
-  # endif /* RLIMIT_AS or RLIMIT_DATA */
-! #endif /* HAVE_GETRLIMIT */
-  
-    return limit;
-  }
---- 753,759 ----
-        && rlim.rlim_cur >= 8 * 1024 * 1024)
-      limit = rlim.rlim_cur;
-  # endif /* RLIMIT_AS or RLIMIT_DATA */
-! #endif /* !Fuchsia && HAVE_GETRLIMIT */
-  
-    return limit;
-  }
-*************** ggc_min_heapsize_heuristic (void)
-*** 790,796 ****
-       bound of 128M (when RAM >= 1GB).  */
-    phys_kbytes /= 8;
-  
-! #if defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS)
-    /* Try not to overrun the RSS limit while doing garbage collection.
-       The RSS limit is only advisory, so no margin is subtracted.  */
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libgcc/config/t-slibgcc-fuchsia gcc-6.3.0/libgcc/config/t-slibgcc-fuchsia
+--- gcc-6.3.0-fsf/libgcc/config/t-slibgcc-fuchsia	1969-12-31 16:00:00.000000000 -0800
++++ gcc-6.3.0/libgcc/config/t-slibgcc-fuchsia	2017-03-30 16:23:21.728074093 -0700
+@@ -0,0 +1,22 @@
++# Copyright (C) 2016 Free Software Foundation, Inc.
++#
++# This file is part of GCC.
++#
++# GCC is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# GCC is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GCC; see the file COPYING3.  If not see
++# <http://www.gnu.org/licenses/>.
++
++# Fuchsia-specific shared library overrides.
++
++SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \
++                $(LDFLAGS)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libgcc/config.host gcc-6.3.0/libgcc/config.host
+--- gcc-6.3.0-fsf/libgcc/config.host	2017-03-30 16:18:19.057238897 -0700
++++ gcc-6.3.0/libgcc/config.host	2017-03-31 18:28:28.201747975 -0700
+@@ -230,6 +230,10 @@ case ${host} in
+       ;;
+   esac
+   ;;
++*-*-fuchsia*)
++  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia"
++  extra_parts="crtbegin.o crtend.o"
++  ;;
+ *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
+   tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
+   extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
+@@ -333,6 +337,10 @@ aarch64*-*-elf | aarch64*-*-rtems*)
+ 	tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
+ 	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
+ 	;;
++aarch64*-*-fuchsia*)
++	tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
++	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
++	;;
+ aarch64*-*-linux*)
+ 	extra_parts="$extra_parts crtfastmath.o"
+ 	md_unwind_header=aarch64/linux-unwind.h
+@@ -584,8 +592,8 @@ i[34567]86-*-elfiamcu)
+ i[34567]86-*-elf*)
+ 	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
+ 	;;
+-x86_64-*-elf* | x86_64-*-rtems*)
+-	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
++x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia*)
++	tmake_file="$tmake_file t-libgcc-pic"
+ 	;;
+ i[34567]86-*-dragonfly*)
+ 	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libgcc/libgcov-util.c gcc-6.3.0/libgcc/libgcov-util.c
+--- gcc-6.3.0-fsf/libgcc/libgcov-util.c	2017-03-30 16:18:19.057238897 -0700
++++ gcc-6.3.0/libgcc/libgcov-util.c	2017-03-30 16:23:21.728074093 -0700
+@@ -382,7 +382,8 @@ read_gcda_file (const char *filename)
+   return obj_info;
+ }
+ 
+-#ifdef HAVE_FTW_H
++/* Fuchsia: remove when ftw has been implemented.  */
++#if defined(HAVE_FTW_H) && !defined(__Fuchsia__)
+ /* This will be called by ftw(). It opens and read a gcda file FILENAME.
+    Return a non-zero value to stop the tree walk.  */
+ 
+@@ -455,7 +456,8 @@ gcov_read_profile_dir (const char* dir_n
+       fnotice (stderr, "%s is not a directory\n", dir_name);
+       return NULL;
+     }
+-#ifdef HAVE_FTW_H
++/* Fuchsia: remove when ftw has been implemented.  */
++#if defined(HAVE_FTW_H) && !defined(__Fuchsia__)
+   ftw (".", ftw_read_file, 50);
+ #endif
+   ret = chdir (pwd);
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libiberty/lrealpath.c gcc-6.3.0/libiberty/lrealpath.c
+--- gcc-6.3.0-fsf/libiberty/lrealpath.c	2017-03-30 16:18:18.997239127 -0700
++++ gcc-6.3.0/libiberty/lrealpath.c	2017-03-30 16:23:21.728074093 -0700
+@@ -56,7 +56,8 @@ components will be simplified.  The retu
+ extern char *canonicalize_file_name (const char *);
+ #endif
+ 
+-#if defined(HAVE_REALPATH)
++/* Fuchsia: remove when realpath has been implemented.  */
++#if !defined(__Fuchsia__) && defined(HAVE_REALPATH)
+ # if defined (PATH_MAX)
+ #  define REALPATH_LIMIT PATH_MAX
+ # else
+@@ -109,7 +110,9 @@ lrealpath (const char *filename)
+      pathconf()) making it impossible to pass a correctly sized buffer
+      to realpath() (it could always overflow).  On those systems, we
+      skip this.  */
+-#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H)
++/* Fuchsia: remove from conditional when realpath has been implemented.  */
++#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) \
++    && !defined (__Fuchsia__)
    {
---- 791,798 ----
-       bound of 128M (when RAM >= 1GB).  */
-    phys_kbytes /= 8;
-  
-! /* Fuchsia: getrlimit is not fully implemented yet.  */
-! #if !defined(__Fuchsia__) && defined(HAVE_GETRLIMIT) && defined (RLIMIT_RSS)
-    /* Try not to overrun the RSS limit while doing garbage collection.
-       The RSS limit is only advisory, so no margin is subtracted.  */
-   {
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/opts.c gcc-6.2.0/gcc/opts.c
-*** gcc-6.2.0-fsf/gcc/opts.c	2016-12-20 14:00:05.086836577 -0800
---- gcc-6.2.0/gcc/opts.c	2017-01-10 14:58:46.448360086 -0800
-*************** setup_core_dumping (diagnostic_context *
-*** 2386,2392 ****
-  #ifdef SIGABRT
-    signal (SIGABRT, SIG_DFL);
-  #endif
-! #if defined(HAVE_SETRLIMIT)
-    {
-      struct rlimit rlim;
-      if (getrlimit (RLIMIT_CORE, &rlim) != 0)
---- 2386,2393 ----
-  #ifdef SIGABRT
-    signal (SIGABRT, SIG_DFL);
-  #endif
-! /* Fuchsia: remove when getrlimit/setrlimit have been implemented.  */
-! #if !defined(__Fuchsia__) && defined(HAVE_SETRLIMIT)
-    {
-      struct rlimit rlim;
-      if (getrlimit (RLIMIT_CORE, &rlim) != 0)
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/gcc/timevar.c gcc-6.2.0/gcc/timevar.c
-*** gcc-6.2.0-fsf/gcc/timevar.c	2016-12-20 14:00:05.594834775 -0800
---- gcc-6.2.0/gcc/timevar.c	2017-01-10 14:56:40.812936374 -0800
-*************** struct tms
-*** 69,75 ****
-  # define HAVE_SYS_TIME
-  # define HAVE_WALL_TIME
-  #else
-! #ifdef HAVE_GETRUSAGE
-  # if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
-    extern int getrusage (int, struct rusage *);
-  # endif
---- 69,76 ----
-  # define HAVE_SYS_TIME
-  # define HAVE_WALL_TIME
-  #else
-! /* Fuchsia: remove when getrusage has been implemented.  */
-! #if !defined(__Fuchsia__) && defined(HAVE_GETRUSAGE)
-  # if defined HAVE_DECL_GETRUSAGE && !HAVE_DECL_GETRUSAGE
-    extern int getrusage (int, struct rusage *);
-  # endif
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libgcc/config/arm/unwind-arm.h gcc-6.2.0/libgcc/config/arm/unwind-arm.h
-*** gcc-6.2.0-fsf/libgcc/config/arm/unwind-arm.h	2016-12-20 14:00:07.118829367 -0800
---- gcc-6.2.0/libgcc/config/arm/unwind-arm.h	2017-01-10 09:08:36.419550153 -0800
-*************** extern "C" {
-*** 49,55 ****
-  	return 0;
-  
-  #if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \
-!     || defined(__FreeBSD__)
-        /* Pc-relative indirect.  */
-  #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect)
-        tmp += ptr;
---- 49,55 ----
-  	return 0;
-  
-  #if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \
-!     || defined(__FreeBSD__) || defined(__Fuchsia__)
-        /* Pc-relative indirect.  */
-  #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect)
-        tmp += ptr;
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libgcc/config/t-slibgcc-fuchsia gcc-6.2.0/libgcc/config/t-slibgcc-fuchsia
-*** gcc-6.2.0-fsf/libgcc/config/t-slibgcc-fuchsia	1969-12-31 16:00:00.000000000 -0800
---- gcc-6.2.0/libgcc/config/t-slibgcc-fuchsia	2016-11-16 08:49:38.427039926 -0800
-***************
-*** 0 ****
---- 1,22 ----
-+ # Copyright (C) 2016 Free Software Foundation, Inc.
-+ #
-+ # This file is part of GCC.
-+ #
-+ # GCC is free software; you can redistribute it and/or modify
-+ # it under the terms of the GNU General Public License as published by
-+ # the Free Software Foundation; either version 3, or (at your option)
-+ # any later version.
-+ #
-+ # GCC is distributed in the hope that it will be useful,
-+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ # GNU General Public License for more details.
-+ #
-+ # You should have received a copy of the GNU General Public License
-+ # along with GCC; see the file COPYING3.  If not see
-+ # <http://www.gnu.org/licenses/>.
-+ 
-+ # Fuchsia-specific shared library overrides.
-+ 
-+ SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \
-+                 $(LDFLAGS)
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libgcc/config.host gcc-6.2.0/libgcc/config.host
-*** gcc-6.2.0-fsf/libgcc/config.host	2016-11-23 09:11:08.440175844 -0800
---- gcc-6.2.0/libgcc/config.host	2016-12-08 12:43:21.452060382 -0800
-*************** case ${host} in
-*** 230,235 ****
---- 230,239 ----
-        ;;
-    esac
-    ;;
-+ *-*-fuchsia*)
-+   tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia"
-+   extra_parts="crtbegin.o crtend.o"
-+   ;;
-  *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
-    tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux"
-    extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
-*************** aarch64*-*-elf | aarch64*-*-rtems*)
-*** 333,338 ****
---- 337,346 ----
-  	tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
-  	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
-  	;;
-+ aarch64*-*-fuchsia*)
-+ 	tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
-+ 	tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp"
-+ 	;;
-  aarch64*-*-linux*)
-  	extra_parts="$extra_parts crtfastmath.o"
-  	md_unwind_header=aarch64/linux-unwind.h
-*************** arm*-*-freebsd*)                # ARM Fr
-*** 383,388 ****
---- 391,402 ----
-  	unwind_header=config/arm/unwind-arm.h
-  	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
-  	;;
-+ arm*-*-fuchsia*)
-+ 	tmake_file="${tmake_file} arm/t-arm arm/t-elf arm/t-bpabi"
-+ 	tmake_file="${tmake_file} arm/tsoftfp t-softfp"
-+ 	tm_file="${tm_file} arm/bpabi-lib.h"
-+ 	unwind_header=config/arm/unwind-arm.h
-+ 	;;
-  arm*-*-netbsdelf*)
-  	tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover"
-  	;;
-*************** i[34567]86-*-elfiamcu)
-*** 577,584 ****
-  i[34567]86-*-elf*)
-  	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
-  	;;
-! x86_64-*-elf* | x86_64-*-rtems*)
-! 	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
-  	;;
-  i[34567]86-*-dragonfly*)
-  	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
---- 591,598 ----
-  i[34567]86-*-elf*)
-  	tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
-  	;;
-! x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia*)
-! 	tmake_file="$tmake_file t-libgcc-pic"
-  	;;
-  i[34567]86-*-dragonfly*)
-  	tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff"
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libgcc/libgcov-util.c gcc-6.2.0/libgcc/libgcov-util.c
-*** gcc-6.2.0-fsf/libgcc/libgcov-util.c	2017-02-10 09:48:17.438335487 -0800
---- gcc-6.2.0/libgcc/libgcov-util.c	2017-02-10 10:59:15.295811444 -0800
-*************** read_gcda_file (const char *filename)
-*** 382,388 ****
-    return obj_info;
-  }
-  
-! #ifdef HAVE_FTW_H
-  /* This will be called by ftw(). It opens and read a gcda file FILENAME.
-     Return a non-zero value to stop the tree walk.  */
-  
---- 382,389 ----
-    return obj_info;
-  }
-  
-! /* Fuchsia: remove when ftw has been implemented.  */
-! #if defined(HAVE_FTW_H) && !defined(__Fuchsia__)
-  /* This will be called by ftw(). It opens and read a gcda file FILENAME.
-     Return a non-zero value to stop the tree walk.  */
-  
-*************** gcov_read_profile_dir (const char* dir_n
-*** 455,461 ****
-        fnotice (stderr, "%s is not a directory\n", dir_name);
-        return NULL;
-      }
-! #ifdef HAVE_FTW_H
-    ftw (".", ftw_read_file, 50);
-  #endif
-    ret = chdir (pwd);
---- 456,463 ----
-        fnotice (stderr, "%s is not a directory\n", dir_name);
-        return NULL;
-      }
-! /* Fuchsia: remove when ftw has been implemented.  */
-! #if defined(HAVE_FTW_H) && !defined(__Fuchsia__)
-    ftw (".", ftw_read_file, 50);
-  #endif
-    ret = chdir (pwd);
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libiberty/lrealpath.c gcc-6.2.0/libiberty/lrealpath.c
-*** gcc-6.2.0-fsf/libiberty/lrealpath.c	2016-12-20 14:00:06.758830644 -0800
---- gcc-6.2.0/libiberty/lrealpath.c	2017-01-10 15:01:19.863671770 -0800
-*************** components will be simplified.  The retu
-*** 56,62 ****
-  extern char *canonicalize_file_name (const char *);
-  #endif
-  
-! #if defined(HAVE_REALPATH)
-  # if defined (PATH_MAX)
-  #  define REALPATH_LIMIT PATH_MAX
-  # else
---- 56,63 ----
-  extern char *canonicalize_file_name (const char *);
-  #endif
-  
-! /* Fuchsia: remove when realpath has been implemented.  */
-! #if !defined(__Fuchsia__) && defined(HAVE_REALPATH)
-  # if defined (PATH_MAX)
-  #  define REALPATH_LIMIT PATH_MAX
-  # else
-*************** lrealpath (const char *filename)
-*** 109,115 ****
-       pathconf()) making it impossible to pass a correctly sized buffer
-       to realpath() (it could always overflow).  On those systems, we
-       skip this.  */
-! #if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H)
-    {
-      /* Find out the max path size.  */
-      long path_max = pathconf ("/", _PC_PATH_MAX);
---- 110,118 ----
-       pathconf()) making it impossible to pass a correctly sized buffer
-       to realpath() (it could always overflow).  On those systems, we
-       skip this.  */
-! /* Fuchsia: remove from conditional when realpath has been implemented.  */
-! #if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) \
-!     && !defined (__Fuchsia__)
-    {
-      /* Find out the max path size.  */
-      long path_max = pathconf ("/", _PC_PATH_MAX);
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libiberty/pex-unix.c gcc-6.2.0/libiberty/pex-unix.c
-*** gcc-6.2.0-fsf/libiberty/pex-unix.c	2017-03-02 15:29:41.979495096 -0800
---- gcc-6.2.0/libiberty/pex-unix.c	2017-03-06 08:45:00.518152950 -0800
-*************** extern int errno;
-*** 60,65 ****
---- 60,71 ----
-  #include <process.h>
-  #endif
-  
-+ #ifdef __Fuchsia__
-+ #include <launchpad/launchpad.h>
-+ #include <magenta/syscalls.h>
-+ #include <magenta/syscalls/object.h>
-+ #endif
-+ 
-  #ifdef vfork /* Autoconf may define this to fork for us. */
-  # define VFORK_STRING "fork"
-  #else
-*************** to_ptr32 (char **ptr64)
-*** 120,126 ****
-  
-  static pid_t pex_wait (struct pex_obj *, pid_t, int *, struct pex_time *);
-  
-! #ifdef HAVE_WAIT4
-  
-  static pid_t
-  pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
---- 126,162 ----
-  
-  static pid_t pex_wait (struct pex_obj *, pid_t, int *, struct pex_time *);
-  
-! #ifdef __Fuchsia__
-! 
-! static pid_t
-! pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
-! 	  struct pex_time *time ATTRIBUTE_UNUSED)
-! {
-!   mx_status_t wait_result, procinfo_result;
-!   mx_info_process_t proc_info;
-! 
-!   /* We don't support waiting on multiple pids.  */
-!   if (pid <= 0)
-!     return -1;
-! 
-!   wait_result = mx_object_wait_one ((mx_handle_t) pid, MX_TASK_TERMINATED,
-! 				    MX_TIME_INFINITE, NULL);
-! 
-!   if (wait_result != NO_ERROR)
-!     return -1;
-! 
-!   procinfo_result = mx_object_get_info ((mx_handle_t) pid, MX_INFO_PROCESS,
-! 					&proc_info, sizeof (proc_info), NULL,
-! 					NULL);
-! 
-!   if (procinfo_result != NO_ERROR)
-!     return -1;
-! 
-!   *status = (proc_info.return_code & 0xff) << 8;
-!   return pid;
-! }
-! 
-! #elif defined(HAVE_WAIT4)
-  
-  static pid_t
-  pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
-*************** pex_child_error (struct pex_obj *obj, co
-*** 391,397 ****
-  
-  /* Execute a child.  */
-  
-! #if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE)
-  /* Implementation of pex->exec_child using the Cygwin spawn operation.  */
-  
-  /* Subroutine of pex_unix_exec_child.  Move OLD_FD to a new file descriptor
---- 427,433 ----
-  
-  /* Execute a child.  */
-  
-! #if defined(__Fuchsia__) || (defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE))
-  /* Implementation of pex->exec_child using the Cygwin spawn operation.  */
-  
-  /* Subroutine of pex_unix_exec_child.  Move OLD_FD to a new file descriptor
-*************** static pid_t
-*** 492,498 ****
-  pex_unix_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED,
-  		     int flags, const char *executable,
-  		     char * const * argv, char * const * env,
-!                      int in, int out, int errdes, int toclose,
-  		     const char **errmsg, int *err)
-  {
-    int fl_in = 0, fl_out = 0, fl_err = 0, fl_tc = 0;
---- 528,534 ----
-  pex_unix_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED,
-  		     int flags, const char *executable,
-  		     char * const * argv, char * const * env,
-! 		     int in, int out, int errdes, int toclose,
-  		     const char **errmsg, int *err)
-  {
-    int fl_in = 0, fl_out = 0, fl_err = 0, fl_tc = 0;
-*************** pex_unix_exec_child (struct pex_obj *obj
-*** 547,552 ****
---- 583,612 ----
-      {
-        typedef const char * const *cc_cp;
-  
-+ #ifdef __Fuchsia__
-+       {
-+ 	int argc;
-+ 
-+ 	/* Count the number of arguments.  */
-+ 	for (argc = 0; argv[argc]; argc++)
-+ 	  ;
-+ 
-+ 	/* TODO: Implement PATH search for PEX_SEARCH option.  */
-+ 	launchpad_t *lp;
-+ 	launchpad_create (MX_HANDLE_INVALID, executable, &lp);
-+ 	launchpad_load_from_file (lp, executable);
-+ 	launchpad_set_args (lp, argc, argv);
-+ 	launchpad_clone (lp, LP_CLONE_ALL);
-+ 	mx_handle_t handle;
-+ 	mx_status_t status = launchpad_go (lp, &handle, errmsg);
-+ 	if (status == NO_ERROR) {
-+ 	  pid = (pid_t) handle;
-+ 	  break;
-+ 	}
-+ 	*err = status;
-+ 	return (pid_t) -1;
-+       }
-+ #else
-        if (flags & PEX_SEARCH)
-  	pid = spawnvpe (_P_NOWAITO, executable, (cc_cp)argv, (cc_cp)env);
-        else
-*************** pex_unix_exec_child (struct pex_obj *obj
-*** 560,565 ****
---- 620,626 ----
-        if (errno != EAGAIN || ++retries == 4)
-  	return (pid_t) -1;
-        sleep (1 << retries);
-+ #endif
-      }
-  
-    /* Success.  Restore the parent's file descriptors that we saved above.  */
-*************** pex_unix_exec_child (struct pex_obj *obj
-*** 590,596 ****
-  static pid_t
-  pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
-  		     char * const * argv, char * const * env,
-!                      int in, int out, int errdes,
-  		     int toclose, const char **errmsg, int *err)
-  {
-    pid_t pid;
---- 651,657 ----
-  static pid_t
-  pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
-  		     char * const * argv, char * const * env,
-! 		     int in, int out, int errdes,
-  		     int toclose, const char **errmsg, int *err)
-  {
-    pid_t pid;
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libiberty/stack-limit.c gcc-6.2.0/libiberty/stack-limit.c
-*** gcc-6.2.0-fsf/libiberty/stack-limit.c	2016-12-20 14:00:06.730830744 -0800
---- gcc-6.2.0/libiberty/stack-limit.c	2017-01-10 14:58:25.856453718 -0800
-*************** Attempt to increase stack size limit to
-*** 46,53 ****
-  void
-  stack_limit_increase (unsigned long pref ATTRIBUTE_UNUSED)
-  {
-  #if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \
-!     && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
-    struct rlimit rlim;
-    if (getrlimit (RLIMIT_STACK, &rlim) == 0
-        && rlim.rlim_cur != RLIM_INFINITY
---- 46,55 ----
-  void
-  stack_limit_increase (unsigned long pref ATTRIBUTE_UNUSED)
-  {
-+ /* Fuchsia: remove when getrlimit/setrlimit have been implemented.  */
-  #if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \
-!     && defined(RLIMIT_STACK) && defined(RLIM_INFINITY) \
-!     && !defined(__Fuchsia__)
-    struct rlimit rlim;
-    if (getrlimit (RLIMIT_STACK, &rlim) == 0
-        && rlim.rlim_cur != RLIM_INFINITY
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libstdc++-v3/configure gcc-6.2.0/libstdc++-v3/configure
-*** gcc-6.2.0-fsf/libstdc++-v3/configure	2016-11-23 09:10:40.968283817 -0800
---- gcc-6.2.0/libstdc++-v3/configure	2016-11-16 08:49:38.447039849 -0800
-*************** if test -z "$aix_libpath"; then aix_libp
-*** 9825,9830 ****
---- 9825,9837 ----
-        hardcode_shlibpath_var=no
-        ;;
-  
-+     fuchsia*)
-+       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-+       hardcode_libdir_flag_spec='-R$libdir'
-+       hardcode_direct=yes
-+       hardcode_shlibpath_var=no
-+       ;;
-+ 
-      hpux9*)
-        if test "$GCC" = yes; then
-  	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-*************** freebsd* | dragonfly*)
-*** 10763,10768 ****
---- 10770,10781 ----
-    esac
-    ;;
-  
-+ fuchsia*)
-+   library_names_spec='${libname}${shared_ext}'
-+   need_lib_prefix=no
-+   need_version=no
-+   ;;
-+ 
-  gnu*)
-    version_type=linux
-    need_lib_prefix=no
-*************** fi
-*** 11372,11377 ****
---- 11385,11395 ----
-  
-      ;;
-  
-+   fuchsia*)
-+     lt_cv_dlopen="dlopen"
-+     lt_cv_dlopen_libs=
-+     ;;
-+ 
-    *)
-      ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-  if test "x$ac_cv_func_shl_load" = x""yes; then :
-*************** else
-*** 11596,11602 ****
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 11599 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
---- 11614,11620 ----
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 11617 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
-*************** else
-*** 11702,11708 ****
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 11705 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
---- 11720,11726 ----
-    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-    lt_status=$lt_dlunknown
-    cat > conftest.$ac_ext <<_LT_EOF
-! #line 11723 "configure"
-  #include "confdefs.h"
-  
-  #if HAVE_DLFCN_H
-*************** freebsd* | dragonfly*)
-*** 14447,14452 ****
---- 14465,14476 ----
-    esac
-    ;;
-  
-+ fuchsia*)
-+   library_names_spec='${libname}${shared_ext}'
-+   need_lib_prefix=no
-+   need_version=no
-+   ;;
-+ 
-  gnu*)
-    version_type=linux
-    need_lib_prefix=no
-*************** $as_echo "$glibcxx_cv_atomic_long_long"
-*** 15388,15394 ****
-    # Fake what AC_TRY_COMPILE does.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15391 "configure"
-  int main()
-  {
-    typedef bool atomic_type;
---- 15412,15418 ----
-    # Fake what AC_TRY_COMPILE does.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15415 "configure"
-  int main()
-  {
-    typedef bool atomic_type;
-*************** $as_echo "$glibcxx_cv_atomic_bool" >&6;
-*** 15423,15429 ****
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15426 "configure"
-  int main()
-  {
-    typedef short atomic_type;
---- 15447,15453 ----
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15450 "configure"
-  int main()
-  {
-    typedef short atomic_type;
-*************** $as_echo "$glibcxx_cv_atomic_short" >&6;
-*** 15458,15464 ****
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15461 "configure"
-  int main()
-  {
-    // NB: _Atomic_word not necessarily int.
---- 15482,15488 ----
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15485 "configure"
-  int main()
-  {
-    // NB: _Atomic_word not necessarily int.
-*************** $as_echo "$glibcxx_cv_atomic_int" >&6; }
-*** 15494,15500 ****
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15497 "configure"
-  int main()
-  {
-    typedef long long atomic_type;
---- 15518,15524 ----
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15521 "configure"
-  int main()
-  {
-    typedef long long atomic_type;
-*************** $as_echo "$as_me: WARNING: Performance o
-*** 15573,15579 ****
-    # unnecessary for this test.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15576 "configure"
-  int main()
-  {
-    _Decimal32 d1;
---- 15597,15603 ----
-    # unnecessary for this test.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15600 "configure"
-  int main()
-  {
-    _Decimal32 d1;
-*************** ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-*** 15615,15621 ****
-    # unnecessary for this test.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15618 "configure"
-  template<typename T1, typename T2>
-    struct same
-    { typedef T2 type; };
---- 15639,15645 ----
-    # unnecessary for this test.
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15642 "configure"
-  template<typename T1, typename T2>
-    struct same
-    { typedef T2 type; };
-*************** $as_echo "$enable_int128" >&6; }
-*** 15649,15655 ****
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15652 "configure"
-  template<typename T1, typename T2>
-    struct same
-    { typedef T2 type; };
---- 15673,15679 ----
-      rm -f conftest*
-  
-      cat > conftest.$ac_ext << EOF
-! #line 15676 "configure"
-  template<typename T1, typename T2>
-    struct same
-    { typedef T2 type; };
-*************** $as_echo "$ac_ld_relro" >&6; }
-*** 53130,53135 ****
---- 53154,53165 ----
-  
-      fi
-      ;;
-+ 
-+   *-fuchsia*)
-+     SECTION_FLAGS='-ffunction-sections -fdata-sections'
-+     SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
-+     ;;
-+ 
-    *-hpux*)
-      SECTION_FLAGS='-ffunction-sections -fdata-sections'
-  
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libstdc++-v3/crossconfig.m4 gcc-6.2.0/libstdc++-v3/crossconfig.m4
-*** gcc-6.2.0-fsf/libstdc++-v3/crossconfig.m4	2016-11-23 09:10:41.352282308 -0800
---- gcc-6.2.0/libstdc++-v3/crossconfig.m4	2016-11-16 08:49:38.451039834 -0800
-*************** case "${host}" in
-*** 107,112 ****
---- 107,118 ----
-        AC_DEFINE(HAVE_ISNANL)
-      fi
-      ;;
-+ 
-+   *-fuchsia*)
-+     SECTION_FLAGS='-ffunction-sections -fdata-sections'
-+     SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
-+     ;;
-+ 
-    *-hpux*)
-      SECTION_FLAGS='-ffunction-sections -fdata-sections'
-      AC_SUBST(SECTION_FLAGS)
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/libtool.m4 gcc-6.2.0/libtool.m4
-*** gcc-6.2.0-fsf/libtool.m4	2016-11-23 09:11:07.960177729 -0800
---- gcc-6.2.0/libtool.m4	2016-12-09 14:52:40.904402887 -0800
-*************** else
-*** 1748,1753 ****
---- 1748,1758 ----
-      ])
-      ;;
-  
-+   fuchsia*)
-+     lt_cv_dlopen="dlopen"
-+     lt_cv_dlopen_libs=
-+     ;;
-+ 
-    *)
-      AC_CHECK_FUNC([shl_load],
-  	  [lt_cv_dlopen="shl_load"],
-*************** freebsd* | dragonfly*)
-*** 2323,2328 ****
---- 2328,2342 ----
-    esac
-    ;;
-  
-+ fuchsia*)
-+   need_lib_prefix=no
-+   need_version=no
-+   dynamic_linker="$host_os ld.so.1"
-+   library_names_spec='$libname$shared_ext'
-+   soname_spec='$libname$shared_ext'
-+   sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
-+   ;;
-+ 
-  gnu*)
-    version_type=linux
-    need_lib_prefix=no
-*************** freebsd* | dragonfly*)
-*** 3047,3052 ****
---- 3061,3070 ----
-    fi
-    ;;
-  
-+ fuchsia*)
-+   lt_cv_deplibs_check_method=pass_all
-+   ;;
-+ 
-  gnu*)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-*************** m4_if([$1], [CXX], [
-*** 3604,3610 ****
-        esac
-        ;;
-  
-!     beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-        # PIC is the default for these OSes.
-        ;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
---- 3622,3628 ----
-        esac
-        ;;
-  
-!     beos* | fuchsia* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-        # PIC is the default for these OSes.
-        ;;
-      mingw* | cygwin* | os2* | pw32* | cegcc*)
-*************** m4_if([$1], [CXX], [
-*** 3694,3699 ****
---- 3712,3722 ----
-        freebsd* | dragonfly*)
-  	# FreeBSD uses GNU C++
-  	;;
-+       fuchsia* )
-+ 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-+ 	_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-+ 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
-+ 	;;
-        hpux9* | hpux10* | hpux11*)
-  	case $cc_basename in
-  	  CC*)
-diff -rdcp --unidirectional-new-file gcc-6.2.0-fsf/Makefile.in gcc-6.2.0/Makefile.in
-*** gcc-6.2.0-fsf/Makefile.in	2016-11-23 09:11:07.960177729 -0800
---- gcc-6.2.0/Makefile.in	2016-12-08 13:11:05.048744794 -0800
-*************** BASE_TARGET_EXPORTS = \
-*** 287,292 ****
---- 287,293 ----
-  	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
-  	LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
-  	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
-+ 	NO_PIE_CFLAGS="$(NO_PIE_CFLAGS_FOR_TARGET)"; export NO_PIE_CFLAGS; \
-  	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
-  	OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
-  	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
-*************** EXTRA_TARGET_FLAGS = \
-*** 869,874 ****
---- 870,876 ----
-  	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
-  	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
-  	'NM=$(COMPILER_NM_FOR_TARGET)' \
-+ 	'NO_PIE_CFLAGS=$(NO_PIE_CFLAGS_FOR_TARGET)' \
-  	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
-  	'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
-  	'RANLIB=$$(RANLIB_FOR_TARGET)' \
+     /* Find out the max path size.  */
+     long path_max = pathconf ("/", _PC_PATH_MAX);
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libiberty/pex-unix.c gcc-6.3.0/libiberty/pex-unix.c
+--- gcc-6.3.0-fsf/libiberty/pex-unix.c	2017-03-30 16:18:18.993239143 -0700
++++ gcc-6.3.0/libiberty/pex-unix.c	2017-03-30 16:23:21.728074093 -0700
+@@ -60,6 +60,12 @@ extern int errno;
+ #include <process.h>
+ #endif
+ 
++#ifdef __Fuchsia__
++#include <launchpad/launchpad.h>
++#include <magenta/syscalls.h>
++#include <magenta/syscalls/object.h>
++#endif
++
+ #ifdef vfork /* Autoconf may define this to fork for us. */
+ # define VFORK_STRING "fork"
+ #else
+@@ -120,7 +126,37 @@ to_ptr32 (char **ptr64)
+ 
+ static pid_t pex_wait (struct pex_obj *, pid_t, int *, struct pex_time *);
+ 
+-#ifdef HAVE_WAIT4
++#ifdef __Fuchsia__
++
++static pid_t
++pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
++	  struct pex_time *time ATTRIBUTE_UNUSED)
++{
++  mx_status_t wait_result, procinfo_result;
++  mx_info_process_t proc_info;
++
++  /* We don't support waiting on multiple pids.  */
++  if (pid <= 0)
++    return -1;
++
++  wait_result = mx_object_wait_one ((mx_handle_t) pid, MX_TASK_TERMINATED,
++				    MX_TIME_INFINITE, NULL);
++
++  if (wait_result != NO_ERROR)
++    return -1;
++
++  procinfo_result = mx_object_get_info ((mx_handle_t) pid, MX_INFO_PROCESS,
++					&proc_info, sizeof (proc_info), NULL,
++					NULL);
++
++  if (procinfo_result != NO_ERROR)
++    return -1;
++
++  *status = (proc_info.return_code & 0xff) << 8;
++  return pid;
++}
++
++#elif defined(HAVE_WAIT4)
+ 
+ static pid_t
+ pex_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status,
+@@ -391,7 +427,7 @@ pex_child_error (struct pex_obj *obj, co
+ 
+ /* Execute a child.  */
+ 
+-#if defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE)
++#if defined(__Fuchsia__) || (defined(HAVE_SPAWNVE) && defined(HAVE_SPAWNVPE))
+ /* Implementation of pex->exec_child using the Cygwin spawn operation.  */
+ 
+ /* Subroutine of pex_unix_exec_child.  Move OLD_FD to a new file descriptor
+@@ -492,7 +528,7 @@ static pid_t
+ pex_unix_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED,
+ 		     int flags, const char *executable,
+ 		     char * const * argv, char * const * env,
+-                     int in, int out, int errdes, int toclose,
++		     int in, int out, int errdes, int toclose,
+ 		     const char **errmsg, int *err)
+ {
+   int fl_in = 0, fl_out = 0, fl_err = 0, fl_tc = 0;
+@@ -547,6 +583,30 @@ pex_unix_exec_child (struct pex_obj *obj
+     {
+       typedef const char * const *cc_cp;
+ 
++#ifdef __Fuchsia__
++      {
++	int argc;
++
++	/* Count the number of arguments.  */
++	for (argc = 0; argv[argc]; argc++)
++	  ;
++
++	/* TODO: Implement PATH search for PEX_SEARCH option.  */
++	launchpad_t *lp;
++	launchpad_create (MX_HANDLE_INVALID, executable, &lp);
++	launchpad_load_from_file (lp, executable);
++	launchpad_set_args (lp, argc, argv);
++	launchpad_clone (lp, LP_CLONE_ALL);
++	mx_handle_t handle;
++	mx_status_t status = launchpad_go (lp, &handle, errmsg);
++	if (status == NO_ERROR) {
++	  pid = (pid_t) handle;
++	  break;
++	}
++	*err = status;
++	return (pid_t) -1;
++      }
++#else
+       if (flags & PEX_SEARCH)
+ 	pid = spawnvpe (_P_NOWAITO, executable, (cc_cp)argv, (cc_cp)env);
+       else
+@@ -560,6 +620,7 @@ pex_unix_exec_child (struct pex_obj *obj
+       if (errno != EAGAIN || ++retries == 4)
+ 	return (pid_t) -1;
+       sleep (1 << retries);
++#endif
+     }
+ 
+   /* Success.  Restore the parent's file descriptors that we saved above.  */
+@@ -590,7 +651,7 @@ pex_unix_exec_child (struct pex_obj *obj
+ static pid_t
+ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
+ 		     char * const * argv, char * const * env,
+-                     int in, int out, int errdes,
++		     int in, int out, int errdes,
+ 		     int toclose, const char **errmsg, int *err)
+ {
+   pid_t pid;
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libiberty/stack-limit.c gcc-6.3.0/libiberty/stack-limit.c
+--- gcc-6.3.0-fsf/libiberty/stack-limit.c	2017-03-30 16:18:18.993239143 -0700
++++ gcc-6.3.0/libiberty/stack-limit.c	2017-03-30 16:23:21.728074093 -0700
+@@ -46,8 +46,10 @@ Attempt to increase stack size limit to
+ void
+ stack_limit_increase (unsigned long pref ATTRIBUTE_UNUSED)
+ {
++/* Fuchsia: remove when getrlimit/setrlimit have been implemented.  */
+ #if defined(HAVE_SETRLIMIT) && defined(HAVE_GETRLIMIT) \
+-    && defined(RLIMIT_STACK) && defined(RLIM_INFINITY)
++    && defined(RLIMIT_STACK) && defined(RLIM_INFINITY) \
++    && !defined(__Fuchsia__)
+   struct rlimit rlim;
+   if (getrlimit (RLIMIT_STACK, &rlim) == 0
+       && rlim.rlim_cur != RLIM_INFINITY
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libstdc++-v3/configure gcc-6.3.0/libstdc++-v3/configure
+--- gcc-6.3.0-fsf/libstdc++-v3/configure	2017-03-30 16:18:16.689247989 -0700
++++ gcc-6.3.0/libstdc++-v3/configure	2017-03-31 06:42:34.802733803 -0700
+@@ -6360,6 +6360,10 @@ freebsd* | dragonfly*)
+   fi
+   ;;
+ 
++fuchsia*)
++  lt_cv_deplibs_check_method=pass_all
++  ;;
++
+ gnu*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -10763,6 +10767,15 @@ freebsd* | dragonfly*)
+   esac
+   ;;
+ 
++fuchsia*)
++  need_lib_prefix=no
++  need_version=no
++  dynamic_linker="$host_os ld.so.1"
++  library_names_spec='$libname$shared_ext'
++  soname_spec='$libname$shared_ext'
++  sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
++  ;;
++
+ gnu*)
+   version_type=linux
+   need_lib_prefix=no
+@@ -11372,6 +11385,11 @@ fi
+ 
+     ;;
+ 
++  fuchsia*)
++    lt_cv_dlopen="dlopen"
++    lt_cv_dlopen_libs=
++    ;;
++
+   *)
+     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+ if test "x$ac_cv_func_shl_load" = x""yes; then :
+@@ -11596,7 +11614,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11599 "configure"
++#line 11617 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -11702,7 +11720,7 @@ else
+   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+   lt_status=$lt_dlunknown
+   cat > conftest.$ac_ext <<_LT_EOF
+-#line 11705 "configure"
++#line 11723 "configure"
+ #include "confdefs.h"
+ 
+ #if HAVE_DLFCN_H
+@@ -13612,6 +13630,10 @@ $as_echo_n "checking for $compiler optio
+       freebsd* | dragonfly*)
+ 	# FreeBSD uses GNU C++
+ 	;;
++      fuchsia* )
++	lt_prog_compiler_wl_CXX='-Wl,'
++	lt_prog_compiler_static_CXX='-static'
++	;;
+       hpux9* | hpux10* | hpux11*)
+ 	case $cc_basename in
+ 	  CC*)
+@@ -14447,6 +14469,15 @@ freebsd* | dragonfly*)
+   esac
+   ;;
+ 
++fuchsia*)
++  need_lib_prefix=no
++  need_version=no
++  dynamic_linker="$host_os ld.so.1"
++  library_names_spec='$libname$shared_ext'
++  soname_spec='$libname$shared_ext'
++  sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
++  ;;
++
+ gnu*)
+   version_type=linux
+   need_lib_prefix=no
+@@ -15388,7 +15419,7 @@ $as_echo "$glibcxx_cv_atomic_long_long"
+   # Fake what AC_TRY_COMPILE does.
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15391 "configure"
++#line 15422 "configure"
+ int main()
+ {
+   typedef bool atomic_type;
+@@ -15423,7 +15454,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6;
+     rm -f conftest*
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15426 "configure"
++#line 15457 "configure"
+ int main()
+ {
+   typedef short atomic_type;
+@@ -15458,7 +15489,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6;
+     rm -f conftest*
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15461 "configure"
++#line 15492 "configure"
+ int main()
+ {
+   // NB: _Atomic_word not necessarily int.
+@@ -15494,7 +15525,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
+     rm -f conftest*
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15497 "configure"
++#line 15528 "configure"
+ int main()
+ {
+   typedef long long atomic_type;
+@@ -15575,7 +15606,7 @@ $as_echo "$as_me: WARNING: Performance o
+   # unnecessary for this test.
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15578 "configure"
++#line 15609 "configure"
+ int main()
+ {
+   _Decimal32 d1;
+@@ -15617,7 +15648,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+   # unnecessary for this test.
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15620 "configure"
++#line 15651 "configure"
+ template<typename T1, typename T2>
+   struct same
+   { typedef T2 type; };
+@@ -15651,7 +15682,7 @@ $as_echo "$enable_int128" >&6; }
+     rm -f conftest*
+ 
+     cat > conftest.$ac_ext << EOF
+-#line 15654 "configure"
++#line 15685 "configure"
+ template<typename T1, typename T2>
+   struct same
+   { typedef T2 type; };
+@@ -53199,6 +53230,12 @@ $as_echo "$ac_ld_relro" >&6; }
+ 
+     fi
+     ;;
++
++  *-fuchsia*)
++    SECTION_FLAGS='-ffunction-sections -fdata-sections'
++    SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
++    ;;
++
+   *-hpux*)
+     SECTION_FLAGS='-ffunction-sections -fdata-sections'
+ 
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libstdc++-v3/crossconfig.m4 gcc-6.3.0/libstdc++-v3/crossconfig.m4
+--- gcc-6.3.0-fsf/libstdc++-v3/crossconfig.m4	2017-03-30 16:18:16.741247790 -0700
++++ gcc-6.3.0/libstdc++-v3/crossconfig.m4	2017-03-30 16:23:21.744074031 -0700
+@@ -107,6 +107,12 @@ case "${host}" in
+       AC_DEFINE(HAVE_ISNANL)
+     fi
+     ;;
++
++  *-fuchsia*)
++    SECTION_FLAGS='-ffunction-sections -fdata-sections'
++    SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
++    ;;
++
+   *-hpux*)
+     SECTION_FLAGS='-ffunction-sections -fdata-sections'
+     AC_SUBST(SECTION_FLAGS)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/libtool.m4 gcc-6.3.0/libtool.m4
+--- gcc-6.3.0-fsf/libtool.m4	2017-03-30 16:18:19.009239082 -0700
++++ gcc-6.3.0/libtool.m4	2017-03-31 06:41:11.187017373 -0700
+@@ -1748,6 +1748,11 @@ else
+     ])
+     ;;
+ 
++  fuchsia*)
++    lt_cv_dlopen="dlopen"
++    lt_cv_dlopen_libs=
++    ;;
++
+   *)
+     AC_CHECK_FUNC([shl_load],
+ 	  [lt_cv_dlopen="shl_load"],
+@@ -2323,6 +2328,15 @@ freebsd* | dragonfly*)
+   esac
+   ;;
+ 
++fuchsia*)
++  need_lib_prefix=no
++  need_version=no
++  dynamic_linker="$host_os ld.so.1"
++  library_names_spec='$libname$shared_ext'
++  soname_spec='$libname$shared_ext'
++  sys_lib_dlsearch_path_spec='/system/lib /boot/lib'
++  ;;
++
+ gnu*)
+   version_type=linux
+   need_lib_prefix=no
+@@ -3047,6 +3061,10 @@ freebsd* | dragonfly*)
+   fi
+   ;;
+ 
++fuchsia*)
++  lt_cv_deplibs_check_method=pass_all
++  ;;
++
+ gnu*)
+   lt_cv_deplibs_check_method=pass_all
+   ;;
+@@ -3694,6 +3712,10 @@ m4_if([$1], [CXX], [
+       freebsd* | dragonfly*)
+ 	# FreeBSD uses GNU C++
+ 	;;
++      fuchsia* )
++	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
++	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
++	;;
+       hpux9* | hpux10* | hpux11*)
+ 	case $cc_basename in
+ 	  CC*)
+diff -rdup --unidirectional-new-file gcc-6.3.0-fsf/Makefile.in gcc-6.3.0/Makefile.in
+--- gcc-6.3.0-fsf/Makefile.in	2017-03-30 16:18:19.009239082 -0700
++++ gcc-6.3.0/Makefile.in	2017-03-30 16:23:21.752074000 -0700
+@@ -287,6 +287,7 @@ BASE_TARGET_EXPORTS = \
+ 	LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
+ 	LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
+ 	NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
++	NO_PIE_CFLAGS="$(NO_PIE_CFLAGS_FOR_TARGET)"; export NO_PIE_CFLAGS; \
+ 	OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
+ 	OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
+ 	RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
+@@ -869,6 +870,7 @@ EXTRA_TARGET_FLAGS = \
+ 	'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
+ 	'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
+ 	'NM=$(COMPILER_NM_FOR_TARGET)' \
++	'NO_PIE_CFLAGS=$(NO_PIE_CFLAGS_FOR_TARGET)' \
+ 	'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \
+ 	'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
+ 	'RANLIB=$$(RANLIB_FOR_TARGET)' \
diff --git a/toolvers b/toolvers
index e491d52..bc9e236 100644
--- a/toolvers
+++ b/toolvers
@@ -1,12 +1,12 @@
 # Rerun updatetoolvers after modifying this file
-GCC_VER=6.2.0
+GCC_VER=6.3.0
 BINUTILS_VER=2.27
 GDB_VER=7.10.1
 GMP_VER=5.1.3
 MPC_VER=1.0.3
 MPFR_VER=3.1.3
 # Below is autogenerated by updatetoolvers
-GCC_HASH=9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5
+GCC_HASH=f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f
 BINUTILS_HASH=369737ce51587f92466041a97ab7d2358c6d9e1b6490b3940eb09fb0a9a6ac88
 GDB_HASH=25c72f3d41c7c8554d61cacbeacd5f40993276d2ccdec43279ac546e3993d6d5
 GMP_HASH=752079520b4690531171d0f4532e40f08600215feefede70b24fabdc6f1ab160