public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Kevin <ancafe@ymail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: gold linker: Access section start & end address w/o using a linker script
Date: Sun, 02 Feb 2014 04:59:00 -0000	[thread overview]
Message-ID: <CAKOQZ8zATC+6bZHq7YWJsCOWGjvPTss1_yaKgxauQZkUJVxZhQ@mail.gmail.com> (raw)
In-Reply-To: <loom.20140202T021423-830@post.gmane.org>

On Sat, Feb 1, 2014 at 5:14 PM, Kevin <ancafe@ymail.com> wrote:
> Ian Lance Taylor <iant <at> google.com> writes:
>
>>
>> On Mon, Apr 22, 2013 at 4:39 AM, Raphael Zulliger
>  <zulli73 <at> gmail.com> wrote:
>> >
>> > Is there a chance to enhance gold to better support such use cases?
> Or is that out-of focus for gold? I'm not
>> familiar with linking internals, but I think that providing additional
> start/end address symbols for> section names starting with a '.' wouldn't
>  be that tricky to be added, right?
>>
>> I'm fine with it.  Look for uses of is_cident in the gold source code.
>>
>> Ian
>>
>>
>
>
> Thanks for the tip Ian.  In that routine one could easily ignore a
> leading ".".  In abstract one might want to handle "." inside the
> name, or translate characters (such as "$") allowed in ELF symbols but
> not in C (or in some other language), whereby a simple concept starts
> to get out of hand; thus:
>
> - Could we assume that standard ELF section names can be mapped to C
> identifiers just by mapping the leading "."?
>
> - What mapping would you suggest?  If the leading "." is dropped then
> the resulting would collide with a common name (text or data in
> particular).  This problem seems unsolvable in general, so should one
> make an effort at all (mapping "." to a single underscore for
> example)?

The linker doesn't define symbols that are the section names: it adds
"__start_" and "__stop_" before them.  I think it would be fine to
just turn a leading '.' into a '_' for this purpose.

Ian

      reply	other threads:[~2014-02-02  4:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 16:04 Raphael Zulliger
2013-04-21 17:42 ` Ian Lance Taylor
2013-04-21 19:27   ` Raphael Zulliger
2013-04-21 19:42     ` Ian Lance Taylor
2013-04-22 11:39       ` Raphael Zulliger
2013-04-22 17:51         ` Ian Lance Taylor
2013-05-12 12:08           ` Raphael Zulliger
2014-02-02  1:20           ` Kevin
2014-02-02  4:59             ` Ian Lance Taylor [this message]

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=CAKOQZ8zATC+6bZHq7YWJsCOWGjvPTss1_yaKgxauQZkUJVxZhQ@mail.gmail.com \
    --to=iant@google.com \
    --cc=ancafe@ymail.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).