From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71634 invoked by alias); 27 Sep 2018 10:35:46 -0000 Mailing-List: contact gnu-gabi-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: gnu-gabi-owner@sourceware.org Received: (qmail 71588 invoked by uid 89); 27 Sep 2018 10:35:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1513, H*r:1002, H*i:sk:87pnwzu, H*f:sk:87pnwzu X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: port70.net Received: from port70.net (HELO port70.net) (81.7.13.123) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Sep 2018 10:35:43 +0000 Received: by port70.net (Postfix, from userid 1002) id EA607ABEC0BD; Thu, 27 Sep 2018 12:35:40 +0200 (CEST) Date: Mon, 01 Jan 2018 00:00:00 -0000 From: Szabolcs Nagy To: Florian Weimer Cc: Jan Beulich , "H.J. Lu" , Rich Felker , binutils@sourceware.org, gnu-gabi@sourceware.org Subject: Re: RFC: Add SHT_GNU_PHDRS Message-ID: <20180927103539.GJ10209@port70.net> References: <87tvmbv8hp.fsf@oldenburg.str.redhat.com> <5BAC7D6802000078001EC6D1@prv1-mh.provo.novell.com> <87pnwzuz8r.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pnwzuz8r.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2018-q3/txt/msg00013.txt.bz2 * Florian Weimer [2018-09-27 10:21:40 +0200]: > * Jan Beulich: > >>>> On 27.09.18 at 07:01, wrote: > >> * H. J. Lu: > >> > >>> I am proposing > >>> > >>> #define SHT_GNU_PHDRS 0x6ffffff4 /* Dummy section for program header */ > >>> > >>> This is a special read-only SHF_ALLOC zero-size data section. It is the > >>> first output section, which will force a data PT_LOAD segment with program > >>> header before the code-only PT_LOAD segment, > >> > >> Is it actually a requirement in the ELF specification that all bits > >> loaded via segments are covered by sections as well? > > > > Hardly, because the presence of a section table isn't required > > in the first place in an executable (iirc). > > I think so too, and that is why I don't understand this section hack is > needed. if there is no read-only alloc section then the program headers are currently not part of a load segment. https://sourceware.org/bugzilla/show_bug.cgi?id=23428 an alloc .phdr section covering the program headers solves this problem. if sections are not required for segments then simply the linker should ensure that there is always a load segment covering the program headers, possibly without containing any sections, however elf says "An object file segment contains one or more sections". i don't understand why a zero-size section is enough, what if phdr > pagesize? will that get covered by the load segment that is created for the zero-size section?