Subject: Re: loadelf_32.c: code review request: was=>Re: ia64 unwind section: Loader implementation
To: None <cherry@sdf.lonestar.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 04/04/2006 13:45:22
On Apr 1, 2006, at 11:13 AM, Cherry G. Mathew wrote:
> cvs diff -uN loadfile_elf32.c
> Index: loadfile_elf32.c
> ===================================================================
> RCS file: /cvsroot/src/sys/lib/libsa/loadfile_elf32.c,v
> retrieving revision 1.13
> diff -u -r1.13 loadfile_elf32.c
> --- loadfile_elf32.c 25 Jan 2006 18:27:23 -0000 1.13
> +++ loadfile_elf32.c 1 Apr 2006 19:02:52 -0000
> @@ -296,6 +296,13 @@
>
> for (first = 1, i = 0; i < elf->e_phnum; i++) {
> internalize_phdr(elf->e_ident[EI_DATA], &phdr[i]);
> +
> +#ifdef MD_LOADSEG /* Allow processor ABI specific segment loads */
> + if ( (phdr[i].p_type & PT_LOPROC) &&
> + MD_LOADSEG(phdr[i]))
> + goto loadseg;
> +#endif /*MD_LOADSEG*/
Does't it make sense to do >= LOPROC && <= HIPROC instead of testing
a bit?
> +
> if (phdr[i].p_type != PT_LOAD ||
> (phdr[i].p_flags & (PF_W|PF_X)) == 0)
> continue;
> @@ -309,6 +316,7 @@
> if ((IS_TEXT(phdr[i]) && (flags & LOAD_TEXT)) ||
> (IS_DATA(phdr[i]) && (flags & LOAD_DATA))) {
>
> + loadseg:
> /* Read in segment. */
> PROGRESS(("%s%lu", first ? "" : "+",
> (u_long)phdr[i].p_filesz));
>
>
> --
> ~Cherry
-- thorpej