From: Richard W.M. Jones Date: Wed, 10 Aug 2016 20:51:16 +0000 (+0100) Subject: Various hacks to get GCC to compile. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=106748c4b14415206f5d81d78d0a2529b1b2edac;p=fedora-riscv.git Various hacks to get GCC to compile. Don't pass CC etc variables down to libgcc directory, since that stops it from being cross-compiled. sys/sdt.h (part of systemtap) is not available, so comment it out. --- diff --git a/0001-HACKS-TO-GET-GCC-TO-COMPILE.patch b/0001-HACKS-TO-GET-GCC-TO-COMPILE.patch new file mode 100644 index 0000000..60addba --- /dev/null +++ b/0001-HACKS-TO-GET-GCC-TO-COMPILE.patch @@ -0,0 +1,81 @@ +From 24fdf86d8b3839e261760db7603168abc337ff1b Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +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 +-#endif ++//#ifdef HAVE_SYS_SDT_H ++//#include ++//#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 + diff --git a/Makefile b/Makefile index fd5968a..1388e75 100644 --- a/Makefile +++ b/Makefile @@ -490,6 +490,8 @@ mpc-$(MPC_VERSION).tar.gz: 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 \ @@ -504,10 +506,8 @@ stage3-chroot/usr/bin/gcc: gcc-$(GCC_X_VERSION).tar.gz --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 diff --git a/init.sh b/init.sh index 4a105fc..eac9bd9 100755 --- a/init.sh +++ b/init.sh @@ -21,6 +21,17 @@ date `date -r /usr/bin +%m%d%H%M%Y` hostname stage3 echo stage3.fedoraproject.org > /etc/hostname +# Set up the PATH. The GCC path is a hack because I wasn't able to +# find the right flags for configuring GCC. +PATH=/usr/libexec/gcc/riscv64-unknown-linux-gnu/6.1.0:\ +/usr/local/bin:\ +/usr/local/sbin:\ +/usr/bin:\ +/usr/sbin:\ +/bin:\ +/sbin +export PATH + echo echo "Welcome to the Fedora/RISC-V stage3 disk image" echo "https://fedoraproject.org/wiki/Architectures/RISC-V"