From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id B77413851425 for ; Wed, 16 Dec 2020 00:44:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B77413851425 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-89-8yE6uRbiPKmJByuFG1Kduw-1; Tue, 15 Dec 2020 19:44:03 -0500 X-MC-Unique: 8yE6uRbiPKmJByuFG1Kduw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 592DE800D62; Wed, 16 Dec 2020 00:44:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-161.phx2.redhat.com [10.3.112.161]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DE111E5; Wed, 16 Dec 2020 00:44:01 +0000 (UTC) Subject: Re: V4 [PATCH 1/3] Switch to a new section if the SECTION_RETAIN bit doesn't match To: "H.J. Lu" , gcc-patches@gcc.gnu.org References: <20201215173031.3242097-1-hjl.tools@gmail.com> <20201215173031.3242097-2-hjl.tools@gmail.com> From: Jeff Law Message-ID: <2b92f4e4-a0d1-0269-02d8-328ce76d17d3@redhat.com> Date: Tue, 15 Dec 2020 17:44:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201215173031.3242097-2-hjl.tools@gmail.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Dec 2020 00:44:07 -0000 On 12/15/20 10:30 AM, H.J. Lu wrote: > When definitions marked with used attribute and unmarked definitions are > placed in the section with the same name, switch to a new section if the > SECTION_RETAIN bit doesn't match. > > gcc/ > > PR target/98146 > * output.h (switch_to_section): Add a tree argument, default to > nullptr. > * varasm.c (get_section): If the SECTION_RETAIN bit doesn't match, > return and switch to a new section later. > (assemble_start_function): Pass decl to switch_to_section. > (assemble_variable): Likewise. > (switch_to_section): If the SECTION_RETAIN bit doesn't match, > switch to a new section. > > gcc/testsuite/ > > PR target/98146 > * c-c++-common/attr-used-5.c: New test. > * c-c++-common/attr-used-6.c: Likewise. > * c-c++-common/attr-used-7.c: Likewise. > * c-c++-common/attr-used-8.c: Likewise. > * c-c++-common/attr-used-9.c: Likewise. So as an additional follow-up could you add to the get_section comment the special handling were add SECTION_WRITE and SECTION_RELRO to the flags.  That's not something I would expect that function to do either.  Consider that comment addition pre-approved. Jeff