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] mapping input to output sections


On Mon, Aug 13, 2012 at 7:23 AM, Alan Modra <amodra@gmail.com> wrote:
> Powerpc64 needs to map input .toc and .got sections to the output .got
> section, as the following accomplishes with GNU ld:
>   .got          : ALIGN(8) { *(.got .toc) }
> I gather gold is supposed to operate without a linker script.  Is is
> reasonable to move section_name_mapping[], section_name_mapping_count,
> output_section_name() and match_file_name() from layout.cc to
> target.cc so output_section_name() can be overridden in class
> Target_powerpc?  Or is there a better way to do this sort of trick?

This is a case where I think I would prefer to see a more targeted
target hook.  Suppose we have Layout::output_section_name call a
target hook first.  If the hook returns non-NULL,
Layout::output_section can return that.  Otherwise it can apply the
default.


> +    {
> +      Target* target = const_cast<Target*>(&parameters->target());
> +      name = target->output_section_name(relobj, name, &len);

Seems like the Target::output_section_name method, however it is
written, should be const, and this should
    parameters->target().output_section_name(...)
There should be no need for a const_cast here.

Ian


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