From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6037 invoked by alias); 7 Jun 2011 13:11:24 -0000 Received: (qmail 5787 invoked by uid 22791); 7 Jun 2011 13:11:23 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 07 Jun 2011 13:11:05 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p57DAvVb000449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Jun 2011 09:10:57 -0400 Received: from [10.36.8.57] (vpn2-8-57.ams2.redhat.com [10.36.8.57]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p57DAuNt018824; Tue, 7 Jun 2011 09:10:56 -0400 Message-ID: <4DEE2390.2030309@redhat.com> Date: Tue, 07 Jun 2011 13:11:00 -0000 From: Nick Clifton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: Catherine Moore CC: binutils@sourceware.org Subject: Re: PING Re: [RFA] Linker script extension SECTION_FLAGS References: <4DD41EB0.6040300@codesourcery.com> <4DDC37D2.3030700@codesourcery.com> <4DED4E64.6080507@codesourcery.com> In-Reply-To: <4DED4E64.6080507@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 X-SW-Source: 2011-06/txt/msg00068.txt.bz2 Hi Catherine, > Hi, Do any of the maintainers have time to review this patch? Did you see Tristan's follow up comments on your patch ? http://sources.redhat.com/ml/binutils/2011-05/msg00350.html Some of the comments in the code need clarification: + /* Remove sections with incorrect flags. */ + void (*_bfd_lookup_section_flags) (struct bfd_link_info *, + struct flag_info *); I think that you mean "Sets the bitmasks of allowed and disallowed section flags" or something like that. It does not actually remove sections at all... + /* This function, if defined, is called to the section flag hex value. */ + void (*elf_backend_lookup_section_flags_hook) The comment here should presumably be: "This function, if defined, is called to convert target specific section flags names into hex values." There appears to be a bug in the change to lang_add_section(): + if (output->sectflags->only_with_flags != 0 + && (output->sectflags->only_with_flags & section->flags) == 0) + return; I think that this will accept any section that contains any combination of any of the required flags, rather than only those sections that contain all of the required flags. Ie, I think that the test should be: + if (output->sectflags->only_with_flags != 0 + && (output->sectflags->only_with_flags & section->flags) != output->sectflags->only_with_flags) + return; Either this, or the documentation of how INPUT_SECTION_FLAGS works is wrong. Following on from this, what would a linker script writer do if they wanted to include multiple, different sets of input section flags in their output section. As I read the current the proposed documentation this cannot be done. I suppose that you could add a comma separated syntax, ala: INPUT_SECTON_FLAGS (SHF_WRITE & SHF_ALLOC, SHF_WRITE & SHF_STRINGS) But it might be better to go with Ian Lance Taylor's suggestion of putting the constraint *inside* the output section description. Ie something like this: .text : { SECTION_FLAGS(SHF_WRITE & SHF_STRINGS, *(.text)) SECTION_FLAGS(SHF_WRITE & SHF_ALLOC, *(.text)) } In the new bfd_elf_lookup_sections_flags() function there is an awful lot of repeated, almost identical code: + if (!strcmp (tf->name, "SHF_WRITE")) + { + if (tf->with == with_flags) + with_hex |= SHF_WRITE; + else if (tf->with == without_flags) + without_hex |= SHF_WRITE; + } It would be much cleaner to use an array of section names and flags and iterate through it. Some of the fields in the flag_info structure ought be changed: +/* Section flag info. */ +struct flag_info +{ + unsigned only_with_flags; + unsigned not_with_flags; + struct flag_info_list *flag_list; + int done; +}; The only_with_flags and not_with_flags fields should be of the type "flagword". The "done" field should be a bfd_boolean and IMHO should be renamed to a slightly more descriptive term such as "flags_initialised". Cheers Nick