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 <r...@twiddle.net> > --- > 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