summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Avoid undefined behavior in argp-parse.cQtCreator4.6.2QtCreator4.6.0-rc1QtCreator4.6.0-beta1QtCreator4.6.04.6Ulf Hermann2018-01-161-6/+9
| | | | | | | | | | | | The shifting-instead-of-masking trick outlined there is very clever, but only works incidentally. Explicitly preserve the sign, and still shift, but shift unsigned values for which left-shifting bits out is defined. make distcheck complains about the previous code with sufficiently recent compilers with UB sanitizers. Change-Id: I6f2942f307a2c154ea7d414a85c60e4f088fc918 Reviewed-by: Christian Kandeler <[email protected]>
* Explicitly remove test files in run-strip-remove-keep.shQtCreator4.7.2QtCreator4.7.1QtCreator4.7.0-beta2QtCreator4.7.0-beta1QtCreator4.7.0QtCreator4.11.14.7Ulf Hermann2017-12-211-0/+14
| | | | | | | | strip moves the output files into place by calling rename(). On windows you cannot rename a file if the target file already exists. Change-Id: Ia296c1a357fa8e3610989f77b8149444e0863456 Reviewed-by: Christian Kandeler <[email protected]>
* Add a windows specific READMEUlf Hermann2017-12-211-0/+24
| | | | | | | Building this on windows is tricky. Change-Id: I5e30b4438dab37672ca38a8b661f1e6438ebb796 Reviewed-by: Christian Kandeler <[email protected]>
* libdw: Add explicit section index to struct Dwarf_CUUlf Hermann2017-12-215-3/+19
| | | | | | | | | | | | | | | | The DIE (attribute) data might come from either the main .debug_info section or for DWARFv4 from a separate .debug_types section. Or in case of the fake_loc_cu from the .debug_loc section and in the case of macros from the .debug_macinfo or .debug_macro section. We didn't handle the last two "fake" CU cases correctly when sanity checking offsets in __libdw_read_address and __libdw_read_offset. Add an explicit sec_idx field to struct Dwarf_CU that is always set to the actual section that the data came from. Change-Id: I83260622b55d3778a38cd46427dba158d186c51e Reviewed-by: Christian Kandeler <[email protected]>
* Don't overflow in __libdw_in_section and __libdw_offset_in_sectionUlf Hermann2017-12-212-2/+11
| | | | | | | | This exposes a bug in dwarf_formstring as detected by the dwarf-getmacros test before we made sure to use the correct sec_idx for the CU. Change-Id: I6544d42b719587dd94330db484512bde6ce34e55 Reviewed-by: Christian Kandeler <[email protected]>
* Fix typos in lib/Makefile.amUlf Hermann2017-12-111-3/+7
| | | | | | | | We want to uninstall the compat library in the uninstall step and we want to properly clean the build artifacts on make clean. Change-Id: Id26a80c19a68fb79a9194d0065f81b5a189af8d1 Reviewed-by: Christian Kandeler <[email protected]>
* Check native binary format on new testsUlf Hermann2017-12-112-0/+10
| | | | | | | | run-strip-g.sh and run-strip-nothing.sh compile a file and then strip the result. This will only work if the compiler produces ELF files. Change-Id: I739ba0c1be96dca2278a672f5f67a90bc6ce12fa Reviewed-by: Christian Kandeler <[email protected]>
* Be stricter about frame pointer unwinding on ARMUlf Hermann2017-11-241-9/+11
| | | | | | | | | There were too many false positives. We require reasonable values for SP and FP now, and we check that the new value for LR is not null before we set anything. Change-Id: I91ca205d0f0ad00e1934f2007d7aa998bb597b35 Reviewed-by: Christian Kandeler <[email protected]>
* Merge tag 'elfutils-0.170'Ulf Hermann2017-08-1778-1409/+3616
|\ | | | | | | | | | | elfutils 0.170 release Change-Id: I37d03645902b9f0a9fb708af1551db8843537799
| * Prepare for 0.170.elfutils-0.170Mark Wielaard2017-08-0211-1148/+1306
| | | | | | | | | | | | | | Set version to 0.170. Update po/*.po files. Add some more user visible changes to NEWS. Signed-off-by: Mark Wielaard <[email protected]>
| * backends: sparc GOTDATA_OP[_HIX22|LOX10] can be used in ET_REL files.Mark Wielaard2017-08-022-3/+8
| | | | | | | | | | | | Tested on new GNU Compile Farm server gcc202. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add DW_MACRO constants and DW_MACRO_GNU compatibility defines.Mark Wielaard2017-08-029-44/+152
| | | | | | | | | | | | | | | | | | | | 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 DWARF5 immutable, packed and shared in dwarf_peel_type.Mark Wielaard2017-08-025-12/+34
| | | | | | | | | | | | | | | | | | | | 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 peeled. Explicitly mention pointer and reference types as examples of modifiers that don't obey that rule and so aren't peeled. Signed-off-by: Mark Wielaard <[email protected]>
| * Handle DWARF5 defaulted member function encodings.Mark Wielaard2017-08-026-3/+52
| | | | | | | | | | | | | | | | | | Add DW_DEFAULTED_no, DW_DEFAULTED_in_class and DW_DEFAULTED_out_of_class to dwarf.h. Print value (no, in_class or out_of_class) of DW_AT_defaulted in readelf. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: DWARF5 Add DW_CC_pass_by_reference and DW_CC_pass_by_reference.Mark Wielaard2017-08-024-3/+16
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add dwarf_default_lower_bound.Mark Wielaard2017-08-0213-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 Wielaard2017-08-025-5/+37
| | | | | | | | | | | | | | | | | | | | Add DW_LANG_OpenCL, DW_LANG_Modula3, DW_LANG_C_plus_plus_03, DW_LANG_OCaml, DW_LANG_Rust, DW_LANG_Swift, DW_LANG_Julia, DW_LANG_Dylan, DW_LANG_RenderScript and DW_LANG_BLISS to dwarf.h. Update default language array lower bounds in dwarf_aggregate_size.c. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add new DWARF5 character encodings.Mark Wielaard2017-08-024-2/+10
| | | | | | | | | | | | | | Add DW_ATE_UCS and DW_ATE_ASCII for Fortran 2003 string kinds ASCII (ISO/IEC 646:1991) and ISO_10646 (UCS-4 in ISO/IEC 10646:2000). Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add new DWARF5 tag constants.Mark Wielaard2017-08-024-5/+23
| | | | | | | | | | | | | | | | | | | | 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 DWARF5 attributes.Mark Wielaard2017-08-024-8/+71
| | | | | | | | | | | | | | | | | | | | | | | | Add new DWARF5 attribute constant names to the attributes enum. Also add reserved comments between non-consecutive (reserved) numbers. Remove DW_AT_subscr_data, DW_AT_element_list and DW_AT_member from the enum list and turn them into compatibility defines because they are not part of DWARF2+. That way code that directly references them still compiles but they won't show up in known-dwarf.h. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwfl: Move nested functions in parse_opt to file scope.Yunlian Jiang2017-07-272-26/+34
| | | | | | | | | | | | | | * Move nested function 'failure' to file scope to compile with clang. * Move nested function 'fail' to file scope to compile with clang. Signed-off-by: Yunlian Jiang <[email protected]>
| * libdw: Add dwarf_line_file.Mark Wielaard2017-07-267-1/+97
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * ppc64: Add HTM SPRs support to readelfGustavo Romero2017-07-2510-18/+58
| | | | | | | | | | | | | | | | | | | | Since POWER8, PowerPC 64 supports Hardware Transactional Memory, which has three special purpose registers associated to it: tfhar, tfiar, and texasr. This commit add HTM SPRs set as known note type so it's possible to use 'readelf --notes' to inspect the HTM SPRs in a coredump file generated in such a machines. Signed-off-by: Gustavo Romero <[email protected]>
| * strip: Deal with ARM data marker symbols pointing to debug sections.Mark Wielaard2017-07-2416-17/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARM data marker symbols "$d" indicate the start of a sequence of data items in a section. For data only sections no data marker symbol is necessary, but may be put pointing to the start of the section. binutils however has a bug which places a data marker symbol somewhere inside the section (at least for .debug_frame). https://sourceware.org/bugzilla/show_bug.cgi?id=21809 When strip finds a symbol pointing to a debug section that would be put into the .debug file then it will copy over the whole symbol table. This isn't necessary because the symbol is redundant. Add an ebl hook to recognize data marker symbols with implementations for arm and aarch64. Use it in strip to strip such symbols from the symbol table if they point to a debug section. Signed-off-by: Mark Wielaard <[email protected]>
| * backends: Don't depend on linux/bpf.h to compile bpf disassembler.Mark Wielaard2017-07-2415-29/+115
| | | | | | | | | | | | | | | | | | We only need a few constants and one structure definition from linux/bpf. Just define those in a local lib/bpf.h file. This makes sure the bpf disassembler is always build and included even when elfutils is build on older GNU/Linux systems (and even on other platforms). Signed-off-by: Mark Wielaard <[email protected]>
| * Write to /dev/null rather than /dev/zeroUlf Hermann2017-07-242-1/+5
| | | | | | | | | | | | | | /dev/zero is meant for reading zeroes. /dev/null is for writing into nirvana. Signed-off-by: Ulf Hermann <[email protected]>
| * Unify linking of libasm, libelf, libdw, backendsUlf Hermann2017-07-248-20/+64
| | | | | | | | | | | | | | | | | | | | Link them all with -z,defs,-z,relro,--no-undefined, provide complete dependencies for the link steps, and add libeu.a to each one. libeu.a contains useful library functionality that each of them might use. The linker will strip unneeded symbols, so linking it in won't hurt even if none of the functions are used. Signed-off-by: Ulf Hermann <[email protected]>
| * backends: Swap sys/ptrace.h and asm/ptrace.h include order on s390.Mark Wielaard2017-07-172-1/+5
| | | | | | | | | | | | | | | | | | glibc 2.26 changed the sys/ptrace.h header so that it cannot be included after asm/ptrace.h. We still need to include the kernel asm/ptrace.h for the ptrace_area definition. Including it after sys/ptrace.h works against both old and new glibc. Signed-off-by: Mark Wielaard <[email protected]>
| * strip: Add --keep-section=SECTION and --remove-section=SECTION.Mark Wielaard2017-07-177-19/+827
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds two new output options: --keep-section=SECTION Keep the named section. SECTION is an extended wildcard pattern. May be given more than once. --remove-section=SECTION Remove the named section. SECTION is an extended wildcard pattern. May be given more than once. Only non-allocated sections can be removed. The --remove-section was already partially implemented, but only for the .comment section. The short option -R is to be compatible with binutils. The new testcase makes sure that various combinations of kept/removed sections pull the correct dependencies into the output and/or debug files. https://bugzilla.redhat.com/show_bug.cgi?id=1465997 Signed-off-by: Mark Wielaard <[email protected]>
| * Support EM_PPC machine flagsAndreas Schwab2017-06-153-0/+16
| | | | | | | | | | | | | | This fixes the elflint self test when the compiler is configured for PIE default. Signed-off-by: Andreas Schwab <[email protected]>
| * strip: Don't generate empty output file when nothing to do.Mark Wielaard2017-06-145-12/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there was nothing to do strip would skip generating a separate debug file if one was requested, but it would also not finish the creation of a new output file (with the non-stripped sections). Also if there was an error any partially created output would be kept. Make sure that when the -o output file option is given we always generate a complete output file (except on error). Also make sure that when the -f debug file option is given it is only generated when it is not empty. Add testcase run-strip-nothing.sh that tests the various combinations. https://sourceware.org/bugzilla/show_bug.cgi?id=21522 Signed-off-by: Mark Wielaard <[email protected]>
| * strip: Make sure old .shstrab is removed when eu-strip recreates it.Mark Wielaard2017-06-144-6/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although we always recreate the .shstrtab section for the new output file we never explicitly assumed it could be removed. It might not be possible to remove it when the section string table is shared with a symbol table. But if it is removable we should (and recreate it for the new section list). Regression introduced in commit elfutils-0.163-33-gdf7dfab. "Handle merged strtab/shstrtab string tables in strip and unstrip." Add extra testcase to explicitly check for this case. https://sourceware.org/bugzilla/show_bug.cgi?id=21525 Signed-off-by: Mark Wielaard <[email protected]>
| * ppc64: Add minimal fallback unwinder.Mark Wielaard2017-06-1210-2/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a minimal fallback unwinder for ppc64[le] in case we cannot find CFI for a particular address. It simply always sets the program counter to the link register, picks the previous stack pointer from the backchain, and the previous link register from the LR save area. This is enough for some simple situations when we don't have CFI and seems to work nicely in the case of perf with libdw powerpc support: https://lkml.org/lkml/2017/5/18/998 Signed-off-by: Mark Wielaard <[email protected]>
* | Merge tag 'elfutils-0.169'QtCreator4.5.1QtCreator4.5.0-rc1QtCreator4.5.0QtCreator4.4.1QtCreator4.4.0-rc1QtCreator4.4.0-beta1QtCreator4.4.04.54.4Ulf Hermann2017-05-0845-5150/+5700
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: ChangeLog backends/ChangeLog config/ChangeLog lib/ChangeLog libasm/ChangeLog libcpu/ChangeLog libdw/ChangeLog libdwfl/ChangeLog libdwfl/derelocate.c libdwfl/linux-kernel-modules.c libebl/ChangeLog libelf/ChangeLog src/ChangeLog tests/ChangeLog Change-Id: I3b7ced947c6498290aaae27443985b84531f0bcd
| * Prepare for 0.169.elfutils-0.169Mark Wielaard2017-05-0513-5079/+5189
| | | | | | | | | | | | | | Set version to 0.169. Update copyright year. Update po/*.po files. And add user visible changes to new 0.169 NEWS section. Signed-off-by: Mark Wielaard <[email protected]>
| * Make elf section sorting more deterministicUlf Hermann2017-05-032-1/+13
| | | | | | | | | | | | | | | | | | 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 section index to tell entries apart. Signed-off-by: Ulf Hermann <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * Don't look for kernel version if not running on linuxUlf Hermann2017-05-022-0/+13
| | | | | | | | | | | | | | We don't want to use it, even if it exists. Signed-off-by: Ulf Hermann <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * Add frame pointer unwinding for aarch64 and relax backtrace testcases.Ulf Hermann2017-05-0211-2/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we don't find any debug information for a given frame, we usually cannot unwind any further. However, the binary in question might have been compiled with frame pointers, in which case we can look up the well known frame pointer locations in the stack snapshot and use them to bridge the frames without debug information. Relax the backtrace core testcases a little by allowing a duplicate sigusr2 frame or a backtrace ending with an invalid register. Both of which can happen if the frame pointer unwinder guesses slightly wrong. Signed-off-by: Ulf Hermann <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
| * Add i386 frame pointer unwinder.Mark Wielaard2017-05-029-3/+135
| | | | | | | | | | | | | | Add a simple i386_unwind.c frame pointer unwinder as fallback if DWARF/CFI unwinding fails. Signed-off-by: Mark Wielaard <[email protected]>
| * Add frame pointer unwinding as fallback on x86_64Ulf Hermann2017-05-029-1/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If we don't find any debug information for a given frame, we usually cannot unwind any further. However, the binary in question might have been compiled with frame pointers, in which case we can look up the well known frame pointer locations in the stack snapshot and use them to bridge the frames without debug information. The "unwind" hook is the right place for this as it is so far only used on s390 and called only after trying to unwind with debug information. Signed-off-by: Ulf Hermann <[email protected]>
| * tests: Add core backtracegen check and regen ppc32 backtrace testfiles.Mark Wielaard2017-05-025-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a check to check_core to make sure the backtracegen function is found in the backtrace. This function is in the middle of the backtrace in the main executable and if not found it means the backtrace was incomplete or the frame was skipped (which could happen on a bad frame pointer only unwind). This showed that the ppc32 backtrace test files were missing DWARF CFI for the main executable. Regenerated them to include full CFI. Signed-off-by: Mark Wielaard <[email protected]>
| * Revert "Optionally allow unknown symbols in the backtrace tests"Mark Wielaard2017-05-023-31/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f9971cb422df39adea7e8c7e22689b879e39c626. Allowing no symbol resolving at all makes it too hard to see whether the test actually tests anything. But do keep "address out of range" as allowed error in check_err. This can be interpreted as DWARF not available (if end of callstack marker is missing, which it unfortunately often is missing even if CFI is available.). Signed-off-by: Mark Wielaard <[email protected]>
| * Avoid double-including config.hUlf Hermann2017-05-0262-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. Signed-off-by: Ulf Hermann <[email protected]>
| * Use F_GETFD rather than F_GETFL to check validity of file descriptorUlf Hermann2017-05-022-1/+5
| | | | | | | | | | | | | | F_GETFD is both cheaper and easier to port, and otherwise has the same effect here. Signed-off-by: Ulf Hermann <[email protected]>
| * Make __attribute__ conditional in all installed headersUlf Hermann2017-05-028-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. Signed-off-by: Ulf Hermann <[email protected]>
| * Fix nesting of bracesUlf Hermann2017-04-282-1/+5
| | | | | | | | | | | | | | | | 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. Signed-off-by: Ulf Hermann <[email protected]>
| * On elf_update, remember when we mmap()Ulf Hermann2017-04-282-0/+6
| | | | | | | | | | | | Otherwise we skip the munmap() later. This leaks resources. Signed-off-by: Ulf Hermann <[email protected]>
| * Avoid signed/unsigned comparisonUlf Hermann2017-04-272-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. Signed-off-by: Ulf Hermann <[email protected]>
| * Include strings.h to make ffs availableUlf Hermann2017-04-272-0/+5
| | | | | | | | | | | | We cannot rely on it to be available from any of the other headers. Signed-off-by: Ulf Hermann <[email protected]>
| * Protect against integer overflow on shnumUlf Hermann2017-04-274-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. Signed-off-by: Ulf Hermann <[email protected]>