Merge tag 'gfs2-v6.7-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / scripts / decodecode
index b28fd26..6364218 100755 (executable)
@@ -67,6 +67,7 @@ if [ -z "$ARCH" ]; then
     case `uname -m` in
        aarch64*) ARCH=arm64 ;;
        arm*) ARCH=arm ;;
+       loongarch*) ARCH=loongarch ;;
     esac
 fi
 
@@ -93,6 +94,15 @@ disas() {
                ${CROSS_COMPILE}strip $t.o
        fi
 
+       if [ "$ARCH" = "riscv" ]; then
+               OBJDUMPFLAGS="-M no-aliases --section=.text -D"
+               ${CROSS_COMPILE}strip $t.o
+       fi
+
+       if [ "$ARCH" = "loongarch" ]; then
+               ${CROSS_COMPILE}strip $t.o
+       fi
+
        if [ $pc_sub -ne 0 ]; then
                if [ $PC ]; then
                        adj_vma=$(( $PC - $pc_sub ))
@@ -126,8 +136,13 @@ get_substr_opcode_bytes_num()
        do
                substr+="$opc"
 
+               opcode="$substr"
+               if [ "$ARCH" = "riscv" ]; then
+                       opcode=$(echo $opcode | tr ' ' '\n' | tac | tr -d '\n')
+               fi
+
                # return if opcode bytes do not match @opline anymore
-               if ! echo $opline | grep -q "$substr";
+               if ! echo $opline | grep -q "$opcode";
                then
                        break
                fi