public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] ELF: Resolve referenced __start_XXX/__stop_XXX symbols
Date: Sat, 10 Jun 2017 00:08:00 -0000	[thread overview]
Message-ID: <CAMe9rOrO4XF5S59GxcTh7wFgKOdqmzUVd6vb8OxJXaK4yL6JOg@mail.gmail.com> (raw)
In-Reply-To: <20170609220526.GA24413@gmail.com>

On Fri, Jun 9, 2017 at 3:05 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Normally, linker will define __start_XXX/__stop_XXX symbols only for
> orphaned sections.   However, during garbage collection, ELF linker
> marks all sections with references to __start_XXX/__stop_XXX symbols
> as used.  When section XXX isn't an orphaned section, __start_XXX and
> __stop_XXX symbols are left undefined even if section XXX does exist.
> This patch adds SEC_ELF_NEED_START_STOP to section flags to indicate
> that __start_XXX and/or __stop_XXX symbols should be defined and avoid
> defining them as orphaned section.  Instead, ELF linker resolves
> references to __start_XXX/__stop_XXX symbols together with .startof.
> symbol.
>
> OK for master?
>
>
> H.J.
> ---
> bfd/
>
>         PR ld/21562
>         * elflink.c (_bfd_elf_gc_mark_rsec): Set SEC_ELF_NEED_START_STOP
>         if a section references __start_XXX/__stop_XXX symbols.
>         * section (SEC_ELF_NEED_START_STOP): New.
>         * bfd-in2.h: Regenerated.
>
> ld/
>
>         PR ld/21562
>         * ldlang.c (lang_insert_orphan): Don't define __start_XXX nor
>         __stop_XXX symbols for ELF linker if SEC_ELF_NEED_START_STOP is
>         set.
>         (lang_set_startof): Resolve references to __start_XXX and
>         __stop_XXX symbols for ELF linker if SEC_ELF_NEED_START_STOP is
>         set.
>         * testsuite/ld-elf/pr21557.t: New test.
>         * testsuite/ld-elf/pr21557a.d: Likewise.
>         * testsuite/ld-elf/pr21557a.s: Likewise.
>         * testsuite/ld-elf/pr21557b.d: Likewise.
>         * testsuite/ld-elf/pr21557b.s: Likewise.
>         * testsuite/ld-elf/pr21557c.d: Likewise.
>         * testsuite/ld-elf/pr21557d.d: Likewise.
>

Please ignore this patch.  There are more issues:

https://sourceware.org/bugzilla/show_bug.cgi?id=20022
https://sourceware.org/bugzilla/show_bug.cgi?id=19167

H.J.

      reply	other threads:[~2017-06-10  0:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 22:05 H.J. Lu
2017-06-10  0:08 ` H.J. Lu [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=CAMe9rOrO4XF5S59GxcTh7wFgKOdqmzUVd6vb8OxJXaK4yL6JOg@mail.gmail.com \
    --to=hjl.tools@gmail.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).