Merge "Use __Fuchsia__ definition instead of __fuchsia__"
diff --git a/patches/gcc-patch.txt b/patches/gcc-patch.txt
index 262c0ff..c8604a9 100644
--- a/patches/gcc-patch.txt
+++ b/patches/gcc-patch.txt
@@ -828,6 +828,45 @@
   #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
@@ -1037,6 +1076,45 @@
   	;;
   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