Shop OBEX P1 Docs P2 Docs Learn Events
Disassembly Oddities. — Parallax Forums

Disassembly Oddities.

dchokoladchokola Posts: 8
edited 2014-01-13 04:56 in Propeller 1
I have been trying to debug some LMM code with a single .cog module, so I compiled both with -O0 and -g, then did an objdump. I'm new to Propeller assembly (In fact, I'm using C to *avoid* using assembly.) so I'm not sure if I just don't understand what I'm seeing or if there is some other problem.

Throughout the dump, particularly in the .cog module, there are lines like this:
0000015c <__LMM_JMP>:
 15c:   1122bc08                        rdlong  44 <pc>, 44 <pc>
00000000 <r0>:
   0:   0000bca0                        mov     40 <sp>, 40 <sp>
00000004 <r1>:
   4:   0000bca0                        mov     0 <r0>, 0 <r0>
00000008 <r2>:
   8:   0000bc0a                        rdlong  4 <r1>, 4 <r1> wz

Wouldn't these instructions be useless since the sources and destinations are identical?

Comments

  • dchokoladchokola Posts: 8
    edited 2014-01-11 18:51
    I should mention that this is propeller-elf-gcc (propellergcc-alpha_v1_9_0_2277) 4.6.1 (Latest from propgcc Mercurial as of today.)
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 19:17
    dchokola wrote: »
    I should mention that this is propeller-elf-gcc (propellergcc-alpha_v1_9_0_2277) 4.6.1 (Latest from propgcc Mercurial as of today.)
    No, they're not useless. They are essentially: pc = *pc;
  • dchokoladchokola Posts: 8
    edited 2014-01-11 19:29
    David Betz wrote: »
    No, they're not useless. They are essentially: pc = *pc;

    Thank you! I really over-thought this one.
  • ersmithersmith Posts: 6,054
    edited 2014-01-13 04:56
    Actually the problem is with the disassembler -- it's only able to handle one relocation at a time. I can't remember why this is, but I remember looking at it and it wasn't trivial to fix. So disassembly of relocatable object files tends to be kind of useless; the instructions come out right, but you can't rely on the operands.

    Disassembly of final executable binaries is OK, though, because those no longer have relocations.
Sign In or Register to comment.