Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jan 2016 16:59:06 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294577 - in head/contrib/compiler-rt/lib: builtins sanitizer_common
Message-ID:  <201601221659.u0MGx6RB049624@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: br
Date: Fri Jan 22 16:59:06 2016
New Revision: 294577
URL: https://svnweb.freebsd.org/changeset/base/294577

Log:
  Add support for RISC-V ISA.
  
  Reviewed by:	emaste
  Sponsored by:	DARPA, AFRL
  Sponsored by:	HEIF5
  Differential Revision:	https://reviews.freebsd.org/D5021

Modified:
  head/contrib/compiler-rt/lib/builtins/int_lib.h
  head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Modified: head/contrib/compiler-rt/lib/builtins/int_lib.h
==============================================================================
--- head/contrib/compiler-rt/lib/builtins/int_lib.h	Fri Jan 22 16:47:36 2016	(r294576)
+++ head/contrib/compiler-rt/lib/builtins/int_lib.h	Fri Jan 22 16:59:06 2016	(r294577)
@@ -74,11 +74,13 @@
  * global header to prevent other C files from making the detour
  * through __c?zdi2() as well.
  *
- * This problem has only been observed on FreeBSD for sparc64 and
- * mips64 with GCC 4.2.1.
+ * This problem has been observed on FreeBSD for sparc64 and
+ * mips64 with GCC 4.2.1, and for riscv with GCC 5.2.0.
+ * Presumably it's any version of GCC, and targeting an arch that
+ * does not have dedicated bit counting instructions.
  */
 #if defined(__FreeBSD__) && (defined(__sparc64__) || \
-    defined(__mips_n64) || defined(__mips_o64))
+    defined(__mips_n64) || defined(__mips_o64) || defined(__riscv__))
 si_int __clzsi2(si_int);
 si_int __ctzsi2(si_int);
 #define	__builtin_clz __clzsi2

Modified: head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
==============================================================================
--- head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h	Fri Jan 22 16:47:36 2016	(r294576)
+++ head/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h	Fri Jan 22 16:59:06 2016	(r294577)
@@ -76,6 +76,10 @@ namespace __sanitizer {
 #elif defined(__powerpc64__)
   const unsigned struct_kernel_stat_sz = 144;
   const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__riscv__)
+  /* RISCVTODO: check that these values are correct */
+  const unsigned struct_kernel_stat_sz = 128;
+  const unsigned struct_kernel_stat64_sz = 128;
 #elif defined(__mips__)
   #if SANITIZER_WORDSIZE == 64
   const unsigned struct_kernel_stat_sz = 216;
@@ -103,7 +107,7 @@ namespace __sanitizer {
 
 #if SANITIZER_LINUX || SANITIZER_FREEBSD
 
-#if defined(__powerpc64__)
+#if defined(__powerpc64__) || defined(__riscv__)
   const unsigned struct___old_kernel_stat_sz = 0;
 #else
   const unsigned struct___old_kernel_stat_sz = 32;
@@ -481,7 +485,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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601221659.u0MGx6RB049624>