This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Is it possible to branch to an absolute address ?
- From: Thiemo Seufer <ths at networkno dot de>
- To: Amarnath <amarnath at acmet dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 7 Jul 2006 11:09:52 +0100
- Subject: Re: Is it possible to branch to an absolute address ?
- References: <200607070954.k679sUO28216@alice.acmet.com>
Amarnath wrote:
> HI,
>
> I have a query in my mind. Please check the following sample assembly file:
>
> ----------- Snip ---------------
>
> .file 1 "TestingBranch.c"
> .set mips16
>
> gcc2_compiled.:
> __gnu_compiled_c:
> .text
> .align 2
> .globl func
>
> .align 2
> .globl main
> .ent main
> main:
> .frame $17,16,$31 # vars= 8, regs= 2/0, args= 0,
> extra= 0
> .mask 0x80020000,-4
> .fmask 0x00000000,0
>
> b 0x4000 # >>> branch with absolute operand
> move $sp,$17
> $L2:
> .end main
>
> .ent func
> func:
> .frame $17,16,$31 # vars= 8, regs= 1/0,
> args= 0, extra= 0
> .mask 0x00020000,-8
> .fmask 0x00000000,0
>
> $L1:
>
> .end func
>
> -------------- End Snip ----------------
>
> - In the above, why GCC was not assembling the branch instruction with
> absolute value as operand in it?
Can you also provide the C source code? I fail to see how C code could
result in such assembly.
> - Is there any restriction in branching towards absolute value in ELF?
The MIPS architecture defines branches as PC relative. For an absolute
address you need a jump.
Thiemo