summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libdw: Add DW_MACRO constants and DW_MACRO_GNU compatibility defines.upstream/mjw/DWARF5Mark Wielaard2016-10-287-44/+146
| | | | | | | | | | Accept version 5 .debug_macro format, which is identical to the GNU version 4 format. No real support yet for the new supplementary object file (sup) and indirect string references (strx). GCC doesn't generate them yet. readelf does recognize them, but doesn't try to decode them. dwarf_getmacros currently rejects the new formats. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Handle immutable, packed and shared types in dwarf_peel_type.Mark Wielaard2016-10-282-12/+23
| | | | | | | | | Also update the documentation to explain that any type alias or modifier that doesn't modify, change the structural layout or the way to access the underlying type is peel. Explicitly mention pointer and reference types, which aren't peeled. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Add new DWARF5 tag constants.Mark Wielaard2016-10-282-2/+13
| | | | | | | | | | Add DW_TAG_coarray_type, DW_TAG_generic_subrange, DW_TAG_dynamic_type, DW_TAG_call_site, DW_TAG_call_site_parameter, DW_TAG_skeleton_unit, DW_TAG_immutable_type. Just the constants, no further interpretion yet. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Add dwarf_default_lower_bound.Mark Wielaard2016-10-2811-55/+217
| | | | | | | | | | Add dwarf_default_lower_bound to get the default lower bound for a language when not given as attribute for an subrange type. Implementation extracted from dwarf_aggregate_size. Add a test to check all known language codes are handled. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: DWARF5 Add new DW_LANG codes and default lower array bound.Mark Wielaard2016-10-283-1/+31
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdw: DWARF5 Add DW_CC_pass_by_reference and DW_CC_pass_by_reference.Mark Wielaard2016-10-282-1/+10
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Correct spelling of DW_LANG_PLI in dwarf.h.Mark Wielaard2016-10-274-5/+17
| | | | | | | | | The name used in the standard and other DWARF implementations for Programming Language One, PL/I, is DW_LANG_PLI (not DW_LANG_PL1). Fix usage in dwarf_aggregate_size. Signed-off-by: Mark Wielaard <[email protected]>
* Do not depend on some non-POSIX features.Akihiko Odaki2016-10-138-8/+76
| | | | | | | | Define/open code memrchr, rawmemchr, powerof2 and TEMP_FAILURE_RETRY if not available through system headers. Signed-off-by: Akihiko Odaki <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* lib: Provide MAX and MIN in system.hAkihiko Odaki2016-10-1246-96/+182
| | | | | | | | | | This change also creates a new header file libeu.h to provide the prototypes for the function of libeu. That hides the definition of function crc32, which can conflict with zlib, from libelf. It also prevents mistakes to refer those functions from a component which doesn't link with libeu, such as libelf. Signed-off-by: Akihiko Odaki <[email protected]>
* strip: Don't remove real symbols from allocated symbol tables.Mark Wielaard2016-10-062-11/+29
| | | | | | | | | | | | | | | Having a symbol in an allocated symbol table (like .dynsym) that points to an unallocated section is wrong. Traditionally strip has removed such symbols if they are section or group symbols. But removing a real symbol from an allocate symbol table is hard and probably a mistake. Really removing it means rewriting the dynamic segment and hash sections. Since we don't do that, don't remove the symbol (and corrupt the ELF file). Do warn and set the symbol section to SHN_UNDEF. https://bugzilla.redhat.com/show_bug.cgi?id=1380961 Signed-off-by: Mark Wielaard <[email protected]>
* libcpu: Fix build of bpf_disasm.c for kernels < 3.20.Mark Wielaard2016-09-052-0/+8
| | | | | | | Before linux 3.20 the BPF_PSEUDO_MAP_FD constant wasn't defined. Reported-by: Julian Ospald <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* tests: Fix --enable-gcov tests build. Add libdw to LDADD for asm_tsts.Mark Wielaard2016-08-302-9/+13
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* Regenerate .po files.elfutils-0.167Mark Wielaard2016-08-265-10/+10
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* tests: Simplify backtrace-native tests. Drop raise jmp patching for x86_64.Mark Wielaard2016-08-253-22/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The backtrace-native[-biarch] testcase was a little too clever in places making it unreliable. On x86_64 we tried to make an interesting backtrace by catching the first signal and then replacing the pc with the address of the first instruction of a function. Then we would raise a new signal, through ptrace, to create a backtrace that went from a signal frame into a frame at the start of a function. That way we could check that we were trying to fetch the correct CFI for the (jmp) function even at the first instruction (normally we would substract one from the return address to get at the call address). This works as long as the CFI for the jmp() function is identical to the CFI for the raise() function that we "patched away". Unfortunately on Fedora rawhide glibc has a rewritten raise() implementation that has different CFI, in particular the CFA is calculated differently. Making the testcase fail because we cannot properly unwind from jmp(). So this special x86_64 case has been disabled (the code is still there in case we find another way to test this in a more reliable way). On Ubuntu there have been spurious testcase failures because see_exec_module found two Dwfl_Modules with the same path. This would trigger an assert. Although this might indicate some issue (maybe we are not parsing the proc/pid/map correctly?) it isn't clear that it really is a bug. Since the assert is not very helpful finding any actual bug and for the testcase it is only necessary that the first Dwfl_Module that represents the executable is found we just pick that Dwfl_Module and don't iterate through any of the others. Signed-off-by: Mark Wielaard <[email protected]>
* strip: Use ELF_CHF_FORCE to recompress any sections that were uncompressed.Mark Wielaard2016-08-252-1/+5
| | | | | | | | Older gcc might create small .debug_pubtype. If such a section is compressed then strip should use ELF_CHF_FORCE to return it to compressed state after it is done with the section. Found by the run-strip-reloc.sh testcase on rhel6. Signed-off-by: Mark Wielaard <[email protected]>
* Regenerate .po files.Mark Wielaard2016-08-246-101/+568
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* tests: Add testfilesparc64attrs.o.bz2 to EXTRA_DIST.Mark Wielaard2016-08-242-0/+5
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* sparc: fix the printing of hw capabilities object attributes.Jose E. Marchesi2016-08-245-24/+81
| | | | | | | | | | The GNU_Sparc_HWCAPS and GNU_Sparc_HWCAPS2 object attributes comprise a set of hardware capabilities that may (or not) be present in the target machine for which the object was compiled. This patch adds the support for printing a nicely formatted comma-separated list with the selected hw capabilities. Signed-off-by: Jose E. Marchesi <[email protected]>
* Updated Polish translationPiotr Drąg2016-08-191-757/+405
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1368130 Signed-off-by: Piotr Drąg <[email protected]>
* Add --add-comments to XGETTEXT_OPTIONS in MakevarsPiotr Drąg2016-08-191-1/+2
| | | | | | | | So that translator comments show up in .po files. https://bugzilla.redhat.com/show_bug.cgi?id=1368130 Signed-off-by: Piotr Drąg <[email protected]>
* Update POTFILES.inPiotr Drąg2016-08-191-0/+1
| | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1368130 Signed-off-by: Piotr Drąg <[email protected]>
* libdwfl: Fix assert and set in.d_size in dwfl_link_map_report.Mark Wielaard2016-08-152-2/+9
| | | | | | | | | | | | When reading the phdrs from a core file segment fails we would try to read them from the exec. This fallback path contained a faulty assert that the requested size of the phdrs was still setup. But the core file reading callback might have reset the d_size value to zero on error. So explicitly set the number of bytes we want to read again instead of asserting the size. https://bugzilla.redhat.com/show_bug.cgi?id=1365812 Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Fix memory leak in elf_compress for mmapped ELF files.Mark Wielaard2016-08-154-6/+24
| | | | | | | | | | | | | | | | The testcase added to run-strip-reloc.sh for strip-compressed.o showed a memory leak when ran under valgrind (configure --enable-valgrind). For a mmapped ELF file when existing section data was compressed elf_end would fail to release the new compressed data buffer assigned to rawdata_base. For non-mapped files rawdata_base is always freed. For decompressed data rawdata_base is released together with zdata_base. Use the Elf_Scn flag ELF_T_MALLOCED to track whether rawdata_base points to malloced memory and free it in elf_end even for mmapped ELF files. Signed-off-by: Mark Wielaard <[email protected]>
* strip: Handle compressed relocation target sections.Mark Wielaard2016-08-154-5/+38
| | | | | | | | | | | | | | | binutils 2.27 assembler will create compressed sections for x86 ELF targets. The linker will decompress them again and it doesn't do this for any other target. This broke one of the run-strip-reloc.sh self tests. Fix by checking if the target of a relocation section is compressed and first decompressing it before applying relocations and then compressing again if necessary. Add explicit testcases for compressed and uncompressed ET_REL files to run-strip-reloc.sh. Signed-off-by: Mark Wielaard <[email protected]>
* Fix bpf disassembler for _FORTIFY_SOURCERichard Henderson2016-08-114-175/+378
| | | | | | | | It's illegal to skip positional operands for printf. Rearrange the printing of the instructions to use exactly the operands required. Also, fix printing of mod operations: s/%/%%/ in the print format. Also, fix printing of endian operations: remove extra spaces.
* Prepare 0.167 release.Mark Wielaard2016-08-0411-4315/+2795
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* dwelf: Add string table functions from ebl.Mark Wielaard2016-08-0332-231/+369
| | | | | | | | | | | | | | | | Move the strtab functions from libebl to libdw. Programs often want to create ELF/DWARF string tables. We don't want (static) linking against ebl since those are internal functions that might change. This introduces dwelf_strtab_init, dwelf_strtab_add, dwelf_strtab_add_len, dwelf_strtab_finalize, dwelf_strent_off, dwelf_strent_str and dwelf_strtab_free. Documentation for each has been added to libdwelf.h. The add fucntion got a variant that takes the length explicitly and finalize was changed to return NULL on out of memory instead of aborting. All code and tests now uses the new functions. Signed-off-by: Mark Wielaard <[email protected]>
* Remove eu-ld and unused code.Mark Wielaard2016-08-0337-14131/+72
| | | | | | | | Nobody has hacked on eu-ld in a very long time. It didn't really work. And we didn't install it by default in the spec file. Remove sources, the build rules and any (now) unused code. Signed-off-by: Mark Wielaard <[email protected]>
* Add m68k testsAndreas Schwab2016-07-1113-6/+134
| | | | Signed-off-by: Andreas Schwab <[email protected]>
* unstrip: Fix off by one array access with unstripped_strent.Mark Wielaard2016-07-112-3/+8
| | | | | | | | | | When configuring with --enable-sanitize-undefined the latest GCC found an array out of bounds access when running the un-strip-strmerge.sh test. We keep an array of section names. But skipped section zero, since it didn't have a name. We should however not actually skip the first array index (zero) when storing and reading the names. Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Allow updating phdrs for any e_type.Mark Wielaard2016-07-117-43/+249
| | | | | | | | | | | | | | | | | | | | | | | | elf[32|64]_updatenull would sanity check the e_type before allowing to update the phdrs. This prevents creating an ET_REL file with phdrs. It also prevents creating any vendor specific ELF file having phdrs. We only check this when updating/writing out the file. But we would just read such files. Don't prevent people from creating unexpected ELF files. elflint will warn for such files. While writing a new testcase for this another bug was found that prevented updating a just created phdr because elf_getphdrnum would sanity check the phdr offset in the file (which doesn't exist yet). Fix that by only doing such a sanity check if the phdrs haven't been read in or created yet. This second bug should have been found by the existing elfshphehdr test, but that test contained a typo checking elf_getphdrnum. It tested that the called failed when there were no phdrs, but then elf_getphdrnum should simply succeed and return zero. https://bugzilla.redhat.com/show_bug.cgi?id=1352232 Signed-off-by: Mark Wielaard <[email protected]>
* libelf: find 1st section instead of assumingJohn Ogness2016-06-286-25/+320
| | | | | | | | | | | | | | | | | | When getting section headers it is assumed that the first section is on the first section list. However, it is possible that the first section list only contains the zeroth section, in which case either illegal memory access occurs or elf_nextscn() erroneously returns NULL. With this patch, checks are added to avoid the illegal memory access and (if available) the second section list is looked at to find the first section. A new test emptyfile is added that tests adding a section to and "empty" ELF file 32/64 class with ELF_C_RDWR[_MMAP]. Signed-off-by: John Ogness <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* Add support for BPFRichard Henderson2016-06-2824-10/+590
| | | | Signed-off-by: Richard Henderson <[email protected]>
* Sync elf.h from glibcRichard Henderson2016-06-282-83/+202
| | | | | | | Add lots of new EM_* definitions. Add R_BPF_* definitions. Signed-off-by: Richard Henderson <[email protected]>
* CONTRIBUTING: Extend patch, committer and maintainer guidelines.Mark Wielaard2016-06-212-0/+57
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* Add support for m68kAndreas Schwab2016-05-2311-4/+550
| | | | Signed-off-by: Andreas Schwab <[email protected]>
* config: Pass the compiler -Werror during warning detectionFilipe Brandenburger2016-05-032-3/+6
| | | | | | | | | | | | | | Otherwise the compilation prints a warning but exits with 0 return code. However, later during the compilation, when -Werror is enforced to about every file, the unsupported options start breaking the builds. Tested: Ran configure with clang-3.5 and built libelf/ tree with it. $ autoreconf -i $ ./configure CC=clang-3.5 ... $ make -C libelf Signed-off-by: Filipe Brandenburger <[email protected]>
* config: Fix check for argp_parse to pass &argvFilipe Brandenburger2016-05-022-1/+5
| | | | | | | | | | | | | | | | | | | Right now it's passing a char* when it expects a char** instead. This usually produces a warning that may go unnoticed, but if CFLAGS contains -Werror, that breaks the ./configure run with the following error: $ ./configure CFLAGS=-Werror ... configure: WARNING: "libc does not have argp" checking for argp_parse in -largp... no configure: error: "no libargp found" Tested: Checked that after this fix, running ./configure CFLAGS=-Werror works as expected and argp_parse is correctly detected. Signed-off-by: Filipe Brandenburger <[email protected]>
* libdwfl: Fix memory leak in dwfl_module_getsrc_file on invalid DWARF.Mark Wielaard2016-04-142-0/+7
| | | | | | | If we allocated the match results array ourselves, then free it when we detect invalid DWARF and return an error. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: Fix memory leak in proc_maps_report on bad file mapping.Mark Wielaard2016-04-142-1/+9
| | | | | | | Normally last_file is freed inside report(), but in the case of a bad file mapping we don't call report. Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Fix memory leak when zlib deflateInit fails in elf_compress.Mark Wielaard2016-04-142-0/+6
| | | | | | On error we return NULL, not out_buf. So make sure to not leak it. Signed-off-by: Mark Wielaard <[email protected]>
* elfcmp: fix self-comparison error with GCC 6David Abdurachmanov2016-04-112-1/+5
| | | | | | | | | | | | Noticed with Fedora 24 Alpha, gcc (GCC) 6.0.0 20160406 (Red Hat 6.0.0-0.20). elfcmp.c: In function ‘main’: elfcmp.c:364:199: error: self-comparison always evaluates to false [-Werror=tautological-compare] if (unlikely (name1 == NULL || name2 == NULL Signed-off-by: David Abdurachmanov <[email protected]>
* Prepare 0.166 release.elfutils-0.166Mark Wielaard2016-03-3110-2786/+2863
| | | | Signed-off-by: Mark Wielaard <[email protected]>
* nm: Check for malloc size argument overflow in show_symbols.Mark Wielaard2016-03-212-0/+9
| | | | | Reported-by: Florian Weimer <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* config: Use --program-prefix=eu- by default.Mark Wielaard2016-03-023-0/+23
| | | | | | | | | | | | We want eu- as default program prefix if none was given by the user. But if the user explicitly provided --program-prefix="" then pretend it wasn't set at all (NONE). This makes sure all tools will be installed as eu-<program>. We want this default since most tools would normally conflict with the GNU binutils variants that have similar names. Signed-off-by: Mark Wielaard <[email protected]>
* libdwfl: clean up non-Linux GNU platforms codeSteven Chamberlain2016-03-022-63/+7
| | | | | | | | | | | | | | | | | | | For non-Linux GNU platforms (like kFreeBSD, Hurd), linux-pid-attach.c had some stub functions that are not used or exported. Since gcc-6, having these caused compiler errors due to -Wall -Werror: linux-pid-attach.c:479:36: error: 'pid_thread_callbacks' defined but not used [-Werror=unused-const-variable=] linux-pid-attach.c:474:1: error: 'pid_thread_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:461:1: error: 'pid_detach' defined but not used [-Werror=unused-function] linux-pid-attach.c:452:1: error: 'pid_set_initial_registers' defined but not used [-Werror=unused-function] linux-pid-attach.c:441:1: error: 'pid_memory_read' defined but not used [-Werror=unused-function] linux-pid-attach.c:420:1: error: 'pid_getthread' defined but not used [-Werror=unused-function] linux-pid-attach.c:410:1: error: 'pid_next_thread' defined but not used [-Werror=unused-function] This part of the source file is guarded by #ifndef __linux__ Signed-off-by: Steven Chamberlain <[email protected]>
* sparc: restore 32-bit build.Jose E. Marchesi2016-02-262-1/+7
| | | | | | | This patch provides a dummy sparc_set_initial_registers-tid for sparc32. This fixes the build in sparcv9-*-* targets. Signed-off-by: Jose E. Marchesi <[email protected]>
* Add support for DT_PPC_OPTAndreas Schwab2016-02-262-1/+9
| | | | | | https://sourceware.org/ml/binutils/2013-10/msg00378.html Signed-off-by: Andreas Schwab <[email protected]>
* libdwfl: Check for kernel debuginfo file without .debug extension as wellRavi Bangoria2016-02-223-9/+36
| | | | | | | | | | | | | | | | | | | | | Elfutils, looking for kernel debuginfo file, tries to find it at various places. If elfutils finds /boot/vmlinu*x* file, it checks for debufginfo section. If debuginfo is not present, it saves it as 'main elf' and continue looking for debuginfo file having .debug extension i.e. vmlinux-RELEASE.debug. 'Ubuntu on powerpc' installs kernel as /boot/vmlinux and installs debuginfo without any extension as /usr/lib/debug/boot/vmlinux-RELEASE and hence, elfutils is not able to find the debuginfo file. Here is the launchpad bug for the same: https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/1537125 This patch adds functionality to search for a kernel or debuginfo file both with and without .debug extension. Signed-off-by: Ravi Bangoria <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Warn when uncompressing fails and error when gelf_getshdr fails.Mark Wielaard2016-02-222-5/+46
| | | | | | | | After decompressing we want to get the new shdr. This can theoretically fail so we have to check. Also warn the user if a section couldn't be uncompressed. Signed-off-by: Mark Wielaard <[email protected]>