public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Faraz Shahbazker <faraz.shahbazker@imgtec.com>
To: "H.J. Lu" <hjl.tools@gmail.com>, <binutils@sourceware.org>
Subject: Re: [committed, PATCH] Always create dynsym section with dynamic sections
Date: Fri, 22 Apr 2016 17:04:00 -0000	[thread overview]
Message-ID: <571A59A8.4000700@imgtec.com> (raw)
In-Reply-To: <20160223003208.GA30022@intel.com>

Hi,

This is breaking a gc-sections test-case for MIPS. MIPS at least, uses the
elf_link_hash_table to track symbols even for static executables.
The renumbering violates assertions about how MIPS expects the table to look.

We could change the assert conditions, but I think thank since the NULL entry
originated when the table was initialized, it should exist just
the same after renumbering. If there is an additional case
(dynamic_sections_created), it should be OR'd to the pre-existing condition.

Thanks,
Faraz Shahbazker

On 02/22/2016 04:32 PM, H.J. Lu wrote:
> We should always create the dynsym section, even if it is empty, with
> dynamic sections.
> 
> 	* elflink.c (_bfd_elf_link_renumber_dynsyms): Always create the
> 	dynsym section, even if it is empty, with dynamic sections.
> ---
>  bfd/ChangeLog | 5 +++++
>  bfd/elflink.c | 6 +++---
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/bfd/ChangeLog b/bfd/ChangeLog
> index dd1a308..1e0f6a1 100644
> --- a/bfd/ChangeLog
> +++ b/bfd/ChangeLog
> @@ -1,5 +1,10 @@
>  2016-02-22  H.J. Lu  <hongjiu.lu@intel.com>
>  
> +	* elflink.c (_bfd_elf_link_renumber_dynsyms): Always create the
> +	dynsym section, even if it is empty, with dynamic sections.
> +
> +2016-02-22  H.J. Lu  <hongjiu.lu@intel.com>
> +
>  	* syms.c: Remove BSF_COMMON from comments.
>  	* bfd-in2.h: Regenerated.
>  
> diff --git a/bfd/elflink.c b/bfd/elflink.c
> index c7672ed..89a6dea 100644
> --- a/bfd/elflink.c
> +++ b/bfd/elflink.c
> @@ -875,9 +875,9 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
>  			  &dynsymcount);
>  
>    /* There is an unused NULL entry at the head of the table which
> -     we must account for in our count.  Unless there weren't any
> -     symbols, which means we'll have no table at all.  */
> -  if (dynsymcount != 0)
> +     we must account for in our count.  We always create the dynsym
> +     section, even if it is empty, with dynamic sections.  */
> +  if (elf_hash_table (info)->dynamic_sections_created)
>      ++dynsymcount;
>  
>    elf_hash_table (info)->dynsymcount = dynsymcount;
> 

  reply	other threads:[~2016-04-22 17:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23  0:33 H.J. Lu
2016-04-22 17:04 ` Faraz Shahbazker [this message]
2016-04-22 18:11   ` H.J. Lu
2016-04-22 18:56     ` Faraz Shahbazker
2016-04-22 19:29       ` H.J. Lu
2016-04-22 21:49         ` Faraz Shahbazker
2016-04-22 22:57           ` H.J. Lu
2016-04-22 23:09             ` Faraz Shahbazker
2016-04-22 23:24           ` H.J. Lu
2016-04-22 23:25             ` H.J. Lu
2016-04-23  1:38             ` Faraz Shahbazker
2016-04-23  2:05               ` H.J. Lu
2016-04-23  2:32                 ` Faraz Shahbazker
2016-04-23 12:27                   ` H.J. Lu
2016-04-23 15:25                     ` Faraz Shahbazker
2016-04-23 15:36                       ` H.J. Lu
2016-04-23 19:26                         ` Faraz Shahbazker
2016-04-24  1:43                           ` H.J. Lu
2016-04-25  2:18                             ` Faraz Shahbazker
2016-04-25 12:47                               ` H.J. Lu
2016-04-25 13:41                                 ` Alan Modra
2016-04-25 16:03                                   ` H.J. Lu
2016-04-26  2:08                                     ` 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=571A59A8.4000700@imgtec.com \
    --to=faraz.shahbazker@imgtec.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /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).