OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [patches/] [gcc] - Rev 13

Compare with Previous | Blame | View Log

--- original-gcc/config.sub
+++ gcc/config.sub
@@ -340,6 +340,9 @@ case $basic_machine in
        ms1)
                basic_machine=mt-unknown
                ;;
+       riscv)
+               basic_machine=riscv-ucb
+               ;;
 
        strongarm | thumb | xscale)
                basic_machine=arm-unknown
--- original-gcc/gcc/config.gcc
+++ gcc/gcc/config.gcc
@@ -439,6 +439,10 @@ powerpc*-*-*)
        esac
        extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
        ;;
+riscv*)
+       cpu_type=riscv
+       need_64bit_hwint=yes
+       ;;
 rs6000*-*-*)
        extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
        ;;
@@ -1976,6 +1980,34 @@ microblaze*-*-elf)
        cxx_target_objs="${cxx_target_objs} microblaze-c.o"
        tmake_file="${tmake_file} microblaze/t-microblaze"
         ;;
+riscv32*-*-linux*)
+       tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h riscv/default-32.h ${tm_file} riscv/linux.h riscv/linux64.h"
+       tmake_file="${tmake_file} riscv/t-linux64"
+       gnu_ld=yes
+       gas=yes
+       gcc_cv_initfini_array=yes
+       ;;
+riscv*-*-linux*)
+       tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h riscv/linux64.h"
+       tmake_file="${tmake_file} riscv/t-linux64"
+       gnu_ld=yes
+       gas=yes
+       gcc_cv_initfini_array=yes
+       ;;
+riscv32*-*-elf*)
+       tm_file="elfos.h newlib-stdint.h riscv/default-32.h ${tm_file} riscv/elf.h"
+       tmake_file="${tmake_file} riscv/t-elf"
+       gnu_ld=yes
+       gas=yes
+       gcc_cv_initfini_array=yes
+       ;;
+riscv*-*-elf*)
+       tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
+       tmake_file="${tmake_file} riscv/t-elf"
+       gnu_ld=yes
+       gas=yes
+       gcc_cv_initfini_array=yes
+       ;;
 mips*-*-netbsd*)                       # NetBSD/mips, either endian.
        target_cpu_default="MASK_ABICALLS"
        tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
@@ -3860,6 +3892,31 @@ case "${target}" in
                done
                ;;
 
+       riscv*-*-*)
+               supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64"
+
+               case ${with_float} in
+               "" | soft | hard)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown floating point type used in --with-float=$with_float" 1>&2
+                       exit 1
+                       ;;
+               esac
+
+               case ${with_abi} in
+               "" | 32 | 64)
+                       # OK
+                       ;;
+               *)
+                       echo "Unknown ABI used in --with-abi=$with_abi" 1>&2
+                       exit 1
+                       ;;
+               esac
+
+    ;;
+
        mips*-*-*)
                supported_defaults="abi arch arch_32 arch_64 float fpu nan fp_32 odd_spreg_32 tune tune_32 tune_64 divide llsc mips-plt synci"
 
--- original-gcc/gcc/configure
+++ gcc/gcc/configure
@@ -23717,6 +23717,25 @@ x3:    .space 4
        tls_first_minor=14
        tls_as_opt="-a32 --fatal-warnings"
        ;;
+  riscv*-*-*)
+    conftest_s='
+       .section .tdata,"awT",@progbits
+x:
+       .word 2
+       .text
+       la.tls.gd a0,x
+       la.tls.ie a1,x
+       lui a0,%tls_ie_pcrel_hi(x)
+       lw a0,%pcrel_lo(x)(a0)
+       add a0,a0,tp
+       lw a0,0(a0)
+       lui a0,%tprel_hi(x)
+       add a0,a0,tp,%tprel_add(x)
+       lw a0,%tprel_lo(x)(a0)'
+       tls_first_major=2
+       tls_first_minor=21
+       tls_as_opt='-m32 --fatal-warnings'
+       ;;
   s390-*-*)
     conftest_s='
        .section ".tdata","awT",@progbits
--- original-gcc/gcc/configure.ac
+++ gcc/gcc/configure.ac
@@ -3263,6 +3263,25 @@ x3:      .space 4
        tls_first_minor=14
        tls_as_opt="-a32 --fatal-warnings"
        ;;
+  riscv*-*-*)
+    conftest_s='
+       .section .tdata,"awT",@progbits
+x:
+       .word 2
+       .text
+       la.tls.gd a0,x
+       la.tls.ie a1,x
+       lui a0,%tls_ie_pcrel_hi(x)
+       lw a0,%pcrel_lo(x)(a0)
+       add a0,a0,tp
+       lw a0,0(a0)
+       lui a0,%tprel_hi(x)
+       add a0,a0,tp,%tprel_add(x)
+       lw a0,%tprel_lo(x)(a0)'
+       tls_first_major=2
+       tls_first_minor=21
+       tls_as_opt='-m32 --fatal-warnings'
+       ;;
   s390-*-*)
     conftest_s='
        .section ".tdata","awT",@progbits
--- original-gcc/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
+++ gcc/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
@@ -6,6 +6,9 @@
 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc)
   /* On PPC division by zero does not trap.  */
 # define DO_TEST 0
+#elif defined (__riscv__)
+  /* On RISC-V division by zero does not trap.  */
+# define DO_TEST 0
 #elif defined (__SPU__)
   /* On SPU division by zero does not trap.  */
 # define DO_TEST 0
--- original-gcc/gcc/testsuite/gcc.dg/20020312-2.c
+++ gcc/gcc/testsuite/gcc.dg/20020312-2.c
@@ -66,6 +66,8 @@ extern void abort (void);
 # else
 #  define PIC_REG  "30"
 # endif
+#elif defined(__riscv__)
+/* No pic register.  */
 #elif defined(__RX__)
 /* No pic register.  */
 #elif defined(__s390__)
--- original-gcc/gcc/testsuite/gcc.dg/20040813-1.c
+++ gcc/gcc/testsuite/gcc.dg/20040813-1.c
@@ -2,7 +2,7 @@
 /* Contributed by Devang Patel  <dpatel@apple.com>  */
 
 /* { dg-do compile } */
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* nvptx-*-* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* riscv*-*-* tile*-*-* nios2-*-* *-*-vxworks* nvptx-*-* } { "*" } { "" } } */
 /* { dg-options "-gstabs" } */
 
 int
--- original-gcc/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ gcc/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -61,6 +61,8 @@
 #  else
 #    define SIZE 240
 #  endif
+#elif defined (__riscv__)
+#  define SIZE 240
 #elif defined (__AVR__)
 #  define SIZE 254
 #elif defined (__s390x__)
--- original-gcc/libatomic/configure.tgt
+++ gcc/libatomic/configure.tgt
@@ -33,6 +33,7 @@ case "${target_cpu}" in
        ARCH=alpha
        ;;
   rs6000 | powerpc*)   ARCH=powerpc ;;
+  riscv*)              ARCH=riscv ;;
   sh*)                 ARCH=sh ;;
 
   arm*)
--- original-gcc/libgcc/config.host
+++ gcc/libgcc/config.host
@@ -167,6 +167,9 @@ powerpc*-*-*)
        ;;
 rs6000*-*-*)
        ;;
+riscv*)
+       cpu_type=riscv
+       ;;
 sparc64*-*-*)
        cpu_type=sparc
        ;;
@@ -1059,6 +1062,18 @@ powerpcle-*-eabi*)
        tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
        extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
        ;;
+riscv32*-*-linux*)
+       tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf riscv/t-elf32"
+       extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
+       ;;
+riscv*-*-linux*)
+       tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf"
+       extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
+       ;;
+riscv*-*-*)
+       tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf"
+       extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
+       ;;
 rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
        md_unwind_header=rs6000/aix-unwind.h
        tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix rs6000/t-ibm-ldouble"
--- original-gcc/libsanitizer/asan/asan_linux.cc
+++ gcc/libsanitizer/asan/asan_linux.cc
@@ -213,6 +213,11 @@ void GetPcSpBp(void *context, uptr *pc,
   *pc = ucontext->uc_mcontext.gregs[31];
   *bp = ucontext->uc_mcontext.gregs[30];
   *sp = ucontext->uc_mcontext.gregs[29];
+# elif defined(__riscv__)
+  ucontext_t *ucontext = (ucontext_t*)context;
+  *pc = ucontext->uc_mcontext.gregs[REG_PC];
+  *bp = ucontext->uc_mcontext.gregs[REG_S0];
+  *sp = ucontext->uc_mcontext.gregs[REG_SP];
 #else
 # error "Unsupported arch"
 #endif
--- original-gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -61,7 +61,8 @@ namespace __sanitizer {
 }  // namespace __sanitizer
 
 #if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\
-                            && !defined(__mips__) && !defined(__sparc__)
+                            && !defined(__mips__) && !defined(__sparc__)\
+                            && !defined(__riscv__)
 COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
 #endif
 
--- original-gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -72,6 +72,10 @@ namespace __sanitizer {
   const unsigned struct_kernel_stat_sz = 144;
   #endif
   const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__riscv__)
+  const unsigned struct___old_kernel_stat_sz = 0;
+  const unsigned struct_kernel_stat_sz = 128;
+  const unsigned struct_kernel_stat64_sz = 128;
 #elif defined(__sparc__) && defined(__arch64__)
   const unsigned struct___old_kernel_stat_sz = 0;
   const unsigned struct_kernel_stat_sz = 104;
@@ -511,7 +515,7 @@ namespace __sanitizer {
   typedef long __sanitizer___kernel_off_t;
 #endif
 
-#if defined(__powerpc__) || defined(__mips__)
+#if defined(__powerpc__) || defined(__mips__) || defined(__riscv__)
   typedef unsigned int __sanitizer___kernel_old_uid_t;
   typedef unsigned int __sanitizer___kernel_old_gid_t;
 #else
diff -ru gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform.h gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform.h
--- gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform.h   2015-05-13 19:36:27.061421043 -0700
+++ gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform.h        2015-05-13 19:44:19.274355577 -0700
@@ -98,9 +98,9 @@
 
 // The AArch64 linux port uses the canonical syscall set as mandated by
 // the upstream linux community for all new ports. Other ports may still
-// use legacy syscalls.
+// use legacy syscalls.  The RISC-V port also does this.
 #ifndef SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
-# if defined(__aarch64__) && SANITIZER_LINUX
+# if (defined(__aarch64__) || defined(__riscv__)) && SANITIZER_LINUX
 # define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 1
 # else
 # define SANITIZER_USES_CANONICAL_LINUX_SYSCALLS 0
diff -ru gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
--- gcc-5.1.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h      2015-05-13 19:36:27.061421043 -0700
+++ gcc-5.1.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h   2015-05-13 19:39:13.515487834 -0700
@@ -73,7 +73,6 @@
   #endif
   const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__riscv__)
-  const unsigned struct___old_kernel_stat_sz = 0;
   const unsigned struct_kernel_stat_sz = 128;
   const unsigned struct_kernel_stat64_sz = 128;
 #elif defined(__sparc__) && defined(__arch64__)
@@ -104,7 +103,7 @@
 
 #if SANITIZER_LINUX || SANITIZER_FREEBSD
 
-#if defined(__powerpc64__)
+#if defined(__powerpc64__) || defined(__riscv__)
   const unsigned struct___old_kernel_stat_sz = 0;
 #elif !defined(__sparc__)
   const unsigned struct___old_kernel_stat_sz = 32;
--- original-gcc/libstdc++-v3/configure
+++ gcc/libstdc++-v3/configure
@@ -16641,7 +16641,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   # Long term, -std=c++0x could be even better, could manage to explicitly
   # request C99 facilities to the underlying C headers.
   ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -std=c++98"
+  CXXFLAGS="$CXXFLAGS -std=gnu++98"
   ac_save_LIBS="$LIBS"
   ac_save_gcc_no_link="$gcc_no_link"
 
@@ -17263,9 +17263,11 @@ rm -f core conftest.err conftest.$ac_obj
 $as_echo "$glibcxx_cv_c99_wchar" >&6; }
   fi
 
+  # For newlib, don't check complex since missing c99 functions, but
+  #   rest of c99 stuff is there so don't loose it
   # Option parsed, now set things appropriately.
   if test x"$glibcxx_cv_c99_math" = x"no" ||
-     test x"$glibcxx_cv_c99_complex" = x"no" ||
+     # test x"$glibcxx_cv_c99_complex" = x"no" ||
      test x"$glibcxx_cv_c99_stdio" = x"no" ||
      test x"$glibcxx_cv_c99_stdlib" = x"no" ||
      test x"$glibcxx_cv_c99_wchar" = x"no"; then

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.