Re: [PATCH] FDPIC: add hook for arches to customize program header parsing

From: Mike Frysinger
Date: Tue Jun 23 2009 - 07:04:36 EST


On Tue, Jun 23, 2009 at 01:32, Andrew Morton wrote:
> On Tue, 16 Jun 2009 04:24:48 -0400 Mike Frysinger wrote:
>> From: Jie Zhang <jie.zhang@xxxxxxxxxx>
>> The Blackfin port has custom program header flags/addresses for
>> automatically loading regions into the dedicated on-chip SRAM. ÂSo add a
>> hook for ports to leverage.
>>
>> Signed-off-by: Jie Zhang <jie.zhang@xxxxxxxxxx>
>> Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
>> CC: Bernd Schmidt <bernds_cb1@xxxxxxxxxxx>
>> Acked-by: David Howells <dhowells@xxxxxxxxxx>
>> Acked-by: Paul Mundt <lethal@xxxxxxxxxxxx>
>> Acked-by: Greg Ungerer <gerg@xxxxxxxxxxx>
>> ---
>> Andrew: could you pick this up ? Âsame patch as before, just with the
>> additional tags added.
>
> I suppose we want to squeeze this into 2.6.31.

would be nice, but not terribly critical

>> --- a/fs/binfmt_elf_fdpic.c
>> +++ b/fs/binfmt_elf_fdpic.c
>> @@ -1105,6 +1105,13 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
>> Â Â Â Â Â Â Â Â Â ELF_FDPIC_FLAG_CONTIGUOUS)
>> Â Â Â Â Â Â Â Â Â Â Â load_addr += PAGE_ALIGN(phdr->p_memsz + disp);
>>
>> +#ifndef ELF_FDPIC_PLAT_PROCESS_PHDR
>> +# define ELF_FDPIC_PLAT_PROCESS_PHDR(mm, params, phdr, maddr, disp) 0
>> +#endif
>> + Â Â Â Â Â Â ret = ELF_FDPIC_PLAT_PROCESS_PHDR(mm, params, phdr, &maddr, &disp);
>> + Â Â Â Â Â Â if (ret)
>> + Â Â Â Â Â Â Â Â Â Â return ret;
>> +
>
> Wouldn't it be simpler to do
>
> #ifdef ELF_FDPIC_PLAT_PROCESS_PHDR
> Â Â Â Â Â Â Â Âret = ELF_FDPIC_PLAT_PROCESS_PHDR(mm, params, phdr, &maddr,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â&disp);
> Â Â Â Â Â Â Â Âif (ret)
> Â Â Â Â Â Â Â Â Â Â Â Âreturn ret;
> #endif
>
> ?
>
> If there's any prospect that we'll use ELF_FDPIC_PLAT_PROCESS_PHDR() a
> second time from within this file then yes, adding a definition as
> you did is appropriate. ÂBut it should be near the top of the file, not
> stuck stupidly in the middle of a C function.

the purpose was to stick to current conventions used in the file and
to maximize the amount of code compiled. i dont particularly care wrt
the method used here.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/