--- /dev/null
+From 24fdf86d8b3839e261760db7603168abc337ff1b Mon Sep 17 00:00:00 2001
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Wed, 10 Aug 2016 21:50:34 +0100
+Subject: [PATCH] HACKS TO GET GCC TO COMPILE
+
+---
+ Makefile.in | 8 +++-----
+ libgcc/unwind-dw2.c | 14 +++++++-------
+ 2 files changed, 10 insertions(+), 12 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 1522e39..d328543 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -38500,7 +38500,7 @@ configure-target-libgcc: stage_current
+ @if target-libgcc
+ maybe-configure-target-libgcc: configure-target-libgcc
+ configure-target-libgcc:
+- @r=`${PWD_COMMAND}`; export r; \
++ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+ echo "Checking multilib configuration for libgcc..."; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcc; \
+@@ -38517,7 +38517,6 @@ configure-target-libgcc:
+ fi; \
+ test ! -f $(TARGET_SUBDIR)/libgcc/Makefile || exit 0; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgcc; \
+- $(NORMAL_TARGET_EXPORTS) \
+ echo Configuring in $(TARGET_SUBDIR)/libgcc; \
+ cd "$(TARGET_SUBDIR)/libgcc" || exit 1; \
+ case $(srcdir) in \
+@@ -38819,11 +38818,10 @@ all-target-libgcc: stage_current
+ TARGET-target-libgcc=all
+ maybe-all-target-libgcc: all-target-libgcc
+ all-target-libgcc: configure-target-libgcc
+- @r=`${PWD_COMMAND}`; export r; \
++ r=`${PWD_COMMAND}`; export r; \
+ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+- $(NORMAL_TARGET_EXPORTS) \
+ (cd $(TARGET_SUBDIR)/libgcc && \
+- $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \
++ $(MAKE) \
+ $(TARGET-target-libgcc))
+ @endif target-libgcc
+
+diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c
+index 1fb6026..4e6213c 100644
+--- a/libgcc/unwind-dw2.c
++++ b/libgcc/unwind-dw2.c
+@@ -37,9 +37,9 @@
+ #include "gthr.h"
+ #include "unwind-dw2.h"
+
+-#ifdef HAVE_SYS_SDT_H
+-#include <sys/sdt.h>
+-#endif
++//#ifdef HAVE_SYS_SDT_H
++//#include <sys/sdt.h>
++//#endif
+
+ #ifndef __USING_SJLJ_EXCEPTIONS__
+
+@@ -1601,11 +1601,11 @@ _Unwind_DebugHook (void *cfa __attribute__ ((__unused__)),
+ {
+ /* We only want to use stap probes starting with v3. Earlier
+ versions added too much startup cost. */
+-#if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
+- STAP_PROBE2 (libgcc, unwind, cfa, handler);
+-#else
++//#if defined (HAVE_SYS_SDT_H) && defined (STAP_PROBE2) && _SDT_NOTE_TYPE >= 3
++// STAP_PROBE2 (libgcc, unwind, cfa, handler);
++//#else
+ asm ("");
+-#endif
++//#endif
+ }
+
+ /* Install TARGET into CURRENT so that we can return to it. This is a
+--
+2.7.4
+
stage3-chroot/usr/bin/gcc: gcc-$(GCC_X_VERSION).tar.gz
rm -rf riscv-gcc-riscv-gcc-$(GCC_X_VERSION)
zcat $^ | tar xf -
+ cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION) && \
+ patch -p1 < ../0001-HACKS-TO-GET-GCC-TO-COMPILE.patch
mkdir riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build
cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && \
PATH=$(ROOT)/fixed-gcc:$$PATH \
--disable-libquadmath \
--disable-nls \
--disable-multilib
-# XXX use make all & make install here. However building libgcc
-# fails, see 'broken-gcc.log'.
- cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make all-gcc
- cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && make install-gcc DESTDIR=$(ROOT)/stage3-chroot
+ cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && PATH=$(ROOT)/fixed-gcc:$$PATH make
+ cd riscv-gcc-riscv-gcc-$(GCC_X_VERSION)/build && make install DESTDIR=$(ROOT)/stage3-chroot
gcc-$(GCC_X_VERSION).tar.gz:
rm -f $@ $@-t