summaryrefslogtreecommitdiff
path: root/kexec/kexec-elf-rel.c
Commit message (Collapse)AuthorAgeFilesLines
* kexec/elf: assign one to align if sh_addralign equals zeroPingfan Liu2022-04-011-3/+7
| | | | | | | | | | | | | | | | | | | | | | | According to ELF specification, if sh_addralign equals zero or one, then the section has no alignment requirement on the start address. (I.e. it can be aligned on 1 byte) Since modern cpu asks the .text, .data, .bss to be aligned on the machine word boundary at least, so in elf_rel_load(), sh_addralign can not be zero, and align = shdr->sh_addralign; ... bufsz = _ALIGN(bufsz, align); will not render a result of 'bufsz = 0'. But it had better have a check on the case of 'sh_addralign == 0' regardless of the assumption of machine word alignment. This patch has no functional change. Signed-off-by: Pingfan Liu <piliu@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* Pass struct mem_sym into machine_apply_elf_rel()Anton Blanchard2016-03-241-1/+1
| | | | | | | | | | On PowerPC64 ABIv2 we need to look at the symbol to determine if it has a local entry point. Pass struct mem_sym into machine_apply_elf_rel() so we can. Signed-off-by: Anton Blanchard <anton@samba.org> Tested-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec/ppc64 ELF ABIv2 ABI supportLaurent Dufour2014-02-041-5/+5
| | | | | | | | | | | | | When building in PPC64 little endian mode, the compiler is now using the new ABI v2. Among other changes, this new ABI removes the function descriptors and changes the way the TOC address is computed when entering a C function. The purgatory assembly part where the dot symbols are removed, and ELF relocation code are impacted in this patch. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec: Fix uninitialized build warningGeoff Levand2013-10-031-1/+1
| | | | | | | | | | | Initialize a local variable to zero. Fixes build warnings like these: kexec/kexec-elf-rel.c: warning: ‘rel.r_offset’ may be used uninitialized in this function Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec, i386: Fix build warning of size_t printZhang Yanfei2013-04-081-2/+2
| | | | | | | | | | | | | | | When compile kexec-tools in i386, we got the following warnings: kexec/kexec-elf-rel.c: In function ‘elf_rel_set_symbol’: kexec/kexec-elf-rel.c:517: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘size_t’ kexec/kexec-elf-rel.c: In function ‘elf_rel_get_symbol’: kexec/kexec-elf-rel.c:541: warning: format ‘%ld’ expects type ‘long int’, but argument 4 has type ‘size_t’ This is because the two functions output a size_t value as %ld when it should be %zd, resulting in this warning. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec: use _ALIGN* to make the logic clearZhang Yanfei2013-03-151-4/+4
| | | | | | | | By replacing all the explicit align opertion with marco _ALIGN*, the code logic could more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec: fix some compiler warningsZhang Yanfei2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | I got the following warnings when I compiled kexec-tools: kexec/kexec-elf-rel.c: In function 'elf_rel_load': kexec/kexec-elf-rel.c:367: warning: format '%lx' expects type 'long unsigned int', but argument 6 has type 'unsigned int' kexec/kexec-elf-rel.c:367: warning: format '%lx' expects type 'long unsigned int', but argument 7 has type 'long long unsigned int' kexec/kexec-elf-rel.c:367: warning: format '%lx' expects type 'long unsigned int', but argument 8 has type 'long long unsigned int' kexec/arch/i386/crashdump-x86.c: In function 'get_kernel_paddr': kexec/arch/i386/crashdump-x86.c:99: warning: format '%016Lx' expects type 'long long unsigned int', but argument 3 has type 'uint64_t' kexec/arch/i386/crashdump-x86.c: In function 'get_kernel_vaddr_and_size': kexec/arch/i386/crashdump-x86.c:171: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'long long unsigned int' kexec/arch/i386/crashdump-x86.c: In function 'get_crash_notes': kexec/arch/i386/crashdump-x86.c:781: warning: format '%Lx' expects type 'long long unsigned int', but argument 3 has type 'uint64_t' kexec/arch/i386/crashdump-x86.c: In function 'load_crashdump_segments': kexec/arch/i386/crashdump-x86.c:905: warning: 'nr_ranges' may be used uninitialized in this function The patch fix above warnings. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* Fix format strings of die()Aleksey Makarov2012-06-271-3/+3
| | | | | | | | | | | One of them caused crash when user specifies a file that does not exist. Signed-off-by: Aleksey Makarov <aleksey.makarov@gmail.com> Removed trailing whitespace. Signed-off-by: Simon Horman <horms@verge.net.au>
* Add generic debug optionCong Wang2012-03-151-6/+5
| | | | | | | | | | | | | | | | Currently the debugging code is under #ifdef DEBUG, which means when we want to debug, we have to re-compile the source code with -DDEBUG. This is not convenient, we want to have a generic --debug option so that we can enable debugging code without re-compiling. This patch moves the arch-specific --debug to generic place and moves code under #ifdef DEBUG to --debug on x86. BTW, the size of kexec binary increases very little after this patch. Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* Use C99 initialisersSimon Horman2010-02-021-3/+3
| | | | | Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec: Fix printed symbol valueGeoff Levand2009-06-231-3/+3
| | | | | | | | | Move the print statement so that the variable value has been assigned before its value is printed. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* Fix all gcc warnings for ARCH=i386 builds.Jamey Sharp2008-04-241-4/+4
| | | | | Signed-off-by: Jamey Sharp <jamey@thetovacompany.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* kexec-tools: Add a new parameter to generic elf parsing functionsVivek Goyal2006-10-061-4/+5
| | | | | | | | | o Adding a new parameter to elf functions. This flag can be used to alter the function behaviour. Currently only one bit is being used for skipping the elf file len check while builing the elf info. Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
* teach elf_rel_load() about section namesMagnus Damm2006-10-061-7/+14
| | | | | | | The patch extends elf_rel_load() to handle section names correctly. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
* make elf_rel_build_load() use buffer from argumentMagnus Damm2006-10-061-1/+1
| | | | | | | | | | elf_rel_build_load() is currently using the symbols purgatory and purgatory_size as buffer and buffer size instead of using the arguments passed to the function. This patch fixes this by changing the code to use the function arguments as buffer and buffer size. Signed-off-by: Magnus Damm <magnus@valinux.co.jp> Signed-off-by: Simon Horman <horms@verge.net.au>
* Cleanup the warnings in gcc-4.1.0 compilationMohan2006-07-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Cleanup the warnings generated in GCC 4.1.0 compilation of kexec-tools. This patch is created on top of the following level of kexec-tools: - kexec-tools-1.101.tar.gz (from eric biederman's site or from lse site) - kexec-tools-1.101-kdump6.patch (consolidated patch posted on http://lse.sourceforge.net/kdump/patches/1.101-kdump6/kexec-tools-1.101-kdump6.patch) Review and suggestions are welcome. Note: Resending the patch since its not delivered to both fastboot and linuxppc64-dev mailing list. Regards, Mohan. Signed-off-by: Mohan <mohan@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
* patch for REL errorsMohan Kumar M2006-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Hi Haren, I found out that 'continue' statement is missing in kexec-elf-rel.c. So I am sending a patch which includes 'continue' statement for STN_UNDEF condition. I tried with this patch and I am able to do ./kexec -p and not getting any relocation error, but kernel OOPS. Even kexec -l and kexec -e also not working. I am getting "kexec: waiting for cpu 1 (physical 1) to go down" message and kernel did not boot. I used /home/hbabu/2.6.15-mm1/linux-2.6.15-mm1 for testing purpose. Initrd image is not built from linux-2.6.15-mm1, I used existing initrd image (initrd-2.6.15-rc5cel.img). As I am having fever, I may not be able to come office tomorrow. Sorry for the inconvenience. Regards, Mohan.
* ppc64 kdump purgatory backup supportR Sharada2006-07-271-14/+24
| | | | | | | | | | | | | | | | | This patch implements the purgatory support to take backup of the first 32KB of the first kernel - Modified the v2wrap code to make the secondary cpus spin directly in the v2wrap after pulling them out of kexec_wait - Use the elf_rel function support to set the various symbols used in purgatory - load device-tree as a separate segment - other miscellaneous compiler warnings cleanup - add purgatory code support for backup - build purgatory as relocatable for ppc64 Signed-off-by: R Sharada <sharada@in.ibm.com> Signed-off-by: Mohan Kumar M <mohan@in.ibm.com> Signed-off-by: Maneesh Soni <maneesh@in.ibm.com>
* kexec-tools-1.101v1.101Eric W. Biederman2006-07-271-0/+531
- Initial import into git - initial nbi image formage support - ppc32 initial register setting fixes. - gzipped multiboot file support