This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD] mapping input to output sections
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Mon, 13 Aug 2012 09:11:03 -0700
- Subject: Re: [GOLD] mapping input to output sections
- References: <20120813142344.GC3947@bubble.grove.modra.org>
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*>(¶meters->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