This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [arnm-elf-objdump] Can't use two -M flags for disassembler (-Mforce-thumband -Mreg-names-raw)


Hello Nick,

Thanks for your reply.

Investigating a little more, this seems to happen even with ARM-only/THUMB_only code: the disassembler turns off -Mforce-thumb option when used with -Mreg-names-raw for an ADS object file, either ARM or THUMB code.

You will find enclosed four files:
1. Hello.c is the source of an Hello World program (in case you need it)
2. Hello-THUMB.o is output of tcc, the ADS THUMB C compiler
3. Hello-ARM.o is the output of armcc, the ADS ARM C compiler (so you may compare if needed)
4. The different commands issued to spot the problem


Note: To decrease the size of the object files, I disabled linking.
Let me tell you if there are other things you may find useful.

Thank you very much for your consideration.

Best regards,

Vincent

PS: I will only be back on Tuesday so I will not be able to reply before


nickc@redhat.com wrote:


[snip]
Hmm - it is probably a case of ADS and GAS using different methods to
distinguish between ARM and THUMB code in their object files.  Please
could you send me a *small* ADS object file which demonstrates this
problem, so that I can try to find a fix ?

Cheers
Nick


#include <stdio.h>

int main() {
  printf("Hello World\n");
  return 0;
}
$ arm-elf-objdump -d Hello.o

Hello.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:   a002b580        andge   fp, r2, r0, lsl #11

00000004 <$b>:
   4:   fffef7ff        swinv   0x00fef7ff
   8:   bd802000        stclt   0, cr2, [r0]

0000000c <$d>:
   c:   6c6c6548        cfstr64vs       mvdx6, [ip], -#288
  10:   6f57206f        swivs   0x0057206f
  14:   0a646c72        beq     191b1e4 <$d+0x191b1d8>
  18:   00000000        andeq   r0, r0, r0



$ arm-elf-objdump -d -Mforce-thumb Hello.o 
Hello.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:   b580            push    {r7, lr}
   2:   a002            add     r0, pc, #8      (adr r0,c <$d>)

00000004 <$b>:
   4:   fffef7ff        bl      0 <main>
   8:   2000            mov     r0, #0
   a:   bd80            pop     {r7, pc}

0000000c <$d>:
   c:   6548            str     r0, [r1, #84]
   e:   6c6c            ldr     r4, [r5, #68]
  10:   206f            mov     r0, #111
  12:   6f57            ldr     r7, [r2, #116]
  14:   6c72            ldr     r2, [r6, #68]
  16:   0a64            lsr     r4, r4, #9
  18:   0000            lsl     r0, r0, #0
        ...


$ arm-elf-objdump -d -Mforce-thumb -Mreg-names-raw Hello.o

Hello.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:   a002b580        andge   r11, r2, r0, lsl #11

00000004 <$b>:
   4:   fffef7ff        swinv   0x00fef7ff
   8:   bd802000        stclt   0, cr2, [r0]

0000000c <$d>:
   c:   6c6c6548        cfstr64vs       mvdx6, [r12], -#288
  10:   6f57206f        swivs   0x0057206f
  14:   0a646c72        beq     191b1e4 <$d+0x191b1d8>
  18:   00000000        andeq   r0, r0, r0

Attachment: Hello-ARM.o
Description: Binary data

Attachment: Hello-THUMB.o
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]