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 4EB2F393C84E for ; Tue, 15 Sep 2020 12:55:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4EB2F393C84E 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-247-qXQIFmVXMbK2zKyorfwbhQ-1; Tue, 15 Sep 2020 08:55:13 -0400 X-MC-Unique: qXQIFmVXMbK2zKyorfwbhQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1231D1017DC3; Tue, 15 Sep 2020 12:55:12 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-142.rdu2.redhat.com [10.10.113.142]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9079519D6C; Tue, 15 Sep 2020 12:55:07 +0000 (UTC) From: Florian Weimer To: Carlos O'Donell Cc: Jozef Lawrynowicz , gnu-gabi@sourceware.org Subject: Re: [RFC] SHF_GNU_RETAIN ELF Section Flag References: <20200915120632.bs36vkrbvmsoyvnu@jozef-acer-manjaro> <877dsvjl71.fsf@oldenburg2.str.redhat.com> <20200915123155.xpow3oxpzycsq3ie@jozef-acer-manjaro> <87v9gfi5cf.fsf@oldenburg2.str.redhat.com> Date: Tue, 15 Sep 2020 14:55:05 +0200 In-Reply-To: (Carlos O'Donell's message of "Tue, 15 Sep 2020 08:50:00 -0400") Message-ID: <87mu1ri4ie.fsf@oldenburg2.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.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, 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: gnu-gabi@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnu-gabi mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2020 12:55:16 -0000 * Carlos O'Donell: > On 9/15/20 8:37 AM, Florian Weimer via Gnu-gabi wrote: >> * Jozef Lawrynowicz: >> >>> On Tue, Sep 15, 2020 at 02:09:22PM +0200, Florian Weimer wrote: >>>> * Jozef Lawrynowicz: >>>> >>>>> I'd like to propose a new ELF section flag, SHF_GNU_RETAIN, for addition >>>>> to the GNU gABI. >>>>> >>>>> This flag instructs the linker to "retain" the section in the output >>>>> file, even if garbage collection would remove it because it appears >>>>> unused. >>>> >>>> How does this flag interaction with libraries (.a files)? >>> >>> If a section in a library has SHF_GNU_RETAIN set, and that library gets >>> searched by the linker for some undefined symbol, then the >>> SHF_GNU_RETAIN section will also be pulled into the program, and >>> retained in the linked output file. >> >> Sorry, that's not quite what I meant. What happens if the .o file with >> SHF_GNU_RETAIN in an .a library is not otherwise referenced and thus >> never loaded by the link editor? How would the link editor realize that >> it is even there? > > Why would it be loaded? Hypothetically: Because the ranlib section tells the link editor to load it (so more specification updates are needed). > Why does the link editor need to detect the presence of such a file? To make SHF_GNU_RETAIN work with libraries. I think without that, the same effect can be had today with SHF_GROUP/SHT_GROUP, perhaps with an assembler-only change to implement the .retain pseudo. Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill