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]

Branch instruction(b/bl) for ARM


Dear Binutils

I made a cross-compiler for arm-elf target.
And, I was checked the elf file.

same as a "arm-elf-objdump -dr crt0.o" instruction.

But, result like this :
=====================================================================
crt0.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <_mainCRTStartup>:
   0:   ef000010        swi     0x00000010
   4:   e1a0d001        mov     sp, r1
   8:   e59fa0b0        ldr     sl, [pc, #b0]   ; c0 <LC2>
   c:   e28aac01        add     sl, sl, #256
  10:   e3a01000        mov     r1, #0
  14:   e1a0b001        mov     fp, r1
  18:   e1a07001        mov     r7, r1
  1c:   e59f0098        ldr     r0, [pc, #98]   ; bc <LC0>
  20:   e59f2098        ldr     r2, [pc, #98]   ; c0 <LC2>
  24:   e0422000        sub     r2, r2, r0
  28:   ebfffffe        bl      28 <_mainCRTStartup+0x28>
                        28: R_ARM_PC24  memset
  2c:   ebfffffe        bl      2c <_mainCRTStartup+0x2c>
                        2c: R_ARM_PC24  initialise_monitor_handles
  30:   ef000010        swi     0x00000010
  34:   e1a01000        mov     r1, r0
  38:   e3a00000        mov     r0, #0

0000003c <LC10>:
  3c:   e4d13001        ldrb    r3, [r1], #1
  40:   e3530000        cmp     r3, #0
  44:   0a000022        beq     d4 <LC2+0x14>
                        44: R_ARM_PC24  .text
  48:   e3530020        cmp     r3, #32
  4c:   0a00000d        beq     88 <LC11+0x1c>
                        4c: R_ARM_PC24  .text
  50:   e3530022        cmp     r3, #34
  54:   13530027        cmpne   r3, #39
  58:   01a02003        moveq   r2, r3
  5c:   13a02020        movne   r2, #32
  60:   12411001        subne   r1, r1, #1
  64:   e92d0002        stmdb   sp!, {r1}
  68:   e2800001        add     r0, r0, #1

0000006c <LC11>:
  6c:   e4d13001        ldrb    r3, [r1], #1
  70:   e3530000        cmp     r3, #0
  74:   0a000022        beq     104 <LC2+0x44>
                        74: R_ARM_PC24  .text
  78:   e1520003        cmp     r2, r3
  7c:   1a000019        bne     e8 <LC2+0x28>
                        7c: R_ARM_PC24  .text
  80:   e3a02000        mov     r2, #0
  84:   e2413001        sub     r3, r1, #1
  88:   e5c32000        strb    r2, [r3]
  8c:   ea00000d        b       c8 <LC2+0x8>
                        8c: R_ARM_PC24  .text

00000090 <LC12>:
  90:   e1a0100d        mov     r1, sp
  94:   e08d2100        add     r2, sp, r0, lsl #2
  98:   e1a0300d        mov     r3, sp

0000009c <LC13>:
  9c:   e1520003        cmp     r2, r3
  a0:   85124004        ldrhi   r4, [r2, -#4]
  a4:   85935000        ldrhi   r5, [r3]
  a8:   85225004        strhi   r5, [r2, -#4]!
  ac:   84834004        strhi   r4, [r3], #4
  b0:   8a000025        bhi     14c <LC2+0x8c>
                        b0: R_ARM_PC24  .text
  b4:   ebfffffe        bl      b4 <LC13+0x18>
                        b4: R_ARM_PC24  main
  b8:   ebfffffe        bl      b8 <LC13+0x1c>
                        b8: R_ARM_PC24  exit

000000bc <LC0>:
  bc:   00000000        andeq   r0, r0, r0
                        bc: R_ARM_ABS32 __bss_start__

000000c0 <LC2>:
  c0:   00000000        andeq   r0, r0, r0
                        c0: R_ARM_ABS32 __bss_end__
=====================================================================

compile options follow this
  --target=arm-elf --disable-threads --with-newlib 
  --with-headers=/usr/src/linux/include

but, b/bl instructions branch the recursive like folllow:
============================================================
00000000 <_mainCRTStartup>:

  28:   ebfffffe        bl      28 <_mainCRTStartup+0x28>
                        28: R_ARM_PC24  memset
  2c:   ebfffffe        bl      2c <_mainCRTStartup+0x2c>
                        2c: R_ARM_PC24  initialise_monitor_handles


0000009c <LC13>:

  b4:   ebfffffe        bl      b4 <LC13+0x18>
                        b4: R_ARM_PC24  main
  b8:   ebfffffe        bl      b8 <LC13+0x1c>
                        b8: R_ARM_PC24  exit
============================================================

Why was happend above problem?
Pleaswe, Help me.

==================
Myunghui Ryu
==================


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