summaryrefslogtreecommitdiffstats
path: root/libdw
Commit message (Collapse)AuthorAgeFilesLines
* 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]>
* Merge tag 'elfutils-0.170'Ulf Hermann2017-08-1712-97/+424
|\ | | | | | | | | | | elfutils 0.170 release Change-Id: I37d03645902b9f0a9fb708af1551db8843537799
| * libdw: Add DW_MACRO constants and DW_MACRO_GNU compatibility defines.Mark Wielaard2017-08-023-22/+50
| | | | | | | | | | | | | | | | | | | | 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-023-12/+29
| | | | | | | | | | | | | | | | | | | | 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-022-0/+13
| | | | | | | | | | | | | | | | | | 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-022-1/+10
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add dwarf_default_lower_bound.Mark Wielaard2017-08-028-53/+119
| | | | | | | | | | | | | | | | | | | | 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-023-1/+33
| | | | | | | | | | | | | | | | | | | | 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-022-0/+6
| | | | | | | | | | | | | | 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-022-3/+21
| | | | | | | | | | | | | | | | | | | | 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-022-8/+65
| | | | | | | | | | | | | | | | | | | | | | | | 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]>
| * libdw: Add dwarf_line_file.Mark Wielaard2017-07-265-1/+70
| | | | | | | | Signed-off-by: Mark Wielaard <[email protected]>
| * Unify linking of libasm, libelf, libdw, backendsUlf Hermann2017-07-242-6/+18
| | | | | | | | | | | | | | | | | | | | 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]>
* | 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-081-0/+9
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Make __attribute__ conditional in all installed headersUlf Hermann2017-05-022-22/+6
| | | | | | | | | | | | | | | | | | | | __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]>
| * Include endian.h when handling BYTE_ORDERUlf Hermann2017-04-262-0/+5
| | | | | | | | | | | | BYTE_ORDER and friends are customarily defined in endian.h. Signed-off-by: Ulf Hermann <[email protected]>
* | Make sure packed structs follow the gcc memory layoutUlf Hermann2017-05-021-1/+1
| | | | | | | | | | | | | | | | On windows gcc by default generates code that follows the MSVC layout. We don't want that as it adds extra padding. Change-Id: I92efe5da2a2ad818783707ee96a9b8e0eb606dbd Reviewed-by: Christian Kandeler <[email protected]>
* | Generate .lib files on PE platformsUlf Hermann2017-05-021-3/+25
| | | | | | | | | | | | | | MSVC needs them to link against .dll files. Change-Id: Iaf15391d28e0cd3292903dda2cd74b8b99a94274 Reviewed-by: Christian Kandeler <[email protected]>
* | Generalize library namesUlf Hermann2017-04-282-15/+18
| | | | | | | | | | | | | | | | | | On windows library names end with ".dll" and the prefix "lib" us usually omitted. Take this into account and also drop the $(EXEEXT) workaround. We don't need to use noinst_PROGRAMS as there is also noinst_DATA. Change-Id: I7e4ba2432811d5ad85051ea0c9d5674eabf79b3c Reviewed-by: Christian Kandeler <[email protected]>
* | Check if rpath is supported before setting itUlf Hermann2017-04-281-2/+7
| | | | | | | | | | | | | | | | Some systems don't have rpath. In that case the backends need to be made available by some external mechanism. Warn about it. Change-Id: I873bd1808addf3f7f29616d7197101ca4f6fd483 Reviewed-by: Christian Kandeler <[email protected]>
* | Check if we need -lintl for linking gettextUlf Hermann2017-04-281-1/+1
| | | | | | | | | | | | | | | | We might not have gettext available from libc and we cannot get it from gnulib either. Change-Id: I1cc657b13b97bcc7c0f158f11b6702c24e69695c Reviewed-by: Christian Kandeler <[email protected]>
* | Check if gcc complains about __attribute__ (visibility(..))Ulf Hermann2017-04-283-2/+7
| | | | | | | | | | | | | | | | If so, define attribute_hidden to be empty. Also, use attribute_hidden in all places where we hide symbols. Change-Id: I37353459710dbbd1c6c6c46110514fc18515c814 Reviewed-by: Christian Kandeler <[email protected]>
* | Check for -z,defs, -z,relro, -fPIC, -fPIE before using themUlf Hermann2017-04-282-2/+6
| | | | | | | | | | | | | | | | | | On windows those aren't needed because the link results are no ELF files and all code is position independent anyway. gcc then complains about them, which is in turn caught by -Werror. Change-Id: Ie3d600b7c430698fc3d867a986a4d48f7ad1bbec Reviewed-by: Christian Kandeler <[email protected]>
* | Drop handrolled or #ifdef'ed libc replacementsUlf Hermann2017-04-282-1/+5
| | | | | | | | | | | | | | | | | | mempcpy, memrchr, rawmemchr, and argp are provided by gnulib now. We don't need to define them locally and we don't need to search for an external libargp. Change-Id: I131ca4bc2d77c597b99c296c28259a3600e5d1b5 Reviewed-by: Christian Kandeler <[email protected]>
* | Add gnulib modules to replace missing libc functionalityUlf Hermann2017-04-272-1/+11
| | | | | | | | | | | | | | | | | | | | 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]>
* | 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]>
* | Make __attribute__ conditional in all installed headersUlf Hermann2017-04-212-22/+6
|/ | | | | | | | | | | __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]>
* libdw: Fix dwarf_peel_type infinite loop.Mark Wielaard2017-04-052-1/+6
| | | | | | | | | | 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]>
* libdw: Correct spelling of DW_LANG_PLI in dwarf.h.Mark Wielaard2016-11-103-4/+12
| | | | | | | | | 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]>
* Add GCC7 -Wimplicit-fallthrough support/fixes.Mark Wielaard2016-11-103-1/+12
| | | | | | | | | | | GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one small buglet in elflint option procession. So it seems useful to enable to make sure all swatch case fallthroughs are deliberate. Add configure check to detect whether gcc support -Wimplicit-fallthrough and enable it. Add fixes and explicit fallthrough comments where necessary. Signed-off-by: Mark Wielaard <[email protected]>
* lib: Provide MAX and MIN in system.hAkihiko Odaki2016-10-123-2/+7
| | | | | | | | | | 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]>
* dwelf: Add string table functions from ebl.Mark Wielaard2016-08-032-0/+17
| | | | | | | | | | | | | | | | 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]>
* libdw: Fix bad free on invalid data in dwarf_getsrclines.c.Mark Wielaard2016-02-222-2/+9
| | | | | | | | If the last dir name wasn't zero terminated we goto invalid_data and might free the wrong data because we believe ndirlist is valid. Don't update ndirlist until we are sure we will use all dirs. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Use elf_compress[_gnu] to uncompress debug section data.Mark Wielaard2016-01-064-137/+63
| | | | | | | | libdw used its own code for decompressing GNU style .zdebug sections. Using elf_compress and elf_compress_gnu instead makes it possible to transparently use either GNU style or ELF style compressed data. Signed-off-by: Mark Wielaard <[email protected]>
* libdwelf: Add dwelf_scn_gnu_compressed_size.Mark Wielaard2016-01-062-0/+9
| | | | | | Helper function to get the size of a GNU compressed zdebug section. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Don't leak duplicate FDEs.Mark Wielaard2016-01-022-1/+14
| | | | | | | | Although it isn't supposed to happen there could be FDEs that cover the same address range. Don't leak such FDEs and use an existing FDE for consistency. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Don't use a FDE if it doesn't actually cover a real code range.Mark Wielaard2016-01-022-0/+12
| | | | | | | | | | If the FDE end <= start then it doesn't actually cover a valid code range. Don't use and cache such FDEs (it will cause memory leaks if there is another FDE that has the same start address and a valid code range). Such FDEs have been seen in the backtrace.ppc.exec testfile. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Don't leak fake_loc_cu.Mark Wielaard2016-01-022-1/+9
| | | | | | | | The fake_loc_cu is used when synthesizing attributes for Dwarf_Ops that came from a location list entry in dwarf_getlocation_attr. Make sure we remove the loc cache stored in it when disposing of the fake_loc_cu. Signed-off-by: Mark Wielaard <[email protected]>
* Move nested functions in dwarf_entry_breakpoints.c to file scope.Chih-Hung Hsieh2016-01-022-51/+64
| | | | | | No nested functions to compile with clang/llvm. Signed-off-by: Chih-Hung Hsieh <[email protected]>
* Move nested functions in libdw_visit_scopes.c to file scope.Chih-Hung Hsieh2016-01-022-71/+95
| | | | | | | * No nested functions to compile with clang/llvm. Signed-off-by: Chih-Hung Hsieh <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Make sure Ebl is always freed from cfi frame cache.Mark Wielaard2015-11-272-1/+10
| | | | | | | | | | | | | | libdwfl sets the Dwfl_Module Ebl for the eh_cfi and dwarf_cfi cache to save a bit of memory. It also calls ebl_closebackend on the ebl to free it. The Dwarf_CFI never frees the Ebl in the cache, even when it opened one itself. This means that if only libdw calls are used to access the Dwarf_CFI the Ebl might be leaked. Always destroy the Dwarf_CFI cache Ebl in __libdw_destroy_frame_cache. And in __libdwfl_module_free clear the Dwarf_CFI Ebl if it is the Dwfl_Module Ebl before calling dwarf_cfi_end and dwarf_end. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: initialize state early in read_srclinesDmitry V. Levin2015-11-162-19/+24
| | | | | | | | Starting with commit f8443bd09f8a8d3d84a63e5ce206a218e57dff7a, we might jump to "out" on error before initialization of "state". Initialize "state" early to fix this issue. Signed-off-by: Dmitry V. Levin <[email protected]>
* No nested functions in dwarf_getsrclines.Chih-Hung Hsieh2015-11-132-105/+144
| | | | | | | Move nested functions in libdw/dwarf_getsrclines.c to file scope. Signed-off-by: Chih-Hung Hsieh <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* No nested function in dwarf_getscopevar to file scope.Chih-Hung Hsieh2015-11-132-17/+27
| | | | | Signed-off-by: Chih-Hung Hsieh <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* Make zlib mandatory.Mark Wielaard2015-10-262-1/+5
| | | | | | Explicitly link libelf and libdw with -lz. Signed-off-by: Mark Wielaard <[email protected]>
* Move nested functions in libdw/cfi.c to file scope.Chih-Hung Hsieh2015-10-222-42/+50
| | | | | | * No nested functions to compile with clang/llvm. Signed-off-by: Chih-Hung Hsieh <[email protected]>
* Trust AC_SYS_LARGEFILE to provide large file supportJosh Stone2015-10-092-2/+7
| | | | | | | | | | | | | | | AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS in config.h if needed for LFS, and this automatically maps things like open to open64. But quite a few places used explicit 64-bit names, which won't work on platforms like FreeBSD where off_t is always 64-bit and there are no foo64 names. It's better to just trust that AC_SYS_LARGEFILE is doing it correctly. But we can verify this too, as some file could easily forget to include config.h. The new tests/run-lfs-symbols.sh checks all build targets against lfs-symbols (taken from lintian) to make sure everything was implicitly mapped to 64-bit variants when _FILE_OFFSET_BITS is set. Signed-off-by: Josh Stone <[email protected]>
* Improve AM_SILENT_RULES coverageJosh Stone2015-10-062-2/+6
| | | | | | | | | | | Note, elfutils does not explicitly enable AM_SILENT_RULES. It's only available starting from automake 1.11, but starting from automake 1.13 silent rules are always generated, defaulting to verbose. $(AM_V_foo) additions should be no-ops on systems that don't support silent rules. To be silent, use "./configure --enable-silent-rules" or "make V=0". Signed-off-by: Josh Stone <[email protected]>
* Use -fPIC instead of -fpic when generating PIC code.Jose E. Marchesi2015-10-062-1/+6
| | | | | | | This avoids relocation overflows in sparc/sparc64 targets while linking, where the reachable data using -fpic is only 4kb. Signed-off-by: Jose E. Marchesi <[email protected]>