summaryrefslogtreecommitdiff
path: root/backends
Commit message (Collapse)AuthorAgeFilesLines
* backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).Mark Wielaard2015-01-152-1/+6
| | | | | | Found with afl-fuzz. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* avoid scary command outputUlrich Drepper2014-12-182-1/+5
| | | | | | The commands to check for invalid text relocations in the generated DSOs shouldn't be displayed. They contain an echo which prints the text. This patch suppresses the commands from being printed.
* Use elf_getphdrnum instead of accessing ehdr->e_phnum directly.Mark Wielaard2014-11-263-8/+18
| | | | | | | Using elf_getphdrnum lets us handle ELF files that use more than PN_XNUM phdrs. And guards against some corrupt files. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Check elf_strptr didn't fail getting section name.Mark Wielaard2014-11-172-6/+13
| | | | | | | | Since elf_strptr can fail and return NULL we should always check the result before usage. Debug sections are only handled by section name, so make sure the name actually exists. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdw: Add dwarf_peel_type. Use it in dwarf_aggregate_size.Mark Wielaard2014-11-052-18/+9
| | | | | | | | | | | | | | | Add new function dwarf_peel_type. Some type annotations in DWARF are specified by modifier tag type wrappers instead of attributes. For type aliases (typedef) and qualifiers (const, volatile, restrict) tags dwarf_peel_type follows the DW_AT_type attributes till it finds a base, user-defined, reference or pointer type DIE. Use this new function in the backends for return type DIEs (replacing the existing dwarf_peel_type there) and in dwarf_aggregate_size so it can provide the sizes for qualified types too. Add a new version and testcase for the new dwarf_aggregate_size functionality. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* aarch64: use <sys/user.h> defined register structuresKyle McMartin2014-08-013-4/+22
| | | | | | | | | | | glibc now supplies these (compatible) structs instead of including the kernel's <asm/ptrace.h> header, so let's use them. Annoyingly this will cause new elfutils to FTBFS on old glibc, and vice versa. So include a new configure check for the new struct names and use the old ones if they are not avilable. Signed-off-by: Kyle McMartin <kyle@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Add ppc64le ELFv2 abi support to backends and elflint.Mark Wielaard2014-07-044-1/+37
| | | | | | | | | | The big endian vs little endian changes are already handled by detecting the EI_DATA data encoding. And the function descriptors are already not used when we see there is no .opd section. This change adds new checks for st_other bits, new relocations and recognizes DT_PPC64_OPT. Signed-off-by: Menanteau Guy <menantea@linux.vnet.ibm.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: aarch64_return_value_location should handle DW_ATE_boolean.Mark Wielaard2014-07-042-0/+6
| | | | | | | Found with run-native-test.sh om debian arm64. http://bugs.debian.org/753552 Signed-off-by: Mark Wielaard <mjw@redhat.com>
* dwarf.h: Remove non-existing DW_TAG_mutable_type.Mark Wielaard2014-06-222-2/+7
| | | | | | | | | | | | | | | The DW_TAG_mutable_type was only mentioned in an early draft of DWARFv3. But was removed because there are no C++ mutable qualified types. It was replaced by a new attribute DW_AT_mutable on DW_TAG_member DIEs. The new attribute is available in dwarf.h. http://dwarfstd.org/ShowIssue.php?issue=050223.1 DW_TAG_mutable_type was only used internally in some backends (which just ignored it anyway). dwarves did use it to turn it into a string value, libabigail used it and ignored it (patches to remove sent). GCC, GDB and binutils don't use nor define it. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libebl: Add ebl_func_addr_mask plus ARM backend implementation.Mark Wielaard2014-06-222-0/+7
| | | | | | | | | | | | | | The ARM EABI says that the zero bit of function symbol st_value indicates whether the symbol points to a THUMB or ARM function. Also the return value address in an unwind will contain the same extra bit to indicate whether to return to a regular ARM or THUMB function. Add a new ebl function to mask off such bits and turn a function value into a function address so that we get the actual value that a function symbol or return address points to. It isn't easily possible to reuse the existing ebl_resolve_sym_value for this purpose, so we end up with another hook that can be used from dwfl_module_getsym, handle_cfi and elflint. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends (*_return_value_location): call dwarf_peeled_die_typePetr Machata2014-06-2012-325/+208
| | | | | | ... instead of inlining equivalent code. Signed-off-by: Petr Machata <pmachata@redhat.com>
* backends: Add ebl_check_reloc_target_type.Mark Wielaard2014-05-195-3/+26
| | | | | | | | | And implement for arm and ia64. Both have special section types that are valid targets for a reloc. Both refer to unwind data. elflint now just calls ebl_check_reloc_target_type instead of hard coding the expected section types. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Unwinding is only supported on LinuxKurt Roeckx2014-04-233-2/+7
| | | | Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
* Remove mudflap build option.Mark Wielaard2014-04-182-6/+6
| | | | | | | | | The --enable-mudflap configure build has been broken for 2 years without anybody apparently noticing. GCC 4.9 removed mudflap support. Before release we now run make distcheck with valgrind support. Removal of the mudflap configure option simplifies the build a little. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Add aarch64 native and core unwind support.Mark Wielaard2014-04-145-2/+104
| | | | | | | | Add aarch64 backend functions frame_nregs and set_initial_registers_tid. Mark pc_register in aarch64 prstatus_regs as pc_register. Add backtrace-core-aarch64 testcase. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: add ARM compatible mode to AARCH64Jean Pihet2014-03-302-2/+37
| | | | | | | | | Add the initial register setup for AARCH64 running ARM code (so called compat mode). This makes 'eu-stack -p' happy on ARM binaries while running on a AARCH64 kernel. Signed-off-by: Jean Pihet <jean.pihet@linaro.org> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: AARCH64_ABS32 and AARCH64_ABS64 are also valid in ET_REL.Mark Wielaard2014-03-192-3/+8
| | | | | | | This is tested now in a native aarch64 build by tests/run-elflint-self.sh since we added some .o files to the self tests. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Make aarch64_regs.c checkable by -WprintfPetr Machata2014-01-302-22/+21
|
* backends: Add arm frame_nregs and set_initial_registers_tid.Mark Wielaard2014-01-304-2/+71
| | | | | | | | | | | | | This allows CFI unwinding for ARM. It relies on having .debug_frame around which is always the case in our testsuite. All native backtrace tests PASS on arm if debuginfo (for glibc) is installed on the system. Otherwise the tests SKIP. For non-debug unwinding ARM uses EXIDX tables, not .eh_frames, which would have to be translated to CFI to do unwinding without .debug_frame available. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: arm_cfi SP (r13) is restored from CFA by default.Mark Wielaard2014-01-302-0/+7
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Update arm_reloc.def.Mark Wielaard2014-01-302-2/+83
| | | | | | | | | The elflint self test now also checks ET_REL files. Update the list of relocation types to include all known relocations from elf.h. R_ARM_SWI24 was obsolete and is now named R_ARM_TLS_DESC. The only other relocation used in the dynamic linker is R_ARM_IRELATIVE. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Use -Wformat=2 by default for all files.Mark Wielaard2014-01-303-9/+34
| | | | | | | | This just makes sure that all format strings are given as literals to printf like functions so the compiler can see and check them. Remove all no_Wformat, add -Wformat=2 unconditionally to AM_CFLAGS. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: aarch64_check_special_symbol check shdr is not NULL before usage.Mark Wielaard2014-01-172-3/+11
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Add PPC64 machine_flag_check.Mark Wielaard2014-01-043-2/+18
| | | | | | | | | | To distinguish between the current PPC64 ELF ABI and the revised ELFv2 ABI that will not use function descriptors binutils started to emit the version (currently 1) in the ehdr e_flags. Recognize all valid versions (0, 1 or 2) in elflint by adding the hook ppc64_machine_flag_check. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Add aarch64 abi_cfi.Mark Wielaard2014-01-035-2/+92
| | | | | | | | Setup initial CIE values for aarch64 for use with dwarf_frame functions. Register info prefix should be the empty string (not NULL) when not used. Add an EM_AARCH64 testcase to tests/run-addrcfi.sh to check both issues. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: aarch64 always has _GLOBAL_OFFSET_TABLE_ point to .got[0].Mark Wielaard2013-12-203-0/+34
| | | | | | | | | | | Like some other architectures aarch64 has a special rule for the _GLOBAL_OFFSET_TABLE_ symbol. Even if there is a .plt.got section the symbol value still points to the start of the .got section. This is also what the dynamic linker expects. See https://sourceware.org/ml/libc-ports/2013-06/msg00057.html Signed-off-by: Mark Wielaard <mjw@redhat.com>
* libdwfl: Introduce dwfl_module_getsym_info and dwfl_module_addrinfo.Mark Wielaard2013-12-204-1/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some arches like ppc64 use function descriptor values instead of function addresses causing matching of names and addresses to fail when using dwfl_module_getsym or dwfl_module_addrsym. Add ebl hook to resolve any function descriptor values found in non-ET_REL modules. The new function dwfl_module_getsym_info doesn't adjust the symbol value in any way, but returns the adjusted and/or resolved address associated with the symbol separately. The new function dwfl_module_addrinfo resolves against both the address associated with the symbol (which could be the function entry address) value and the adjusted st_value. So that it is easy to resolve and match either function descriptors and/or function entry addresses. Since these new functions also return more information they replace the dwfl_module_getsym_elf and dwfl_module_addrsym_elf functions that never made it into a released elfutils version. addr2line and readelf now use the new functions when looking up functions names. addr2line will now also display the section the address was found in when given -x. Extra testcases were added for both addr2line and the dwflsyms testscase. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Fix s390_initreg.c patch copy/paste error.Mark Wielaard2013-12-182-4/+1
| | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Avoid type-punning issue in s390_set_initial_registers_tid.Mark Wielaard2013-12-182-2/+18
| | | | | | | | Use union to avoid type-punning when assigning a double to a Dwarf_Word. gcc complains otherwise. error: dereferencing type-punned pointer will break strict-aliasing rules. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* unwinder: s390 and s390xJan Kratochvil2013-12-186-6/+253
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* unwinder: ppc and ppc64Jan Kratochvil2013-12-156-3/+136
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Support AArch64 architecturePetr Machata2013-11-269-6/+968
| | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
* Unwinder for x86*.Jan Kratochvil2013-11-076-4/+176
| | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: ppc_abi_cfi reg1 use DW_CFA_val_offset not DW_CFA_val_expression.Mark Wielaard2013-10-072-1/+6
| | | | | | | | | | | | | | | Register rules using expressions are stored using an offset from the start of the .eh_frame or .debug_frame ELF section data. Since abi_cfi rules aren't stored in those ELF sections they should use neither DW_CFA_expression nor DW_CFA_val_expression. The only backend that used DW_CFA_val_expression was ppc_cfi.c. It was easier to express the same rule using DW_CFA_val_offset than to change the code to handle register rules using expressions. On most architectures this did work by accident. See the definition of struct dwarf_frame_register value in libdw/cfi.h to see why. But on ia64 the abi_cfi data and actual frame data were placed too far apart and caused a crash in tests/run-addrcfi.sh for ppc32. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Hook abi_cfi for arm.Mark Wielaard2013-09-034-2/+96
| | | | | | | | | | | | | | | | | | | | | | New arm_abi_cfi that defines initial CFA, rules for callee-saved regs, including VFP ones and return register. Note the DWARF abi extension for ARM says that "registers intentionally unused" should also be initialized as if by DW_CFA_same_value. The example given is "an integer-only function might be included in one executable file for targets with VFP and another for targets without". We don't currently do this yet. See the DWARF and calling convention documents: DWARF for the ARM Architecture ABI r2.09 http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf Procedure Call Standard for the ARM Architecture ABI r2.09 http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf Also adds addrcfi arm testcase. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Hook abi_cfi for ppc and s390.Jan Kratochvil2013-09-027-7/+164
| | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends: Always set *prefix to "" when not used in register_info hook.Mark Wielaard2013-09-024-3/+9
| | | | | | | | | | | | For ia64 and tilegx *prefix was already set to the empty string, but arm, ppc and sh used NULL to indicate no prefix preceded the register name in the canonical assembler syntax. Consistently use the empty string in all backends since dwfl_module_register_names says: 'a prefix used in assembler syntax (such as "%" or "$", may be "")'. So users had to handle the empty string already, and might forget to handle the NULL case (like our own addrcfi testcase). Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Updates for Automake 1.13.Mark Wielaard2013-04-262-1/+5
| | | | | | | autoreconf will install config/test-driver, ignore it. Update gettext m4 and po files to version 0.18.2. Use AM_CPPFLAGS instead of INCLUDES. All changes are backward compatible with Automake 1.11.
* backends: Check type DIE exists before calling dwarf_tag ().Mark Wielaard2013-02-0613-36/+59
| | | | | | | | | | | | | dwarf_attr () or dwarf_form () functions leave typedie NULL when they fail because of missing attribute or unexpected form. In such cases first check the DIE exists and return error instead of calling dwarf_tag () and crashing. This also happens in the testsuite with native tests when elfutils is build without DWZ support on a distro that uses DWZ DWARF compression on system libraries. Only the backends used dwarf_tag () directly without checking, all other uses in elfutils already checked whether the given DIE was NULL. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* backends/Jan Kratochvil2013-01-306-2/+234
| | | | | | | | | | | | | | | | | | | | | * Makefile.am (s390_SRCS): Add s390_corenote.c and s390x_corenote.c. * linux-core-note.c (ALIGN_PR_REG): New definitions. (struct EBLHOOK(prstatus)): Change field pr_reg to anonymous struct with ALIGN_PR_REG. (EXTRA_ITEMS): New macro. * s390_corenote.c: New file. * s390_init.c (s390x_core_note): New declaration. (s390_init): Install s390x_core_note and s390_core_note. * s390x_corenote.c: New file. tests/ * run-readelf-mixed-corenote.sh: New testcase for readelf -n of s390 and s390x core notes. * testfile67.bz2: New file. * testfile68.bz2: New file. * Makefile.am (EXTRA_DIST): Add testfile67.bz2 and testfile68.bz2 . Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* backends/Jan Kratochvil2013-01-302-1/+5
| | | | | | * arm_corenote.c (vfp_items): Remove zero COUNT initializer. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* src/Jan Kratochvil2012-10-122-2/+9
| | | | | | | | | | | | | | | | | | | | | | 2012-10-12 Jan Kratochvil <jan.kratochvil@redhat.com> * readelf.c (ITEM_WRAP_COLUMN, REGISTER_WRAP_COLUMN): Merge to ... (WRAP_COLUMN): ... here. (print_core_item): Remove parameter format_max. Update function comment. Replace FORMAT_MAX by the real output width. (handle_core_item): Remove the FORMAT_MAX values in TYPES, DO_TYPE, calls of print_core_item, remove variable maxfmt, change ITEM_WRAP_COLUMN to WRAP_COLUMN. (handle_core_register): Remove the FORMAT_MAX values in TYPES, BITS, calls of print_core_item, change REGISTER_WRAP_COLUMN to WRAP_COLUMN. backends/ 2012-10-12 Jan Kratochvil <jan.kratochvil@redhat.com> * linux-core-note.c (prstatus_items): Rename groups of sigpend and sighold to signal2 and signal3. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Add back end code for interpreting NT_ARM_VFP core note.Petr Machata2012-09-253-1/+36
| | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
* Change FPREGSET_SIZE in ARM backend to 116 to match sizeof struct user_fpPetr Machata2012-09-242-1/+5
| | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
* Add support for Tilera TILE-Gx processor.Jeff Kenton2012-08-248-2/+617
| | | | Signed-off-by: Jeff Kenton <jkenton@tilera.com>
* Update name, license and contributor policy.Mark Wielaard2012-06-0573-1169/+1387
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change name from "Red Hat elfutils" to "elfutils". * Update license of standalone tools and test from GPLv2 to GPLv3+. * Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+. * Add Developer Certificate of Origin based contributor policy. top-level: - COPYING: Upgraded from GPLv2 to GPLv3. - CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files. - NEWS: Added note about new contribution and license policy. - Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST. - configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'. backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf: - All files updated to GPLv2/LGPLv3+. Except some very small files (<5 lines) which didn't have any headers at all before, the linker .maps files and the libcpu/defs files which only contain data and libelf/elf.h which comes from glibc and is under LGPLv2+. config: - elfutils.spec.in: Add new License: headers and new %doc files. - Update all license headers to GPLv2/LGPLv3+ for files used by libs. src, tests: - All files updated to GPLv3+. Except for the test bz2 data files, the linker maps and script files and some very small files (<5 lines) that don't have any headers. Signed-off-by: Richard Fontana <rfontana@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Add new ebl_check_st_other_bits function.mpolacek/autotestMark Wielaard2011-03-113-0/+16
|
* Alpha backend: accept any _GLOBAL_OFFSET_TABLE_ value.Roland McGrath2011-03-093-2/+28
|
* backends: i386 integer return value typo fix, reported by Thorsten Glaser ↵Roland McGrath2010-11-082-2/+7
| | | | <tg@mirbsd.de>.
* Adjust copyrights.Ulrich Drepper2010-04-133-3/+6
| | | | | | | | | | As I wrote when accepting the patches, there is nothing innovative in these patches. These are copies of the files from other archs with SH-specific data filled in from the ELF adn Dwarf spec. Attribution is given but ownership is with Red Hat. This is so far the only way since Red Hat doesn't have an assignment process in place yet.