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]
Other format: [Raw text]

RE: interface prob in gas and ld


Hi,


>What it passes to fix_new_exp() should just be an O_symbol, though, I
>think.

Actuall fix_new_exp() passes O_symbol and addend(as an fx_offset) to
fix_new_internal()

>How does fr_offset figure into this?  That is the offset into the
>frag, which as far as I can see is irrelevant here.

It is actaully fx_offset(which does not handle negative values)ie addend in
fx_offset.

>Normally the 9 would be handled as a reloc addend.  For some targets
>an addend is stored in the reloc entry itself.  For some it is stored
>in the object file.

I have defined "external_reloc"  in include/coff/XXX.h as 

	struct external_reloc
	{
	  char r_vaddr[4];      /* (virtual) address of reference */
	  char r_symndx[4];     /* index into symbol table */
	  char r_type[2];       /* relocation type */
	  char r_addend[2];     /*addend*/
	};

	#define RELOC           struct external_reloc
	#define RELSZ           10+2            /* sizeof (RELOC) */

But my BFD_ASSEMBLER does not write this structure to the COFF output,rather
it write the reloc_entry strcuture(v_addr,sym_index,r_type). How do ask it
to write my structure?


Regards
Vineet



























-----Original Message-----
From: Ian Lance Taylor [mailto:ian@wasabisystems.com]
Sent: Monday, December 08, 2003 7:59 PM
To: Vineet Sharma, Noida
Cc: binutils@sources.redhat.com
Subject: Re: interface prob in gas and ld


"Vineet Sharma, Noida" <vineets@noida.hcltech.com> writes:

>     I have small query consider the following exambple
> 
> ABC:				;Line 1
>         .short 0x88	;	2
> Lp.1:				;	3
>         .short  ABC+9	;	4
> 
> First of all what exactly does it mean, and how is it handled in general
> GAS/Linker?

For this gas should generate a reloc producing a 16 bit relocation
with a symbol of either the section symbol or ABC, and an offset of 9,
plus the section offset if any.

> Secondly:
> Now when my bfd assembler parses Line 4 it passes it to fix_new_exp().

What it passes to fix_new_exp() should just be an O_symbol, though, I
think.

> 	Poblem 1: fix_new_exp() does not handle negative value in fr_offset
> attribute

How does fr_offset figure into this?  That is the offset into the
frag, which as far as I can see is irrelevant here.

> 	How can i pass this "value (exp->X_add_number)"(9 in this case) to
> linker along with the reloc entry.Though
> 	i have defined external_reloc in include/coff/XXX.h containing this
> value attribute.

Normally the 9 would be handled as a reloc addend.  For some targets
an addend is stored in the reloc entry itself.  For some it is stored
in the object file.

Ian


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