This is the mail archive of the
mailing list for the binutils project.
Re: [patch 2/7] [gold] Modify dwarf reader to get size and endianness from the object instead of from the parameters.
On Thu, Oct 18, 2012 at 11:59 AM, Cary Coutant <firstname.lastname@example.org> wrote:
> On Thu, Oct 18, 2012 at 11:35 AM, Ian Lance Taylor <email@example.com> wrote:
>> On Thu, Oct 18, 2012 at 11:16 AM, Cary Coutant <firstname.lastname@example.org> wrote:
>>> This patch modifies the dwarf reader to get size and endianness from
>>> the Relobj object instead of from the global parameters (which requires
>>> an initialized target).
>>> * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
>>> from object, not parameters.
>>> (Dwarf_info_reader::parse): Likewise.
>>> * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
>>> (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
>>> (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
>> I don't quite understand how this works. You're changing
>> make_elf_reloc_mapper to take a Relobj. But it is called from
>> Dwarf_info_reader::do_parse passing this->object_, and
>> Dwarf_info_reader::object_ is an Object, not a relobj. It's clearly
>> important that Dwarf_info_reader continue to work for Dynobj as well
>> as Relobj. That's not a major issue as a Dynobj presumably doesn't
>> need a reloc mapper. But it seems that something is missing somewhere
> Dwarf_info_reader::object_ is a Relobj*, not an Object*. It doesn't
> currently support Dynobj objects, but you make a good point that it
> ought to. I can rework that in a future patch.
Hmmm, so it is. Sorry, I must have gotten confused.
> Sized_dwarf_line_info, on the other hand, does support Dynobj objects,
> and takes an Object*, but when it creates a reloc mapper, it creates a
> new Sized_elf_reloc_mapper, which still takes an Object*. I've only
> changed make_elf_reloc_mapper, which now needs to call
> Relobj::elf_size() and Relobj::is_big_endian(), but then passes the
> Relobj* as an Object* when creating the actual reloc mapper.
> I could get around this (and probably will have to in order to support
> Dwarf_info_reader for Dynobj objects) by promoting elf_size() and
> is_big_endian() to the Object class.
> OK with you to defer that for a follow-up patch?
Patch is OK.