This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: interface prob in gas and ld
"Vineet Sharma, Noida" <vineets@noida.hcltech.com> writes:
> >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?
Normally gas will call bfd_install_relocation() which sets up an
arelent structure. Then when the BFD is closed, the BFD library will
call coff_swap_reloc_out() to convert the arelent to an external_reloc
structure. That function is defined in coffswap.h with many
parameters. You probably need to define SWAP_OUT_RELOC_OFFSET in your
bfd/coff-*.c file.
Ian