[PATCH] Determine ELF32/ELF64 automatically on i386

Vivek Goyal vgoyal at in.ibm.com
Tue Jul 10 01:52:59 EDT 2007


On Tue, Jul 03, 2007 at 06:12:07PM +0200, Bernhard Walle wrote:
> On i386, kexec generates ELF64 core headers by default if the user doesn't
> override this via a command line option. Because GDB cannot analyse
> ELF64 core dumps on 32 bit platforms, it's a bad idea to use ELF64 if it's not
> needed.
> 
> This patch selects ELF32 if the biggest memory address fits in 32 bit address
> space, which should be the case on non PAE systems. If the user specifies
> a command line option, that option overrides the detection.
> 

Makes sense to me. No need to generate 64bit ELF headers on systems
having less than 4G of memory. gdb runs into issues with 64bit ELF headers
on 32bit machines.

> +++ b/kexec/arch/i386/kexec-x86.h
> @@ -2,8 +2,12 @@
>  #define KEXEC_X86_H
> 
>  #define MAX_MEMORY_RANGES 64
> -#define CORE_TYPE_ELF32 1
> -#define CORE_TYPE_ELF64 2
> +
> +enum CoreType {
> +	CORE_TYPE_UNDEF = 0,
> +	CORE_TYPE_ELF32 = 1,
> +	CORE_TYPE_ELF64 = 2
> +};
> 

I think we can avoid mixed case in "CoreType" and use something like
"coretype".

Thanks
Vivek



More information about the kexec mailing list