[GOLD] mapping input to output sections
Ian Lance Taylor
iant@google.com
Mon Aug 13 18:11:00 GMT 2012
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
More information about the Binutils
mailing list