llvm-objdump -d unable to disassemble some Arm instructions

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 “” 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

4: 00 30 00 e3

8: 00 30 40 e3

c: 00 00 40 e3

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:

https://bugs.llvm.org/show_bug.cgi?id=46701

https://bugs.llvm.org/show_bug.cgi?id=46088

https://bugs.llvm.org/show_bug.cgi?id=44626

https://bugs.llvm.org/show_bug.cgi?id=38721

Thank you!

Alan Phipps

Texas Instruments