From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80054 invoked by alias); 23 Apr 2016 01:38:07 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 80026 invoked by uid 89); 23 Apr 2016 01:38:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=faraz.shahbazker@imgtec.com, farazshahbazkerimgteccom, FarazShahbazkerimgteccom, Faraz.Shahbazker@imgtec.com X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Apr 2016 01:37:55 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Websense Email with ESMTPS id 32F4CF7095C6A; Sat, 23 Apr 2016 02:37:52 +0100 (IST) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by HHMAIL01.hh.imgtec.org (10.100.10.19) with Microsoft SMTP Server (TLS) id 14.3.266.1; Sat, 23 Apr 2016 02:37:53 +0100 Received: from ubuntu-frs.ba.imgtec.org (10.20.2.68) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 22 Apr 2016 18:37:50 -0700 Message-ID: <571AD1EE.1040005@imgtec.com> Date: Sat, 23 Apr 2016 01:38:00 -0000 From: Faraz Shahbazker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "H.J. Lu" CC: Binutils Subject: Re: [committed, PATCH] Always create dynsym section with dynamic sections References: <20160223003208.GA30022@intel.com> <571A59A8.4000700@imgtec.com> <571A73BE.4000709@imgtec.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00387.txt.bz2 On 04/22/16 16:24, H.J. Lu wrote: > On Fri, Apr 22, 2016 at 2:49 PM, Faraz Shahbazker > wrote: >> On 04/22/2016 12:28 PM, H.J. Lu wrote: >>> On Fri, Apr 22, 2016 at 11:55 AM, Faraz Shahbazker >>>> + if (dynsymcount != 0 || elf_hash_table (info)->dynamic_sections_created) >>>> + ++dynsymcount; >>> >>> Are you saying dynamic_sections_created is 0 for MIPS here >>> and will become 1 later? >> >> No, it will remain 0. The link is static, but the hash_table is still used to >> record global symbols that have GOT relocations against them. Ofc, this >> hash_table does not result in creation of a dynsym section, because well, >> dynamic_sections_created is 0. >> >> Check the list of callers to bfd_elf_link_record_dynamic_symbol(), a number of >> architectures use the link_hash_table in situations where it is not clear whether it is >> being used to track dynamic symbols for a dynamic executable, as it is for x86. >> > > So MIPS doesn't have dynamic symbols in this case. It just borrows > dynsymcount for different purpose. Is this correct? Not quite! MIPS is expecting dynsymcount to count the number of symbols that would have gone in to the .dynsym, even for a static executable. That way parts of the arch-specific code can remain agnostic to the static/dynamic nature of the link. It may not be used exactly as documented, but its not being used for what one would call a different purpose. All we need is for handling of dynsymcount when renumbering to be consistent with its initialization. If the initial increment for a NULL symbol was not gated by dynamic_sections_created, then the increment when renumbering should also not. If the increment when renumbering has to be gated by dynamic_sections_created, then the initial increment must also be so. Regards, Faraz Shahbazker