summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add gnulib modules to replace missing libc functionalityUlf Hermann2017-04-27406-123/+66797
| | | | | | | | | | This enables us to build a fully featured elfutils package on systems with reduced C libraries, such as windows. All the modules are built into libgnu.a, which is then linked into all binaries if --enable-gnulib is given on the configure line. Change-Id: I743fd22172bc85d9f10dcc3dad8eb921f462b554 Reviewed-by: Christian Kandeler <[email protected]>
* Fix nesting of bracesUlf Hermann2017-04-271-1/+1
| | | | | | | | | The way it was before it didn't actually test if elf_update failed, but rather did something random. !!(<some number>) is a boolean and boolean true can be represented as anything non-0, including negative numbers. Change-Id: I1c9540d849931fc28aaa806550d178231baa8b9a Reviewed-by: Christian Kandeler <[email protected]>
* Add missing entries to .gitignoreUlf Hermann2017-04-272-0/+6
| | | | | Change-Id: I8c8d91521f30863eb19497cb1d9f7ce8649a81ee Reviewed-by: Christian Kandeler <[email protected]>
* Include endian.h when handling BYTE_ORDERUlf Hermann2017-04-272-0/+5
| | | | | | | BYTE_ORDER and friends are customarily defined in endian.h. Change-Id: Id86f02c08584201013c0f35cf179616b608526dc Reviewed-by: Christian Kandeler <[email protected]>
* Add EXEEXT to gendisUlf Hermann2017-04-272-3/+7
| | | | | | | | Otherwise the build will fail on systems that actually need file extension for executables. Change-Id: Ief8daaf158182089aa65a9fd693b43c1f4cae9fb Reviewed-by: Christian Kandeler <[email protected]>
* On elf_update, remember when we mmap()Ulf Hermann2017-04-262-0/+6
| | | | | | | Otherwise we skip the munmap() later. This leaks resources. Change-Id: I9e04ea3f0a608e88c474379df19c41261ecd092e Reviewed-by: Christian Kandeler <[email protected]>
* Make elf section sorting more deterministicUlf Hermann2017-04-264-7/+23
| | | | | | | | | At least one test (dwfl-addr-sect) depends on the order of elf sections with equal addresses. This is not guaranteed by the code. Compare also by end address and name to tell entries apart. Change-Id: I0e85e7b86a0489b6bc85f45f9a359c68a04f635a Reviewed-by: Christian Kandeler <[email protected]>
* Avoid signed/unsigned comparisonUlf Hermann2017-04-262-1/+5
| | | | | | | | | | | | Some compilers implicitly cast the result of uint_fast16_t * uint_fast16_t to something signed and then complain about the comparison to (unsigned) size_t. Casting phnum to size_t is a good idea anyway as 16bit multiplication can easily overflow and we are not checking for this. Change-Id: I073202d433d75b540ca042d15c364187a08fec6c Reviewed-by: Christian Kandeler <[email protected]>
* Include strings.h to make ffs availableUlf Hermann2017-04-262-0/+5
| | | | | | | We cannot rely on it to be available from any of the other headers. Change-Id: I33a93fa8d41183908242542b8efafd2355bc968c Reviewed-by: Christian Kandeler <[email protected]>
* Avoid double-including config.hUlf Hermann2017-04-2662-11/+291
| | | | | | | | | | | | | | | | | config.h doesn't have include guards, so including it twice is bad. We deal with this by checking for PACKAGE_NAME, but only in some places. Once we start using gnulib, we will need to include config.h before any gnulib-generated headers. This is problematic if we include it transitively through our own private headers. In order to set a clear rule about inclusion of config.h, it is now included in every .c file as first header, but not in any header. This will definitely avoid double-inclusion and satisfy the condition that it has to be included before gnulib headers. It comes at the price of adding some redundancy, but there is no clean way to avoid this. Change-Id: Ib78dd7e058ef8ac93cd379dcd14a2ffbc86c1988 Reviewed-by: Christian Kandeler <[email protected]>
* Don't look for kernel version if not running on linuxUlf Hermann2017-04-262-0/+9
| | | | | Change-Id: Ia74c04e2590d2d918fb7d5227a106de789551843 Reviewed-by: Christian Kandeler <[email protected]>
* Protect against integer overflow on shnumUlf Hermann2017-04-264-19/+33
| | | | | | | | If shnum is 0, the many "shnum - 1" would result in an overflow. Check it for 0, and only subtract once, rather than on every usage. Change-Id: I37a9e5d4e012a501d5ec98762ec0a435c743e25f Reviewed-by: Christian Kandeler <[email protected]>
* Use F_GETFD rather than F_GETFL to check validity of file descriptorUlf Hermann2017-04-212-1/+5
| | | | | | | | F_GETFD is both cheaper and easier to port, and otherwise has the same effect here. Change-Id: I62ebfc74855b8d8a938476394c269c17a8be98cc Reviewed-by: Christian Kandeler <[email protected]>
* Make __attribute__ conditional in all installed headersUlf Hermann2017-04-218-33/+54
| | | | | | | | | | | __attribute__ is a GNU extension. If we want to link against the libraries using a different compiler, it needs to be disabled. It was already disabled in libdw.h, and this patch extends this to the other headers. We move the defines to libelf.h as that is included in all the others. Change-Id: I6e22674641f19f5a8820e2c7c7ec46f2fd70a8af Reviewed-by: Christian Kandeler <[email protected]>
* Avoid YESSTR and NOSTRUlf Hermann2017-04-215-21/+32
| | | | | | | | | | Those are deprecated and apparently some implementations of nl_langinfo return empty strings for them. The tests even tested for those empty strings even though the intention of the code was clearly to output "yes" or "no" there. Change-Id: I4a0a24df2e9b5ac14a7eb6028f89c408b8a8aac7 Reviewed-by: Christian Kandeler <[email protected]>
* Don't use comparison_fn_tUlf Hermann2017-04-212-2/+6
| | | | | | | Not all search.h declare it, and it is not very helpful anyway. Change-Id: Icd3439175048b25058507dd5ec657b5680b82bb2 Reviewed-by: Christian Kandeler <[email protected]>
* Clean up linux-specific system includesUlf Hermann2017-04-2113-14/+35
| | | | | | | We only include them where we actually need them and only on linux. Change-Id: Ic3065ffab67ba1177f63204fb91a92c5f4336dbb Reviewed-by: Christian Kandeler <[email protected]>
* Include sys/types.h before fts.hUlf Hermann2017-04-212-1/+9
| | | | | | | | The bad fts not only needs to be included before config.h, but also requires various special types without including sys/types.h. Change-Id: I31ac8d2aadcf7ffb3efb63583b2745991bfd6f90 Reviewed-by: Christian Kandeler <[email protected]>
* Merge branch 'upstream' into HEADUlf Hermann2017-04-1911-7/+249
|\ | | | | | | Change-Id: Ifefd8ffeadb4e7d6df59cdc606323999eedc9adb
| * Add missing peel_type.c test for commit f339da.Mark Wielaard2017-04-071-0/+119
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Support checking ELF files with compressed sections.Mark Wielaard2017-04-056-3/+47
| | | | | | | | | | | | | | | | | | Simply unconditionally uncompress any section to make sure indexes between sections check out. Add some testcases with various compressed sections. https://sourceware.org/bugzilla/show_bug.cgi?id=21332 Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Fix dwarf_peel_type infinite loop.Mark Wielaard2017-04-055-4/+83
| | | | | | | | | | | | | | | | | | | | We were calling dwarf_attr_integrate () in the die in the loop instead of on the result. Which would cause an infinite loop when die != result. Add a testcase that explicitly checks this case. https://sourceware.org/bugzilla/show_bug.cgi?id=21330 Signed-off-by: Mark Wielaard <[email protected]>
* | Merge branch 'upstream'Ulf Hermann2017-04-0612-28/+582
|\| | | | | | | Change-Id: Ie20a924c8a6bd83cf404f236dd288a489ace62a0
| * elflint: Don't check section group without flags word.Mark Wielaard2017-04-042-1/+8
| | | | | | | | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=21320 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Sanity check the number of phdrs and shdrs available.Mark Wielaard2017-04-042-0/+30
| | | | | | | | | | | | | | | | | | Make sure we can at least read the shnum sections or phnum segments. Limit the number we do check to those we can actually read. https://sourceware.org/bugzilla/show_bug.cgi?id=21312 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Don't trust sh_entsize when checking hash sections.Mark Wielaard2017-04-042-12/+27
| | | | | | | | | | | | | | | | | | | | Calculate and use the expected entsize instead of relying on the one given by the ELF file section header. Return early if there isn't enough data in the section to check the full hash table. https://sourceware.org/bugzilla/show_bug.cgi?id=21311 Signed-off-by: Mark Wielaard <[email protected]>
| * elflint: Check symbol table data is big enough before checking.Mark Wielaard2017-04-042-1/+6
| | | | | | | | | | | | | | | | | | Before checking symbol index zero we should make sure the data size is big enough. https://sourceware.org/bugzilla/show_bug.cgi?id=21310 Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Always update last_offset in updatefile and updatemmap.Mark Wielaard2017-04-045-7/+468
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ELF section data was used, but not updated or marked as dirty and there also existed non-dirty sections and some padding was needed between the sections (possibly because of alignment) then elf_update might write "fill" over some of the existing data. This happened because in that case the last_position was not updated correctly. Includes a new testcase fillfile that fails before this patch by showing fill instead of the expected data in some section data. It succeeds with this patch. https://sourceware.org/bugzilla/show_bug.cgi?id=21199 Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Check compression ratio before trying to allocate output buffer.Mark Wielaard2017-04-032-0/+14
| | | | | | | | | | | | | | | | | | | | The maximum compression factor (http://www.zlib.net/zlib_tech.html) is 1032:1. Add a sanity check for that before trying to allocate lots of memory and trying to decompress lots of bogus data. https://sourceware.org/bugzilla/show_bug.cgi?id=21301 Signed-off-by: Mark Wielaard <[email protected]>
| * Use the empty string for note names with zero size (without any data).Mark Wielaard2017-04-035-6/+23
| | | | | | | | | | | | | | | | | | | | ELF notes can have a zero sized name. In which case there is no data at all (so also no zero terminator). Make sure to use the empty string for such notes if the code does not otherwise explicitly check n_namesz. https://sourceware.org/bugzilla/show_bug.cgi?id=21300 Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Fix off by one sanity check in handle_gnu_hash.Mark Wielaard2017-04-032-1/+6
| | | | | | | | | | | | | | | | | | | | We sanity check to make sure we don't index outside the chain array by testing inner > max_nsyms. But inner is a zero-based index, while max_nsyms is the maximum number. Change the check to inner >= max_nsyms. https://sourceware.org/bugzilla/show_bug.cgi?id=21299 Signed-off-by: Mark Wielaard <[email protected]>
* | Merge remote-tracking branch 'upstream/master' into HEADUlf Hermann2017-03-289-6/+39
|\| | | | | | | Change-Id: I7874d814ddf7e5887fd720c899cb9e7499d5fbb8
| * libasm: Fix one GCC7 -Wformat-truncation=2 warning.Mark Wielaard2017-03-242-3/+9
| | | | | | | | | | | | | | | | | | | | | | Make sure that if we have really lots of labels the tempsym doesn't get truncated because it is too small to hold the whole name. This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed out by enabling this warning because there are currently some issues with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 Signed-off-by: Mark Wielaard <[email protected]>
| * backends: Add support for EM_PPC64 GNU_ATTRIBUTES.Mark Wielaard2017-03-247-3/+30
|/ | | | | | | | ppc64 and ppc64le ELF files can also contain a power specific .gnu.attributes section. Add support for those and recognize the new GNU_Power_ABI_FP Single-precision hard float value. Signed-off-by: Mark Wielaard <[email protected]>
* Move print_version into printversion.{h|c}Ulf Hermann2017-02-1723-27/+103
| | | | | | | | Rename version.c so that the implementation is called after the header and the header doesn't clash with the toplevel version.h. print_version depends on argp and is only used in the tools. Signed-off-by: Ulf Hermann <[email protected]>
* Check for existence of mempcpyUlf Hermann2017-02-1714-2/+40
| | | | | | If it doesn't exist, provide a definition based on memcpy. Signed-off-by: Ulf Hermann <[email protected]>
* Always use the same method to query the system page sizeUlf Hermann2017-02-155-3/+12
| | | | | | | This makes it easier to write a replacement for it on systems where sysconf(3) doesn't exist. Signed-off-by: Ulf Hermann <[email protected]>
* Move color handling into a separate headerUlf Hermann2017-02-158-34/+79
| | | | | | | | We only need it in nm.c and objdump.c, but it pulls in argp as dependency. By dropping it from libeu.h, the libraries can be compiled without argp. Signed-off-by: Ulf Hermann <[email protected]>
* Add -D_FORTIFY_SOURCE=2 to CFLAGS if possible.Mark Wielaard2017-02-142-0/+25
| | | | | | | | | Some distros now add -D_FORTIFY_SOURCE=2 by default and we have missed some issues in the past caught by it. Add it to CFLAGS if possible. The configure check will make sure that it doesn't conflict with any other CFLAGS already defined. Signed-off-by: Mark Wielaard <[email protected]>
* Optionally allow unknown symbols in the backtrace testsUlf Hermann2017-02-143-12/+38
| | | | | | | | This is useful to test unwinding without debug information. The binaries being examined might still have frame pointers that allow us to bridge the unknown symbols. Signed-off-by: Ulf Hermann <[email protected]>
* Make the backtrace-data test helper more robustUlf Hermann2017-02-142-3/+19
| | | | | | | | | When unwinding by frame pointer the unwinder might ask for invalid addresses. We don't have to fail the test in this case. In fact any broken dwarf information can lead to requests for invalid addresses, also without frame pointer unwinding. Signed-off-by: Ulf Hermann <[email protected]>
* Add missing tests to .gitignoreUlf Hermann2017-02-141-0/+12
| | | | | | Some test binaries were missing and showed up in "git status". Signed-off-by: Ulf Hermann <[email protected]>
* Define PACKAGE_URL for older autoconf.Mark Wielaard2017-01-122-0/+10
| | | | | | | autoconf < 2.64 doesn't define PACKAGE_URL through AC_INIT. Define it ourselves if needed. Signed-off-by: Mark Wielaard <[email protected]>
* Fix TEMP_FAILURE_RETRY definition when not defined.Luiz Angelo Daros de Luca2016-12-307-2/+15
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=21001 Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>
* Update Polish translationPiotr Drąg2016-12-291-2/+15
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=20999 Signed-off-by: Piotr Drąg <[email protected]>
* Update POTFILES.inPiotr Drąg2016-12-291-0/+1
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=20999 Signed-off-by: Piotr Drąg <[email protected]>
* Update Polish translationPiotr Drąg2016-12-291-126/+95
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=20999 Signed-off-by: Piotr Drąg <[email protected]>
* Prepare for elfutils 0.168 release.elfutils-0.168Mark Wielaard2016-12-2711-5199/+5191
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* http://elfutils.org/ is now hosted at http://sourceware.org/elfutils/Mark Wielaard2016-12-2431-250/+169
| | | | | | | | | | | | | | | | | fedorahosted used to be our home, but we are now hosted at sourceware. Change the elfutils project home to http://elfutils.org/ Point hosted services (email, release, git, bug tracker and web pages) to https://sourceware.org/elfutils/ Move design notes from README to NOTES. Add URLs for home, releases, bugs, git and mailinglist to README. Make the --version output of all tools the same by using a common print_version function and update the publicly shown copyright holder to the elfutils developers. Signed-off-by: Mark Wielaard <[email protected]>
* libelf: gelf_newehdr and gelf_newehdr should return void *.Akihiko Odaki2016-12-074-10/+22
| | | | | | | | | | | | unsigned long int is not always capable to have pointer in some cases (LLP64, for example). Return a void pointer instead. Other libelf implementations will also make this change (or already have). Also update the documentation to state what is created and that NULL is returned on error (don't document that the returned value is a pointer to the actual header created). Signed-off-by: Akihiko Odaki <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>