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]

ARM Branch Offsets?


Todd Lipcon writes:
 > Hi all,
 >    Last night I downloaded binutils source and compiled with configure
 > --target=arm-unknown-elf. My intended target system is actually ROMs for a
 > game console; however, I read a message on this list's archive saying that
 > the easiest way to get a ROM is to just use objcopy on an ELF binary.

 > Test.s.elf:     file format elf32-littlearm
 > 
 > Disassembly of section .text:
 > 
 > 00000000 <start-0x18>:
 >    0:   ea000004        b       18 <start>
 >    4:   e1a00000        nop                     (mov r0,r0)
 >    8:   e1a00000        nop                     (mov r0,r0)
 >    c:   e1a00000        nop                     (mov r0,r0)
 >   10:   e1a00000        nop                     (mov r0,r0)
 >   14:   e1a00000        nop                     (mov r0,r0)
 > 
 > 00000018 <start>:
 >   18:   e1a00000        nop                     (mov r0,r0)
 >   1c:   e1a00000        nop                     (mov r0,r0)
 >   20:   e1a00000        nop                     (mov r0,r0)
 >   24:   e1a00000        nop                     (mov r0,r0)
 >   28:   e1a00000        nop                     (mov r0,r0)
 >   2c:   ea000004        b       44 <start+0x2c>
 > 
 > Why is this second branch offset continually wrong? I have tried toggling
 > the -k switch to no avail. The ARM7TDMI assembler my friend is in the
 > process of writing compiles the same code to a ROM. If I take this ROM and
 > manually put it into an ELF wrapper, objdump correctly shows the branches
 > going to the labels.
 > 
 > I can't believe this is a bug in the arm codegen... so what am I doing
 > wrong?

You're using the wrong objdump command.  Use arm-elf-objdump -r -d
Test.elf and you'll see the relocation for the branch.

Andrew.


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