kexec: add a elf_rel_find_section service

It can be directly used to find the .toc section on ppc64 and it
will be used to look for the section containing the compressed
vmlinux in a ppc64 zImage.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
kexec: bypass check on interp program header for ppc64le zImage

When the elf information is built from the executable, kexec checks
for an interp elf program header and fails if it exists. The following
patch adds a new service machine_check_elf_phdr_interp() which lets
platforms eventually bypass this check.

This is needed for the zImage boot wrapper on PPC 64bit little endian.
The executable is linked as position independent and has a interp elf
program header.

An alternative to this patch would be to remove the whole test on the
interp elf program header as kexec seems to be ignoring the information
after all.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
ppc64: detect zImage files and load the uncompressed vmlinux

The zImage* executable files on ppc64 use a special section called
".kernel:vmlinux.strip" which contains a compressed vmlinux executable
file.

This patch adds a service to detect and unzip such a section in a
malloc'ed buffer. The buffer is then used in elf_ppc64_load() to
load the new vmlinux.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
ppc64, cleanup: cmdline_len variables are unused

../kexec/arch/ppc64/kexec-elf-ppc64.c:100:19: warning: variable ‘modified_cmdline_len’ set but not used [-Wunused-but-set-variable]
  int cmdline_len, modified_cmdline_len;
                   ^
../kexec/arch/ppc64/kexec-elf-ppc64.c:100:6: warning: variable ‘cmdline_len’ set but not used [-Wunused-but-set-variable]
  int cmdline_len, modified_cmdline_len;

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
ppc64, cleanup: remove dead code in kexec-zImage-ppc64

This code was never used.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
ppc64, cleanup: fix implicit declaration compile warnings

../kexec/arch/ppc64/kexec-ppc64.c: In function ‘get_devtree_details’:
../kexec/arch/ppc64/kexec-ppc64.c:414:5: warning: implicit declaration of function ‘reserve’ [-Wimplicit-function-declaration]
     reserve(KDUMP_BACKUP_LIMIT, crash_base-KDUMP_BACKUP_LIMIT);
     ^
../kexec/arch/ppc64/crashdump-ppc64.c: In function ‘load_crashdump_segments’:
../kexec/arch/ppc64/crashdump-ppc64.c:391:2: warning: implicit declaration of function ‘reserve’ [-Wimplicit-function-declaration]
  reserve(info->backup_start, sz);
  ^

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
ppc64, cleanup: fix unused variable compile warning

../kexec/arch/ppc64/crashdump-ppc64.c: In function ‘get_crash_memory_ranges’:
../kexec/arch/ppc64/crashdump-ppc64.c:186:6: warning: unused variable ‘i’ [-Wunused-variable]
  int i, n, crash_rng_len = 0;

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>