This is the mail archive of the binutils@sourceware.org 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: [gold patch] Incremental 9/18: Apply incremental relocations


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


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