public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Thiemo Seufer <ths@networkno.de>
To: Amarnath <amarnath@acmet.com>
Cc: binutils@sourceware.org
Subject: Re: Is it possible to branch to an absolute address ?
Date: Fri, 07 Jul 2006 10:10:00 -0000	[thread overview]
Message-ID: <20060707100952.GD4274@networkno.de> (raw)
In-Reply-To: <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

  reply	other threads:[~2006-07-07 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07  9:46 Amarnath
2006-07-07 10:10 ` Thiemo Seufer [this message]
2006-07-07 23:26 ` Eric Christopher
2006-07-08  4:54   ` Amarnath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060707100952.GD4274@networkno.de \
    --to=ths@networkno.de \
    --cc=amarnath@acmet.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).