  ifdef WITHOUT_CHECK
    with_check := disabled by environment
  endif
+diff -Nur ../gcc-5-5.4.1.orig/debian/rules.patch ./debian/rules.patch
+--- ../gcc-5-5.4.1.orig/debian/rules.patch	2017-08-09 00:26:09.000000000 +0000
++++ ./debian/rules.patch	2017-08-09 00:24:35.795274920 +0000
+@@ -113,6 +113,7 @@
+ 	libjava-mips64el \
+ 	libffi-pax \
+ 	libffi-race-condition \
++	unwind_dw2_fde_nolock \
+ 
+ # this is still needed on powerpc, e.g. firefox and insighttoolkit4 will ftbfs.
+ ifneq (,$(filter $(DEB_TARGET_ARCH),powerpc))

 ifneq ($(DEB_CROSS),yes)
 # all archs for which to create b-d's
 any_archs = alpha amd64 armel armhf arm64 i386 mips mipsel mips64 mips64el powerpc ppc64 ppc64el m68k sh4 sparc64 s390x x32
--- debian/rules.defs	2017-02-24 19:02:52.000000000 +0000
+++ /home/syuu/gcc-5.5/gcc-5-5.4.1/debian/rules.defs	2017-02-24 18:13:59.000000000 +0000
@@ -412,7 +412,7 @@
 # gcc versions (fixincludes, libgcj-common) ...
 #with_common_pkgs := yes

diff -Nur ../gcc-5-5.4.1.orig/debian/patches/unwind_dw2_fde_nolock.diff ./debian/patches/unwind_dw2_fde_nolock.diff
--- ../gcc-5-5.4.1.orig/debian/patches/unwind_dw2_fde_nolock.diff	1970-01-01 00:00:00.000000000 +0000
+++ ./debian/patches/unwind_dw2_fde_nolock.diff	2017-08-09 00:23:51.095939513 +0000
@@ -0,0 +1,95 @@
+commit 2e452daf02a37ec310b2431375ceca569d0d6284
+Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date:   Fri Sep 16 19:17:47 2016 +0000
+
+            PR libgcc/71744
+            * unwind-dw2-fde.c (ATOMIC_FDE_FAST_PATH): Define if __register_frame*
+            is not the primary registry and atomics are available.
+            (any_objects_registered): New variable.
+            (__register_frame_info_bases, __register_frame_info_table_bases):
+            Atomically store 1 to any_objects_registered after registering first
+            unwind info.
+            (_Unwind_Find_FDE): Return early if any_objects_registered is 0.
+    
+    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240193 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git a/src/libgcc/unwind-dw2-fde.c b/src/libgcc/unwind-dw2-fde.c
+index 0bcf516..6ae2377 100644
+--- a/src/libgcc/unwind-dw2-fde.c
++++ b/src/libgcc/unwind-dw2-fde.c
+@@ -35,6 +35,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+ #include "unwind-pe.h"
+ #include "unwind-dw2-fde.h"
+ #include "gthr.h"
++#else
++#if (defined(__GTHREAD_MUTEX_INIT) || defined(__GTHREAD_MUTEX_INIT_FUNCTION)) \
++    && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
++#define ATOMIC_FDE_FAST_PATH 1
++#endif
+ #endif
+ 
+ /* The unseen_objects list contains objects that have been registered
+@@ -43,6 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+    by decreasing value of pc_begin.  */
+ static struct object *unseen_objects;
+ static struct object *seen_objects;
++#ifdef ATOMIC_FDE_FAST_PATH
++static int any_objects_registered;
++#endif
+ 
+ #ifdef __GTHREAD_MUTEX_INIT
+ static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
+@@ -96,6 +104,16 @@ __register_frame_info_bases (const void *begin, struct object *ob,
+ 
+   ob->next = unseen_objects;
+   unseen_objects = ob;
++#ifdef ATOMIC_FDE_FAST_PATH
++  /* Set flag that at least one library has registered FDEs.
++     Use relaxed MO here, it is up to the app to ensure that the library
++     loading/initialization happens-before using that library in other
++     threads (in particular unwinding with that library's functions
++     appearing in the backtraces).  Calling that library's functions
++     without waiting for the library to initialize would be racy.  */
++  if (!any_objects_registered)
++    __atomic_store_n (&any_objects_registered, 1, __ATOMIC_RELAXED);
++#endif
+ 
+   __gthread_mutex_unlock (&object_mutex);
+ }
+@@ -140,6 +158,16 @@ __register_frame_info_table_bases (void *begin, struct object *ob,
+ 
+   ob->next = unseen_objects;
+   unseen_objects = ob;
++#ifdef ATOMIC_FDE_FAST_PATH
++  /* Set flag that at least one library has registered FDEs.
++     Use relaxed MO here, it is up to the app to ensure that the library
++     loading/initialization happens-before using that library in other
++     threads (in particular unwinding with that library's functions
++     appearing in the backtraces).  Calling that library's functions
++     without waiting for the library to initialize would be racy.  */
++  if (!any_objects_registered)
++    __atomic_store_n (&any_objects_registered, 1, __ATOMIC_RELAXED);
++#endif
+ 
+   __gthread_mutex_unlock (&object_mutex);
+ }
+@@ -1001,6 +1029,19 @@ _Unwind_Find_FDE (void *pc, struct dwarf_eh_bases *bases)
+   struct object *ob;
+   const fde *f = NULL;
+ 
++#ifdef ATOMIC_FDE_FAST_PATH
++  /* For targets where unwind info is usually not registered through these
++     APIs anymore, avoid taking a global lock.
++     Use relaxed MO here, it is up to the app to ensure that the library
++     loading/initialization happens-before using that library in other
++     threads (in particular unwinding with that library's functions
++     appearing in the backtraces).  Calling that library's functions
++     without waiting for the library to initialize would be racy.  */
++  if (__builtin_expect (!__atomic_load_n (&any_objects_registered,
++					  __ATOMIC_RELAXED), 1))
++    return NULL;
++#endif
++
+   init_object_mutex_once ();
+   __gthread_mutex_lock (&object_mutex);
+ 
diff -Nur ../gcc-5-5.4.1.orig/debian/rules.conf ./debian/rules.conf
--- ../gcc-5-5.4.1.orig/debian/rules.conf	2017-08-09 00:26:09.000000000 +0000
+++ ./debian/rules.conf	2017-08-09 00:26:51.177254418 +0000
@@ -206,7 +206,7 @@
   ifneq (,$(filter $(distrelease),vivid))
     BINUTILSBDV = 2.25-3~
