Print this page
OS-7095 Want risc-v disassembler
        
@@ -9,11 +9,11 @@
 # source.  A copy of the CDDL is also available via the Internet at
 # http://www.illumos.org/license/CDDL.
 #
 
 #
-# Copyright 2016 Joyent, Inc.
+# Copyright 2018 Joyent, Inc.
 #
 
 #
 # libdis test driver
 #
@@ -76,10 +76,11 @@
         -n                      Don't run default platform tests
         -p platform=pathtoas    Run tests for platform using assembler. Should
                                 either be an absolute path or a command on the
                                 path.
 USAGE
+        exit 2
 }
 
 #
 # By default, tests only run for the current platform. In other words,
 # running on an x86 system only assumes that the tests in the i386
@@ -194,10 +195,11 @@
 # 64-bit) being run.
 #
 run_single_file()
 {
         typeset sfile base cmpfile prefix arch gas p flags
+        typeset asflags32 asflags64
         sfile=$1
 
         base=${sfile##*/}
         cmpfile=${sfile%.*}.out
         prefix=${base%%.*}
@@ -205,20 +207,35 @@
         arch=${arch##*/}
         [[ -f $cmpfile ]] || fatal "missing output file $cmpfile"
         gas=${dt_platforms[$arch]}
         [[ -n $gas ]] || fatal "encountered test $sfile, but missing assembler"
 
+        case "$arch" in
+        "risc-v")
+                asflags32="-march=rv32g"
+                asflags64="-march=rv64g"
+                ;;
+        "risc-v-c")
+                asflags32="-march=rv32gc"
+                asflags64="-march=rv64gc"
+                ;;
+        *)
+                asflags32="-32"
+                asflags64="-64"
+                ;;
+        esac
+
         case "$prefix" in
         32)
-                test_one "-32" $sfile $cmpfile
+                test_one $asflags32 $sfile $cmpfile
                 ;;
         64)
-                test_one "-64" $sfile $cmpfile
+                test_one $asflags64 $sfile $cmpfile
                 ;;
         tst)
-                test_one "-32" $sfile $cmpfile "(32-bit)"
-                test_one "-64" $sfile $cmpfile "(64-bit)"
+                test_one $asflags32 $sfile $cmpfile "(32-bit)"
+                test_one $asflags64 $sfile $cmpfile "(64-bit)"
                 ;;
         esac
 }
 
 #
@@ -268,13 +285,14 @@
         case "$c" in
         n)
                 dt_nodefault="y"
                 ;;
         p)
+                OLDIFS=$IFS
                 IFS="="
                 set -A split $OPTARG
-                IFS=" "
+                IFS=$OLDIFS
                 [[ ${#split[@]} -eq 2 ]] || usage "malformed -p option: $OPTARG"
                 dt_platforms[${split[0]}]=${split[1]}
                 ;;
         :)
                 usage "option requires an argument -- $OPTARG"