Is it valid in GAS?

Vineet Sharma, Noida vineets@noida.hcltech.com
Mon Dec 8 07:07:00 GMT 2003


Hi,
    But how do i pass this "value ( -5 in this case)" to linker, if i write
it to output file it is overwritten by assembler itself when it call reloc
routines. 

Lp.1:
>       	  .short  ___DTOR_LIST - 5

And reloc_entry never has this value of -5 in it when linker call
coff_XXX_reloc()

Thanks in adavnce
Vineet

-----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au]
Sent: Saturday, December 06, 2003 7:14 AM
To: Vineet Sharma, Noida
Cc: binutils@sources.redhat.com
Subject: Re: Is it valid in GAS?


On Fri, Dec 05, 2003 at 04:05:29PM +0530, Vineet Sharma, Noida wrote:
> Hi,
>       Is the following declartion valid in GAS Assembler.
> 
> 	___DTOR_LIST:
>       		  .short 0x88
> 	Lp.1:
>       	  .short  ___DTOR_LIST - 5	/*Is negative i .e
substraction
> allowed*/
> 
> 
> If yes, then how do i find this addended in tc_gen_reloc().

Yes, it is valid.  Please see how other targets do this.  For example,
powerpc-linux-gas produces

Relocation section '.rela.text' at offset 0x200 contains 1 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000002  00000403 R_PPC_ADDR16      00000000   ___DTOR_LIST + fffffffb


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list