[llvm-dev] llvm-objdump -d unable to disassemble some Arm instructions

Phipps, Alan via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 4 11:57:54 PST 2020

Using llvm-objdump -d to disassemble some Arm object files does not always provide a full disassembly of some instructions.  For example, movw/movt instructions end up being disassembled as "<unknown>" when objdump -d is run without any other options:

cat test.s:
   movw    r0, #0
   movw    r3, #0
   movt    r3, #0
   movt    r0, #0

clang -mcpu=cortex-r5 -mthumb test.s -c

llvm-objdump -d test.o:
       0:       00 00 00 e3  <unknown>
       4:       00 30 00 e3  <unknown>
       8:       00 30 40 e3  <unknown>
       c:       00 00 40 e3  <unknown>

On cursory examination, it appears that llvm-objdump does not extract all of the information from the obj file required to correctly decode the bits, including endianness.  GNU's objdump tool does not appear to have this problem:

arm-none-eabi-objdump -d test.o
         0:   e3000000        movw    r0, #0
   4:   e3003000        movw    r3, #0
   8:   e3403000        movt    r3, #0
   c:   e3400000        movt    r0, #0

I'm curious if anyone has looked into this and would be willing to upstream a fix?

On a related note, there are some outstanding LLVM defects filed that seem to pertain to this but for different cases:


Thank you!

Alan Phipps
Texas Instruments
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201104/d01f2a13/attachment.html>

More information about the llvm-dev mailing list