public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: binutils@sourceware.org
Subject: Re: [GOLD] mapping input to output sections
Date: Mon, 13 Aug 2012 18:11:00 -0000	[thread overview]
Message-ID: <CAKOQZ8wWdpq2_zkUGnPhjU9xLQQ=wfNtGds=2-Cbmy0bzSQkbw@mail.gmail.com> (raw)
In-Reply-To: <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*>(&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

  reply	other threads:[~2012-08-13 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-13 14:43 Alan Modra
2012-08-13 18:11 ` Ian Lance Taylor [this message]
2012-08-14  2:20   ` Alan Modra
2012-08-14  3:30     ` Ian Lance Taylor
2012-08-14  4:40       ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKOQZ8wWdpq2_zkUGnPhjU9xLQQ=wfNtGds=2-Cbmy0bzSQkbw@mail.gmail.com' \
    --to=iant@google.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).