This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: relative GOT relocs in gold
- From: "Cary Coutant" <ccoutant at google dot com>
- To: "David Miller" <davem at davemloft dot net>
- Cc: binutils at sourceware dot org, iant at google dot com
- Date: Fri, 4 Apr 2008 13:44:21 -0700
- Subject: Re: relative GOT relocs in gold
- References: <20080404.122246.174791161.davem@davemloft.net>
> Otherwise, my initial suggestion is that perhaps we should add a way
> to point GOT entries at relocations, or parts of a relocation, and add
> a new GOT type for that and assosciated ->write() methods.
>
> Then I could register the GOT entry with ->add_local_with_rela()
> or similar, and tell it "and BTW, put there gsym->value() in
> this relocation addend over here instead of the GOT slot."
>
> Alternatively, we could have a target fixup pass that can walk over
> the dynamic relocs, and for this case the sparc target would
> transfer the GOT slot values into the associated R_SPARC_RELATIVE
> reloc addends, and clear the GOT slot.
If I understand correctly, you just need to call got->add_constant()
to create the GOT entry without an attached symbol (so that its slot
is initialized to zero). Then, separately, you can attach the
R_SPARC_RELATIVE relocation to it with rela_dyn->add_local_relative().
Output_reloc::write() will put the symbol value into the addend field
when the relocation is created with add_local_relative().
Forgive me if I'm misunderstanding something.
-cary