aboutsummaryrefslogtreecommitdiff
path: root/lib/libelf
AgeCommit message (Collapse)AuthorFilesLines
2021-02-12elf: Compile with -WextraAlexey Kardashevskiy3-8/+8
-Wextra enables a bunch of rather useful checks which this fixes. This changes the return value for the case when no ELF headers were found to avoid (ugly-ish) cast of -1 to unsigned. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- Changes: v2: * cast the return value to (int) * added missing (long)
2020-05-13elf: Implement elf_get_file_size to determine size of an ELF imageStefan Berger3-0/+152
Implement elf_get_file_size to determine the size of an ELF image that has been loaded into a buffer much larger than the actual size of the original file. We determine the size by searching for the farthest offset declared by the ELF headers. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2020-02-21elf64: Add LE64 ABIv1/2 support for loading images to given addressAlexey Kardashevskiy1-0/+8
c2358afb40d4 ("Add support for 64bit LE ABI v1 and v2 support") added little endian ELF support for one of two ELF loading helpers, this fixes oversight. With this changes, 'boot disk:2,boot\zImage' is able to handle little-endian zimages. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2018-07-02libelf: Add REL32 to the list of ignored relocationsThomas Huth1-0/+1
When compiling SLOF with GCC 8.1, I currently get a lot of these errors: ERROR: Unhandled relocation (A) type 26 Type 26 is the "relative 32-bit" relocation. We can simply ignore it (like the other relative relocations - REL14, REL24 and REL64) to shut up these error messages. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2014-03-18ELF: Enter LE binary in LE modeNikunj A Dadhania2-1/+12
Trampoline code in the LE binary were helping fix this. This patch now takes care of switching the mode to LE for LE elf binaries. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-03-18ELF loading should fail for virt != physNikunj A Dadhania3-9/+16
Prevent loading of elf files which does not have virtual address same as physical address. Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-02-04Add support for 64bit LE ABI v1 and v2 supportNikunj A Dadhania2-2/+18
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> -- v2: With the parameters changed for go-64, kernel loading from commandline broke v3: (client-exec) calls start-elf64 directly, fix args
2013-12-06Add support for loading little endian ELF binaries.Anton Blanchard3-6/+95
We byte swap the entire header in place in elf_check_file. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-01-04Spelling fixes in comments and debug messagesStefan Weil1-1/+1
Most of these errors were found by codespell: controler -> controller appropiate -> appropriate devide -> divide comming -> coming seperate -> separate reponsible -> responsible initialization -> initialization successfull -> successful whithin -> within recieve -> receive wich -> which occurence -> occurrence beggining -> beginning accessable -> accessible proccess -> process succesfuly -> successfully immediatly -> immediately prefered -> preferred avaliable -> available threshhold -> threshold statistsics -> statistics endianess -> endianness positon -> position writen -> written occurence -> occurrence upto -> up to overwriten -> overwritten availabe -> available enviroment -> environment intruction -> instruction thru -> through substract -> subtract occured -> occurred begining -> beginning lenght -> length atributes -> attributes preceeding -> preceding defintion -> definition decriptor -> descriptor Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2011-10-12Make net-snk and modules relocatable, too.Thomas Huth1-0/+2
Cleaned up the toc-relative assembly of net-snk, fixed the Makefiles, save the modules as ELF files instead of raw binaries, adjust the net-snk base address and the load-base variable... a lot of changes were required to make the net-snk and the snk modules relocatable, too. But now it should be possible to relocate all files so that the firmware also runs with less than 256 MiB RAM. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Got rid of the ELF loader functions written in Forth, using libelf instead.Thomas Huth2-1/+29
It's cumbersome to maintain code twice, in Forth and in C, and now that libelf has a new important feature (relocation), I removed most of the old Forth functions for ELF loading and use the libelf everywhere instead. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12Reworked libelf to support relocationThomas Huth6-167/+692
Split elf.c into elf32.c and elf64.c for better readability. Added relocation code to libelf for 64-bit ELF images, modified the Paflof Makefile to link the executable with relocation information and load Paflof now to the upper end of the memory. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2010-12-01Initial import of slof-JX-1.7.0-4Benjamin Herrenschmidt4-0/+314
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>