qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] How to make ELF headers/symbol sections available for m


From: Richard Henderson
Subject: Re: [Qemu-devel] How to make ELF headers/symbol sections available for multiboot?
Date: Mon, 31 Jul 2017 06:04:59 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/31/2017 01:50 AM, Peter Maydell wrote:
On 28 July 2017 at 22:28, Anatol Pomozov <address@hidden> wrote:
So I need to perform 2 things:

  - Load ELF section headers into target's memory. I did by appending
additional space to mbs.mb_buf and copying header data. Is it the best
way to do?

  - Next I need to load other ELF sections such as symbols (e.g.
.shstrtab) that store section names. What is the best way to do in
multiboo.c code? Would it make sense to load all ELF sections?

This seems a bit odd, because in general an ELF loader should
not care at all about sections and the section header. It
should only need to look at the program header, which defines
which segments to load. If the guest binary needs some things
to be loaded then I would expect that it is the job of the linker
that produces the guest binary to make sure those things are in
segments which are marked as LOAD.

Agreed. If you're touching ELF sections, then I think you're missing the point of the ELF program header entirely. If you write your own linker script, you have complete control of the ELF PHDR, and can arrange for anything you like to be loaded.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]