0

I have compiled some code with gcc -marm, and then when I try to disassemble it with objdump, half of the instructions are 16 bits, so I guess it is thumb instructions. Why ?

I have seen this question : objdump and ARM vs Thumb

So I tried to disassemble it with objdump -marm -b binary -D, however the disassembly seems very odd...

How I can know if this is gcc which used thumb instructions despite the -marm option, or if it is objdump which is buggy ?

EDIT : here is a fraction of the disassembly with 16 bits instructions :

Disassembly of section .init:

00008304 <_init>: 8304: b508 push {r3, lr}
8306: f000 f849 bl 839c
830a: bf00 nop
830c: bd08 pop {r3, pc}

Community
  • 1
  • 1
  • What is `gcc`s output format? Binary, ELF, or something else? – artless noise Jul 02 '13 at 03:26
  • Normally it is elf. I am not sure about the .s (how can I get this information from the .s ?), but when I disassemble the executable, it is written that it is elf32-littlearm – user2299676 Jul 02 '13 at 12:26
  • can you provide some examples/fractions of sections with label names that you think are thumb? – old_timer Jul 02 '13 at 14:20
  • If it is an *ELF* file, then just `objdump -S file.o` should work. The **objdump** has to be *ARM* aware. You can not use a normal PC **objdump**. Ubuntu has a *multi-arch binutils*, and the **objdump** in that version will understand *ARM*. Make sure the **objdump** is from the same place as your `gcc`. – artless noise Jul 02 '13 at 14:57
  • I have tried to use objump -S but it doesn't seem to change anything... – user2299676 Jul 02 '13 at 15:09
  • I have forgot to say, I used objdump at the place I have compiled my code – user2299676 Jul 02 '13 at 15:16

0 Answers0