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 637413858D29 for ; Mon, 15 Mar 2021 08:13:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 637413858D29 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-443-DdPbP94-MKa1NQdzVOZOFA-1; Mon, 15 Mar 2021 04:13:37 -0400 X-MC-Unique: DdPbP94-MKa1NQdzVOZOFA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C984800C78; Mon, 15 Mar 2021 08:13:36 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-163.ams2.redhat.com [10.36.112.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B28BC62A03; Mon, 15 Mar 2021 08:13:35 +0000 (UTC) From: Florian Weimer To: =?utf-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Cc: Fangrui Song via Libc-alpha Subject: Re: [PATCH] Set the retain attribute on _elf_set_element if CC supports [BZ #27492] References: <20210315011050.309228-1-maskray@google.com> <878s6ozxil.fsf@oldenburg.str.redhat.com> Date: Mon, 15 Mar 2021 09:13:41 +0100 In-Reply-To: (=?utf-8?B?IkbEgW5nLXJ1w6wgU8OybmciJ3M=?= message of "Mon, 15 Mar 2021 00:45:23 -0700") Message-ID: <87zgz4ygui.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 08:13:42 -0000 * F=C4=81ng-ru=C3=AC S=C3=B2ng: >> It's probably simpler to define a new macro, like >> ELEMENT_SECTION_ATTRIBUTES, and use that unconditionally, perhaps like >> this? >> >> #ifndef __ASSEMBLER__ >> # if defined (__has_attribute) && __has_attribute (retain) >> # define ELEMENT_SECTION_ATTRIBUTES used, retain >> # else >> # define ELEMENT_SECTION_ATTRIBUTES used >> # endif >> #endif > > `#ifdef __has_attribute` should be fine without #ifndef __ASSEMBLER__ ? ELEMENT_SECTION_ATTRIBUTES is not useful to the assembler, and checking for __ASSEMBLER__ on the outer level makes it simpler to define the no-retain case. >> Have you checked that __has_attribute (retain) is only true on GCC if >> the underlying linker has retain support and the attribute does not >> produce a warning? > > There is a GCC bug. I've reported > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99587 If this isn't fixed in GCC, we'll need a configure check because we want to keep building with -Werror=3Dattributes. Thank,s Florian