[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 11/12] linux-user: Extract load_elf_image from l
From: |
Edgar E. Iglesias |
Subject: |
Re: [Qemu-devel] [PATCH 11/12] linux-user: Extract load_elf_image from load_elf_interp. |
Date: |
Thu, 29 Jul 2010 00:00:18 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, Jul 27, 2010 at 10:25:37AM -0700, Richard Henderson wrote:
> Moving toward a single copy of the elf binary loading code.
> Fill in the details of the loaded image into a struct image_info.
>
> Adjust create_elf_tables to read from such structures instead
> of from a collection of passed arguments. Don't return error
> values from load_elf_interp; always exit(-1) with a message to
> stderr. Collect elf_interpreter handling in load_elf_binary
> to a common spot.
>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> linux-user/elfload.c | 341 ++++++++++++++++++++++++-------------------------
> 1 files changed, 167 insertions(+), 174 deletions(-)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 61167cd..8ff9b6a 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -1079,11 +1079,9 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong
> last_bss, int prot)
> }
>
> static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
> - struct elfhdr * exec,
> - abi_ulong load_addr,
> - abi_ulong load_bias,
> - abi_ulong interp_load_addr,
> - struct image_info *info)
> + struct elfhdr *exec,
> + struct image_info *info,
> + struct image_info *interp_info)
> {
> abi_ulong sp;
> int size;
> @@ -1128,13 +1126,13 @@ static abi_ulong create_elf_tables(abi_ulong p, int
> argc, int envc,
> NEW_AUX_ENT (AT_NULL, 0);
>
> /* There must be exactly DLINFO_ITEMS entries here. */
> - NEW_AUX_ENT(AT_PHDR, (abi_ulong)(load_addr + exec->e_phoff));
> + NEW_AUX_ENT(AT_PHDR, (abi_ulong)(info->load_addr + exec->e_phoff));
> NEW_AUX_ENT(AT_PHENT, (abi_ulong)(sizeof (struct elf_phdr)));
> NEW_AUX_ENT(AT_PHNUM, (abi_ulong)(exec->e_phnum));
> NEW_AUX_ENT(AT_PAGESZ, (abi_ulong)(TARGET_PAGE_SIZE));
> - NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_load_addr));
> + NEW_AUX_ENT(AT_BASE, (abi_ulong)(interp_info->load_addr));
Hi Richard,
I think this part breaks loading of statically linked ELFs (no
interpreter). I beleive Linux sets AT_BASE to zero in those cases.
Cheers
[Qemu-devel] [PATCH 04/12] linux-user: Reduce lseek+reads while loading elf files., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 09/12] linux-user: Put the stack guard page at the top., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 01/12] linux-user: Handle filesz < memsz for any PT_LOAD segment., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 11/12] linux-user: Extract load_elf_image from load_elf_interp., Richard Henderson, 2010/07/27
- Re: [Qemu-devel] [PATCH 11/12] linux-user: Extract load_elf_image from load_elf_interp.,
Edgar E. Iglesias <=
[Qemu-devel] [PATCH 12/12] linux-user: Re-use load_elf_image for the main binary., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 03/12] linux-user: Reindent elfload.c., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 05/12] linux-user: Define ELF_DATA generically., Richard Henderson, 2010/07/27
[Qemu-devel] [PATCH 08/12] linux-user: Improve consistency checking in elf headers., Richard Henderson, 2010/07/27
Re: [Qemu-devel] [PATCH 00/12 v4] Clean up linux-user/elfload.c, Edgar E. Iglesias, 2010/07/29