[PATCH v2 4/5] powerpc/fadump: Make ELF eflags depend on endian

Michael Ellerman mpe at ellerman.id.au
Fri Sep 9 20:58:13 AEST 2016


Mahesh Jagannath Salgaonkar <mahesh at linux.vnet.ibm.com> writes:
> On 09/08/2016 12:30 PM, Mahesh Jagannath Salgaonkar wrote:
>> On 09/06/2016 11:02 AM, Daniel Axtens wrote:
>>> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
>>> index 0638b82ce294..457f08e544c6 100644
>>> --- a/arch/powerpc/kernel/fadump.c
>>> +++ b/arch/powerpc/kernel/fadump.c
>>> @@ -779,7 +779,11 @@ static int fadump_init_elfcore_header(char *bufp)
>>>  	elf->e_entry = 0;
>>>  	elf->e_phoff = sizeof(struct elfhdr);
>>>  	elf->e_shoff = 0;
>>> -	elf->e_flags = ELF_CORE_EFLAGS;
>>> +#ifdef __LITTLE_ENDIAN__
>> 
>> Wouldn't '#ifdef PPC64_ELF_ABI_v2' be more appropriate here ?
>
> Hari just pointed out to me that the upstream commit
> [https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?id=918d0355]
> introduces ELF_CORE_EFLAGS with correct values.

No that's wrong in this case.

It does:

+#define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)

We are generating a core file for *the kernel itself*. So using
is_elf2_task() is wrong. We need to know if the kernel is built v2 or
not, not whether the currently running process is v2.

cheers


More information about the Linuxppc-dev mailing list