From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116035 invoked by alias); 27 Feb 2020 15:03:52 -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 116026 invoked by uid 89); 27 Feb 2020 15:03:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 15:03:49 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 668708137C; Thu, 27 Feb 2020 16:03:47 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l9awzprmfPOP; Thu, 27 Feb 2020 16:03:47 +0100 (CET) Received: from localhost.localdomain (lfbn-tou-1-1471-22.w90-89.abo.wanadoo.fr [90.89.4.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 34BD181354; Thu, 27 Feb 2020 16:03:47 +0100 (CET) Subject: Re: PR24511, nm should not mark symbols in .init_array as "t" To: Alan Modra Cc: binutils@sourceware.org References: <20190504075723.GJ3195@bubble.grove.modra.org> <1b774bd1-68a9-bcf7-795b-e3c545c4faa6@adacore.com> <20200227065610.GG32593@bubble.grove.modra.org> From: KONRAD Frederic Message-ID: <5986aaf4-f81d-ace4-3920-94e3f854b62d@adacore.com> Date: Thu, 27 Feb 2020 15:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200227065610.GG32593@bubble.grove.modra.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00560.txt.bz2 Le 2/27/20 à 7:56 AM, Alan Modra a écrit : > On Wed, Feb 26, 2020 at 06:08:46PM +0100, KONRAD Frederic wrote: >> It seems that this patch has the side effect of marking the symbols in .idata as >> "D" instead of "I" previously. Is that expected? > > I guess so, but also wrong. The patch should not have changed the > order of decode_section_type and coff_section_type calls. I'm going > to commit this to trunk and a patch that just reverses the calls to > the branch, after testing. > > * syms.c (stt): Trim off all but 'e', 'i' and 'p' entries. > (coff_section_type): Adjust comment. > (decode_section_type): Likewise. Call coff_section_type before > decode_section_type. > (bfd_decode_symclass): Use 'c' for common sections other than > the standard one. Thanks for the fast answer, I confirm that the patch below fix the behavior I had. > > diff --git a/bfd/syms.c b/bfd/syms.c > index 8a5c89767a..c1de8ebab1 100644 > --- a/bfd/syms.c > +++ b/bfd/syms.c > @@ -565,30 +565,15 @@ struct section_to_type > char type; > }; > > -/* Map section names to POSIX/BSD single-character symbol types. > +/* Map special section names to POSIX/BSD single-character symbol types. > This table is probably incomplete. It is sorted for convenience of > adding entries. Since it is so short, a linear search is used. */ > static const struct section_to_type stt[] = > { > - {".bss", 'b'}, > - {"code", 't'}, /* MRI .text */ > - {".data", 'd'}, > - {"*DEBUG*", 'N'}, > - {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */ > {".drectve", 'i'}, /* MSVC's .drective section */ > {".edata", 'e'}, /* MSVC's .edata (export) section */ > - {".fini", 't'}, /* ELF fini section */ > {".idata", 'i'}, /* MSVC's .idata (import) section */ > - {".init", 't'}, /* ELF init section */ > {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */ > - {".rdata", 'r'}, /* Read only data. */ > - {".rodata", 'r'}, /* Read only data. */ > - {".sbss", 's'}, /* Small BSS (uninitialized data). */ > - {".scommon", 'c'}, /* Small common. */ > - {".sdata", 'g'}, /* Small initialized data. */ > - {".text", 't'}, > - {"vars", 'd'}, /* MRI .data */ > - {"zerovars", 'b'}, /* MRI .bss */ > {0, 0} > }; > > @@ -596,8 +581,7 @@ static const struct section_to_type stt[] = > section S, or '?' for an unknown COFF section. > > Check for leading strings which match, followed by a number, '.', > - or '$' so .text5 matches the .text entry, but .init_array doesn't > - match the .init entry. */ > + or '$' so .idata5 matches the .idata entry. */ > > static char > coff_section_type (const char *s) > @@ -619,7 +603,7 @@ coff_section_type (const char *s) > SECTION, or '?' for an unknown section. This uses section flags to > identify sections. > > - FIXME These types are unhandled: c, i, e, p. If we handled these also, > + FIXME These types are unhandled: e, i, p. If we handled these also, > we could perhaps obsolete coff_section_type. */ > > static char > @@ -668,7 +652,12 @@ bfd_decode_symclass (asymbol *symbol) > char c; > > if (symbol->section && bfd_is_com_section (symbol->section)) > - return 'C'; > + { > + if (symbol->section == bfd_com_section_ptr) > + return 'C'; > + else > + return 'c'; > + } > if (bfd_is_und_section (symbol->section)) > { > if (symbol->flags & BSF_WEAK) > @@ -705,9 +694,9 @@ bfd_decode_symclass (asymbol *symbol) > c = 'a'; > else if (symbol->section) > { > - c = decode_section_type (symbol->section); > + c = coff_section_type (symbol->section->name); > if (c == '?') > - c = coff_section_type (symbol->section->name); > + c = decode_section_type (symbol->section); > } > else > return '?'; >