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]

Re: 2.10.91: A problem with R_MIPS_CALL relocations within gas



Hi Maciej,

From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Subject: Re: 2.10.91: A problem with R_MIPS_CALL relocations within gas
Date: Mon, 20 Nov 2000 07:34:40 +0100 (MET)

>  That surely is an option, but...
> 
> > 	.set	macro
> > 	.set	reorder
> > 
> > 	la	t9, <sym>
> > 	beq	t9, a1, 1f
> > 	jal	t9
> > 
> > 1:
> 
>  I'm not sure whether this is a proper SVR4 PIC code.  I guess the
> following code should be used instead (even though it's less optimal):


psABI book (Fig 3-18)says t9 is same as other temporary registers expcet on
calling position independent functions, because callee asummes t9
has own  address to calculate gp value.

According that description, we can use t9 for evaluating function
address not for calling. I believe following codes are proper.


> 	.set	macro
> 	.set	reorder
> 
> 	la	t9, <sym>
> 	beq	t9, a1, 1f
> 	jal	t9
> 
> 1:




Figure 3-18: General CPU Registers (from psABI 3rd Ed.)

$0	 zero	always has the value 0.
$at	 AT	temporary generally used by assembler.
$2..$3	 v0..1	used for expression evaluations and to hold the integer
		and pointer type function return values.
$4..$7   a0..3	used for passing arguments to functions; values are not
		preserved across function calls. Additional arguments
		are passed on the stack, as described below.
$8-$15   t0..7	temporary registers used for expression evaluation;
		values are not preserved across function calls.
$16-$23  s0..7	saved registers; values are preserved across function
		calls.
$24..$25 t8..9	temporary registers used for expression evaluations;
		values are not preserved across function calls. When
		calling position independent functions $25 must contain
		the address of the called function.
$26-$27  k0..1	used only by the operating system.
$28 	 gp	global pointer and context pointer.
$29	 sp	stack pointer.
$30	 s8	saved register (like s0-s7).
$31	 ra	return address. The return address is the location to
		which a function should return control.


---
Hiroyuki Machida
Creative Station		SCE Inc.

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