This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch] Incremental 9/18: Apply incremental relocations
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 20 Apr 2011 21:40:10 -0700
- Subject: Re: [gold patch] Incremental 9/18: Apply incremental relocations
- References: <BANLkTim4rnXeambJtP+zQWO8OEm0oMEO=Q@mail.gmail.com> <mcr39lm3i31.fsf@google.com> <BANLkTin4gqNzaiJreW82iEkb=WS8jF3zWQ@mail.gmail.com>
Cary Coutant <ccoutant@google.com> writes:
>> I don't see why this should be a target virtual function. ÂIt seems that
>> the above could be templatized <int sh_type, int size, bool big_endian>
>> and work for any target. ÂThat templatized function could go in
>> target-relocs.h and be called from do_apply_incremental_relocs.
>
> Hmmm. It needs to be templatized on typename Relocate as well:
>
> Relocate relocate;
> relocate.relocate(relinfo, this, NULL, -1U, rel, r_type, sym, &symval,
> view + r_offset, address + r_offset, view_size);
>
> Then I'd still need a one-line Target_x86_64::apply_relocation() to
> call the new function while supplying Target_x86_64::Relocate as the
> template parameter, wouldn't I? (It would look just like
> Target_x86_64::relocate_section.) I'd be able to abstract a dozen
> lines or so out of it and into generic code in target-reloc.h, but I
> don't see how to avoid adding the new target virtual function.
>
> I was looking for a way to coalesce relocate_section and
> apply_relocation, but that direction looked intrusive and involved
> touching all targets at the same time.
Yes, if it needs Relocate then you will need a small helper function in
each target, along the lines of the existing relocate_for_relocatable
methods. That still seems a bit better.
Ian