Print this page
OS-7095 Want risc-v disassembler
        
*** 9,19 ****
  # source.  A copy of the CDDL is also available via the Internet at
  # http://www.illumos.org/license/CDDL.
  #
  
  #
! # Copyright 2016 Joyent, Inc.
  #
  
  #
  # libdis test driver
  #
--- 9,19 ----
  # source.  A copy of the CDDL is also available via the Internet at
  # http://www.illumos.org/license/CDDL.
  #
  
  #
! # Copyright 2018 Joyent, Inc.
  #
  
  #
  # libdis test driver
  #
*** 76,85 ****
--- 76,86 ----
          -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,203 ****
--- 195,205 ----
  # 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,224 ****
          arch=${arch##*/}
          [[ -f $cmpfile ]] || fatal "missing output file $cmpfile"
          gas=${dt_platforms[$arch]}
          [[ -n $gas ]] || fatal "encountered test $sfile, but missing assembler"
  
          case "$prefix" in
          32)
!                 test_one "-32" $sfile $cmpfile
                  ;;
          64)
!                 test_one "-64" $sfile $cmpfile
                  ;;
          tst)
!                 test_one "-32" $sfile $cmpfile "(32-bit)"
!                 test_one "-64" $sfile $cmpfile "(64-bit)"
                  ;;
          esac
  }
  
  #
--- 207,241 ----
          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 $asflags32 $sfile $cmpfile
                  ;;
          64)
!                 test_one $asflags64 $sfile $cmpfile
                  ;;
          tst)
!                 test_one $asflags32 $sfile $cmpfile "(32-bit)"
!                 test_one $asflags64 $sfile $cmpfile "(64-bit)"
                  ;;
          esac
  }
  
  #
*** 268,280 ****
          case "$c" in
          n)
                  dt_nodefault="y"
                  ;;
          p)
                  IFS="="
                  set -A split $OPTARG
!                 IFS=" "
                  [[ ${#split[@]} -eq 2 ]] || usage "malformed -p option: $OPTARG"
                  dt_platforms[${split[0]}]=${split[1]}
                  ;;
          :)
                  usage "option requires an argument -- $OPTARG"
--- 285,298 ----
          case "$c" in
          n)
                  dt_nodefault="y"
                  ;;
          p)
+                 OLDIFS=$IFS
                  IFS="="
                  set -A split $OPTARG
!                 IFS=$OLDIFS
                  [[ ${#split[@]} -eq 2 ]] || usage "malformed -p option: $OPTARG"
                  dt_platforms[${split[0]}]=${split[1]}
                  ;;
          :)
                  usage "option requires an argument -- $OPTARG"