This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH] gold: remove unused methods in Output_data_got_powerpc
- From: Roland McGrath <mcgrathr at google dot com>
- To: Cary Coutant <ccoutant at google dot com>, Roland McGrath <mcgrathr at google dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 11 Oct 2013 16:22:30 -0700
- Subject: Re: [PATCH] gold: remove unused methods in Output_data_got_powerpc
- Authentication-results: sourceware.org; auth=none
- References: <CAB=4xhrDkG1OZnJrG1eOA4NRogvo46wta9Q6_WC6LeF1R5_1Gg at mail dot gmail dot com> <CAHACq4p_PEf5R3RTA3ZFD+2rX339084gV8ATMMN3WYk=5CSrOA at mail dot gmail dot com> <20131011225626 dot GB20756 at bubble dot grove dot modra dot org> <20131011231423 dot GC20756 at bubble dot grove dot modra dot org>
On Fri, Oct 11, 2013 at 4:14 PM, Alan Modra <firstname.lastname@example.org> wrote:
> No, wait a minute. I do want those functions, but probably
> misunderstood C++ rules so they aren't effective. I need to somehow
> arrange that Output_data_got_powerpc::reserve_ent() is called before
> Output_data_got adds anything to its entries_ vector, because the
> powerpc got header can sit somewhere in the middle of the GOT. What's
> the best way to accomplish that?
You need to change those in Output_data_got (the base class) to be virtual.
Then you can override them in Output_data_got_powerpc and use
Output_data_got<size, big_endian>::add_got_entry to call the superclass
method after doing what you need to do first. Also note that you need to
name the argument type as Output_data_got<size, big_endian>::Got_entry.
You'll probably want to do typedef Output_data_got<size, big_endian> Base;
or suchlike in Output_data_got_powerpc so you can reduce the amount of
typing on the lhs of each :: there.
And, of course, add a test case that notices the failure mode of missing
the reserve_ent call so you can tell whether you got it right.