From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by server2.sourceware.org (Postfix) with ESMTPS id DB7233949F1B for ; Mon, 9 Mar 2020 13:44:32 +0000 (GMT) Received: by mail-pf1-x443.google.com with SMTP id i13so4846271pfe.3 for ; Mon, 09 Mar 2020 06:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TXNyGkrBSX2D2thBNpKnCB4U7GfeOHS0y8wvpuvD6lQ=; b=RmtQmEKzR6REeVTZ6Dl9SF57KguI3APxm+osHokqjHCAC+oWhqi4USsE10IuV3kj8D 7UNreoOShQ8jCjCcdICZRPfX1TYSUPEOaMD2AG/hr21aPJAOXdtHPoslQE8TiPLqEBBK ARucm3yOXcweiiPnE4QJbxjV7yrmWaijR9ihP1KlqcvTt40Y4QLKx87m16BvRdQxGTbG dUPOxCRujXdpNLXE8vPKMm6AIXq4vF/1nbmlF2HSAJJh8sN6UK5wgFZbdq9erRny3BLF nAJyWfilnB02sTRXzg0/eP/nXaLO2WCVFzOnXsXgALqV5I4t0AQD577iupgv77O9UTy+ y3eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TXNyGkrBSX2D2thBNpKnCB4U7GfeOHS0y8wvpuvD6lQ=; b=AqANu4u/mB3Uz0gnMq7gaSD9AF1FDXrltvSYq6PsyROno0MJ1aDocHYoTEkUu5L4N4 W1SrZfGxqwnMHY5TIlxhqwHyTBhIVEh1cOI947/8jIPtJ+iwnr2lFquWV5nhEREYXDGj DFBjZzCRwshDlfLyxymCh7LY8ep63s1XEAI6REgSwFPnHJ+WDRT7FMlMJeBNm5VR3dpf ryl3Jifg7AAsKRdxivhOoIfnuo7PPcNfAhDdkxTVLR8AFEcwgWEhVp4/h6fBhXVz7T+q KmZArdczlt0TcEypzMiCEt5NGvioMeD9O4GxOaE6onuufI3AZipSaBZtxBSJzABGmvTT D9ag== X-Gm-Message-State: ANhLgQ3/HPpThu4r1+C0li9n4mrx+SUmVCNj3QJsSuOGj4UyKnpwtUDu IEHU9wCzIrHkcpi/8Hvcx1M= X-Google-Smtp-Source: ADFU+vst7f9zKKZz8Kc6JEELBHUWCo18OE2BRo5HOJUsA+NIxHKgfT2ykWjZTTQkKI9XMxUBZ8o95A== X-Received: by 2002:aa7:8502:: with SMTP id v2mr16199178pfn.232.1583761472094; Mon, 09 Mar 2020 06:44:32 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:c886:8795:5072:fe68]) by smtp.gmail.com with ESMTPSA id y200sm11605314pfb.138.2020.03.09.06.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2020 06:44:31 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D9985812EF; Tue, 10 Mar 2020 00:14:27 +1030 (ACDT) Date: Tue, 10 Mar 2020 00:14:27 +1030 From: Alan Modra To: Kaylee Blake Cc: binutils@sourceware.org Subject: Re: RFC: [PATCH] ELF: Don't require section header on ELF objects Message-ID: <20200309134427.GO5384@bubble.grove.modra.org> References: <20200308175947.GA911529@gmail.com> <87y2sac5er.fsf@mid.deneb.enyo.de> <79bc289f-9202-9aff-61c3-92c7190d2f7d@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <79bc289f-9202-9aff-61c3-92c7190d2f7d@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2020 13:44:34 -0000 On Mon, Mar 09, 2020 at 11:24:44PM +1030, Kaylee Blake wrote: > On 9/3/20 6:43 pm, Florian Weimer wrote: > > In my opinion, it should NOT be possible to link against objects > > without section headers. Lack of section headers clearly marks the > > object as a run-time only object. This is useful if you want to > > prevent developers to create DT_NEEDED dependencies on internal > > libraries, for example. I agree. > For shared objects without debug symbols, the section header table is > ~2kB on average of redundant data. I'm also not a fan of the > inconsistency of having shared libraries that the dynamic linker is > perfectly happy to load, but ld can't link against, especially since > this seems like an oversight rather than an intended design decision. The ELF spec designed things that way. See figure 4.1 which I'll try to represent in text. Figure 4-1: Object File Format |----------------------| |----------------------| | ELF Header | | ELF Header | |----------------------| |----------------------| | Program header table | | Program header table | | optional | | required | |----------------------| |----------------------| | Section 1 | | Segment 1 | |----------------------| |----------------------| | ... | | Segment 2 | |----------------------| |----------------------| | Section n | | Segment 3 | |----------------------| |----------------------| | ... | | ... | |----------------------| |----------------------| | Section header table | | Section header table | | required | | optional | |----------------------| |----------------------| Linking View Execution View -- Alan Modra Australia Development Lab, IBM