On 07/31/2017 01:50 AM, Peter Maydell wrote:
On 28 July 2017 at 22:28, Anatol Pomozov <anatol.pomo...@gmail.com> 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