This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GOLD] Add make_elf_object target hooks.
"Doug Kwan (éæå)" <dougkwan@google.com> writes:
> 2009/8/18 Ian Lance Taylor <iant@google.com>:
>
>>> + Â Â Âobj->setup(ehdr);
>>
>> It no longer makes sense for Object::setup to take an ehdr parameter.
>> It should take a target parameter, and avoid looking up the target
>> again.
>
> Agree. I suppose all objects have targets and their targets do not
> change. Should setup() be simply part of the constructor?
I originally left it out because it can fail, and it's weird to have a
constructor fail. I guess I'd prefer to keep it separate for now.
>> Interesting problem. ÂI wonder if there is anything we can do to make
>> that easier to write.
>
> Unfortunately, virtual functions cannot be templated. That's why I
> mentioned changing the paratmeter ehdr back to a raw unsigned char
> pointer. If we do so, we only have one virtual function instead of
> four. The downside of doing that is that callers must ensure that the
> pointer points to something valid. Passing an
> Elfcpp::Ehdr<size,big_endian> object enforces that automatically.
Yeah, I guess the way you did it is fine.
Ian