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?


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.
Anyway, it compiled fine and I've been playing around this morning trying
to get them to work. However, gas never seems to generate correct branch
offsets. Here is my assembly file:


b start

.rept 5
nop
.endr

start:

.rept 5    
        nop
.endr
        
        b start

.end

I compile this using:
arm-unknown-elf-as -m7tdmi -mall -EL -k Test.s -o Test.elf

Then, if I use:
arm-unknown-elf-objdump -d Test.elf
I get:
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?

Thanks,
-Todd

-- 

"It's not that easy being green;
Having to spend each day the color of the leaves.
When I think it could be nicer being red, or yellow or gold...
or something much more colorful like that." -Kermit the Frog


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