public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Is it possible to branch to an absolute address ?
@ 2006-07-07  9:46 Amarnath
  2006-07-07 10:10 ` Thiemo Seufer
  2006-07-07 23:26 ` Eric Christopher
  0 siblings, 2 replies; 4+ messages in thread
From: Amarnath @ 2006-07-07  9:46 UTC (permalink / raw)
  To: binutils

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?

- Is there any restriction in branching towards absolute value in ELF?

- Is it possible in ELF to emit relocation information without any symbol
information associated with it?


Please help me in the above.

Thank you.

Regards,
Amarnath M

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is it possible to branch to an absolute address ?
  2006-07-07  9:46 Is it possible to branch to an absolute address ? Amarnath
@ 2006-07-07 10:10 ` Thiemo Seufer
  2006-07-07 23:26 ` Eric Christopher
  1 sibling, 0 replies; 4+ messages in thread
From: Thiemo Seufer @ 2006-07-07 10:10 UTC (permalink / raw)
  To: Amarnath; +Cc: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Is it possible to branch to an absolute address ?
  2006-07-07  9:46 Is it possible to branch to an absolute address ? Amarnath
  2006-07-07 10:10 ` Thiemo Seufer
@ 2006-07-07 23:26 ` Eric Christopher
  2006-07-08  4:54   ` Amarnath
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Christopher @ 2006-07-07 23:26 UTC (permalink / raw)
  To: amarnath; +Cc: binutils

>
> - In the above, why GCC was not assembling the branch instruction with
> absolute value as operand in it?

You asked these questions in private mail yesterday. Please go read  
my response and look at the ISA manual.

-eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Is it possible to branch to an absolute address ?
  2006-07-07 23:26 ` Eric Christopher
@ 2006-07-08  4:54   ` Amarnath
  0 siblings, 0 replies; 4+ messages in thread
From: Amarnath @ 2006-07-08  4:54 UTC (permalink / raw)
  To: 'Eric Christopher'; +Cc: binutils



> -----Original Message-----
> From: Eric Christopher [mailto:echristo@apple.com]
> Sent: Saturday, July 08, 2006 4:56 AM
> To: amarnath@acmet.com
> Cc: binutils@sourceware.org
> Subject: Re: Is it possible to branch to an absolute address ?
> 
> >
> > - In the above, why GCC was not assembling the branch instruction with
> > absolute value as operand in it?
> 
> You asked these questions in private mail yesterday. Please go read
> my response and look at the ISA manual.
> 
> -eric


Ok, Thank you. I am checking it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-08  4:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07  9:46 Is it possible to branch to an absolute address ? Amarnath
2006-07-07 10:10 ` Thiemo Seufer
2006-07-07 23:26 ` Eric Christopher
2006-07-08  4:54   ` Amarnath

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).