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]

Re: ARM Branch Offsets?


Hi Todd,

>   2c:   ea000004        b       44 <start+0x2c>
> 
> Why is this second branch offset continually wrong?

This is because the branch instruction has not yet been completely
defined.  If you add the -r switch to objdump's command line, (as
suggested by Andrew Haley) you will see that there is a reloc
associated with this line.  If you were to fully link this object
file, you would see that the relocation is resolved and the correct
address is now in the instruction.

However, as an alternative, you may like to download the latest
binutils snapshot.  I applied a patch to objdump recently that makes
the disassembler take note of relocs in ARM object files and adjust the
displayed offsets accordingly.  So for example when I run 'objdump
-dr' on your file I get:

  28:   e1a00000        nop                     (mov r0,r0)
  2c:   ea000004        b       18 <start>
                        2c: R_ARM_PC24  .text

You can obtain the snapshots from:

  ftp://sources.redhat.com/pub/binutils/snapshots


Cheers
        Nick


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