This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ARM Branch Offsets?
- To: Todd Lipcon <tlipcon at mercea dot net>
- Subject: ARM Branch Offsets?
- From: Andrew Haley <aph at redhat dot com>
- Date: Tue, 13 Mar 2001 20:46:08 +0000 (GMT)
- Cc: binutils at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10103131529330.8997-100000@mercea.net>
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.