Package: radare2
Version: 1.0+dfsg-1
Severity: normal
Control: found -1 0.10.6+dfsg-1

Hello,

I try to assemble the arm thumb instruction

        sub sp, #0x10

using:

        $ rasm2 -a arm -e -b 16 "sub sp, #0x10;"
        1035

This is however inconsistent with the disassembler shows:

        $ rasm2 -a arm -e -b 16 -d 1035
        asrs r5, r6, 0x20

Double checking with ARMARM it's indeed the assembler which is
wrong.

When using "sub sp, sp, #0x10;" I get a different wrong result:

        $ rasm2 -a arm -e -b 16 "sub sp, sp, #0x10;"
        6d1e
        $ rasm2 -a arm -e -b 16 -d 6d1e
        ldr r6, [r3, 0x50]

(Again, ARMARM tells that the disassembler is right.)

The right solution is b084 according to ARMARM and rasm2 -d:

        $ rasm2 -a arm -e -b 16 -d b084
        sub sp, 0x10

Doing the same with -b 32 (i.e. ARM instead of Thumb) it works fine:

        $ rasm2 -a arm -e -b 32 "sub sp, sp, #0x10;"
        e24dd010
        $ rasm2 -a arm -e -b 32 -d e24dd010
        sub sp, sp, 0x10

This happens with both radare2 from stretch (0.10) and sid (1.0).

Best regards
Uwe

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (800, 'testing'), (600, 'unstable'), (500, 'testing-debug'), 
(500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages radare2 depends on:
ii  libc6           2.24-5
ii  libradare2-1.0  1.0+dfsg-1
ii  libzip4         1.1.2-1.1
ii  zlib1g          1:1.2.8.dfsg-2+b3

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Reply via email to