RISC-V: add support for RV64 Linux
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 20 Dec 2019 22:16:22 +0000
changeset 324 980eac9a7a1d
parent 323 1836a0e14ddb
child 325 7d9550327b8d
RISC-V: add support for RV64 Linux
makelib/config-riscv64-unknown-linux-gnu.make
makelib/config-riscv64.make
makelib/config.make
specs/stx-jv.rbspec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makelib/config-riscv64-unknown-linux-gnu.make	Fri Dec 20 22:16:22 2019 +0000
@@ -0,0 +1,4 @@
+# Definitions for target riscv64-unknown-linux-gnu.
+
+include $(MAKELIB)/config-linux-gnu.make
+include $(MAKELIB)/config-riscv64.make
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makelib/config-riscv64.make	Fri Dec 20 22:16:22 2019 +0000
@@ -0,0 +1,9 @@
+#
+# Common definitions for RISC-V 64
+#
+
+CPU_INTERN_H = cpu_riscv64.h
+DEFS += -D__riscv64__
+
+OPT += -fno-lto -O0
+LDFLAGS += -fno-lto
--- a/makelib/config.make	Tue Nov 02 15:34:47 2021 +0000
+++ b/makelib/config.make	Fri Dec 20 22:16:22 2019 +0000
@@ -86,13 +86,13 @@
 # MAKE=make
 
 # c-compiler to use
-CC ?= cc
+CC ?= $(CROSS)cc
 AS_CC ?= $(CC) $(CCCONFOPT)
 AS_CC_CFLAG=-c
-CPP = cpp
+CPP = $(CROSS)cpp
 
 # assembler for librun/asmhelp
-AS = as
+AS = $(CROSS)as
 
 # linker for final executable
 LD = $(CC) $(CCCONFOPT)
@@ -111,16 +111,16 @@
 YACC=yacc
 
 # librarian
-AR=ar
+AR=$(CROSS)ar
 AR_LIB_FLAG=r
-RANLIB=ranlib
+RANLIB=$(CROSS)ranlib
 
 # symbolic link
 LNS=ln -s
 
 # misc
-STRIP=strip
-OBJCOPY=objcopy
+STRIP=$(CROSS)strip
+OBJCOPY=$(CROSS)objcopy
 DIRNAME=dirname
 CHMOD=chmod
 #
@@ -186,6 +186,8 @@
 STCCOMMONOPT=+sharedLibCode -staticMethods +lineInfo +stLineInfo
 CCCOMMONOPT=-DHAVE_FFI
 
+
+
 # to be redefined in arch/COMMON/defines
 STCARCHCOMMONOPT=
 CCARCHCOMMONOPT=-DELF
@@ -369,7 +371,7 @@
 CONFTOP    = $(TOP)
 RULETOP    = $(TOP)
 STCDIR     = $(TOP)/stc
-STC        = $(STCDIR)/stc
+STC        = $(CROSS_EXEC) $(STCDIR)/stc
 
 CONFDIR    = $(CONFTOP)/configurations
 RULEDIR    = $(RULETOP)/rules
--- a/specs/stx-jv.rbspec	Tue Nov 02 15:34:47 2021 +0000
+++ b/specs/stx-jv.rbspec	Fri Dec 20 22:16:22 2019 +0000
@@ -133,8 +133,11 @@
   tasks do
     # Build and install documentation for stx:libjava and stx:libscm/mercurial
     task "install:pre" do
-      chdir BUILD_DIR / 'stx' / 'libjava' do
-        make "doc-install"
+      # stx:libjava is not supported on RISC-V
+      if (BUILD_TARGET != 'riscv64-unknown-linux-gnu') then
+        chdir BUILD_DIR / 'stx' / 'libjava' do
+          make "doc-install"
+        end
       end
       chdir BUILD_DIR / 'stx' / 'libscm' / 'mercurial' do
         make "doc-install"
@@ -181,11 +184,13 @@
   package "stx:goodies/monticello/tonel", :repository => :'jv-branch:public'
 
 
-  # Java support
-  package "stx:libjava", :repository => :'jv-branch:public'
-  package "stx:libjava/tools"
-  package "stx:libjava/experiments"
-  #package "stx:libjava/examples" :link => false
+  # Java support (not supported on RISC-V)
+  if (BUILD_TARGET != 'riscv64-unknown-linux-gnu') then
+    package "stx:libjava", :repository => :'jv-branch:public'
+    package "stx:libjava/tools"
+    package "stx:libjava/experiments"
+    package "stx:libjava/examples", :link => false
+  end
 
   # VDB support
   package 'stx:goodies/magritte', :repository => :'exept:public', :link => false
@@ -224,8 +229,11 @@
   package 'stx:libview/tests', :test => true;
   package 'stx:libwidg/tests', :test => true;
   package 'stx:libtool/tests', :test => true;
-  package 'stx:libjava', :test => true;
-  package 'stx:libjava/tools', :test => true;
+  # stx:libjava is not supported on RISC-V
+  if (BUILD_TARGET != 'riscv64-unknown-linux-gnu') then
+    package 'stx:libjava', :test => true;
+    package 'stx:libjava/tools', :test => true;
+  end
   package 'stx:goodies/regression', :test => true;
   package 'stx:libscm/mercurial', :test => true;
   # Temporarily disable libgdbs/vdb tests. This needs a lot of