From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dd2OR-0001RH-HB for qemu-devel@nongnu.org; Wed, 02 Aug 2017 18:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dd2OO-0007Ar-BE for qemu-devel@nongnu.org; Wed, 02 Aug 2017 18:45:31 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:34764) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dd2OO-0007AT-3z for qemu-devel@nongnu.org; Wed, 02 Aug 2017 18:45:28 -0400 Received: by mail-pg0-x244.google.com with SMTP id y192so7768637pgd.1 for ; Wed, 02 Aug 2017 15:45:27 -0700 (PDT) Sender: Richard Henderson References: <20170730214231.GC16400@localhost.localdomain> From: Richard Henderson Message-ID: <3270e67a-7ebc-6e2e-daeb-bb434dcd781b@twiddle.net> Date: Wed, 2 Aug 2017 15:45:24 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] How to make ELF headers/symbol sections available for multiboot? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anatol Pomozov Cc: Eduardo Habkost , qemu-devel@nongnu.org, Paolo Bonzini , Alexander Graf , Kevin Wolf On 08/02/2017 03:00 PM, Anatol Pomozov wrote: > What ELF specification says about it? Does it tell a loader to load > only PT_LOAD segments? Yes. In https://refspecs.linuxfoundation.org/ there is a link to "System V ABI Edition 4.1", which AFAIK is the latest version of the ELF "gABI" spec. Section 5 describes program loading. > Here is my current linker script: > > ====================== > ENTRY(start) > > SECTIONS { > . = 1M; > > .text : { > KEEP(*(.data.multiboot)) > *(.text .text*) > } > > .rodata : { > *(.rodata .rodata*) > } > > .data : { > *(.data .data.*) > } > > .bss : { > __bss_start = .; > *(.bss .bss*) > . = ALIGN(8); > __bss_end = .; > } > } > ======================= In the gnu ld manual, read about the PHDRS command, which describes all of the ways you can manipulate the program header table. Re-reading that now, I see FILEHDR and PHDR as keywords that can be used to induce those portions of the file into the loadable segment, but I do not see anything that could be used to load the section header. You could force the symbol table and string table to be loaded, by referencing their sections, but that won't affect the section header itself. r~