summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* readelf: Fix set but not used variableIlya Leoshkevich2023-02-081-2/+0
| | | | | | | | | | | | clang complains: readelf.c:10250:10: error: variable 'nculist' set but not used [-Werror,-Wunused-but-set-variable] size_t nculist = 0; ^ Fix by deleting it. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
* debuginfod-client.c: Download section even if cached executable didn't ↵Aaron Merey2023-02-072-10/+21
| | | | | | | | | | | | | | | | | | | | | contain it. Before attempting to download a section, cache_find_section tries to extract the section from existing files in the cache. If it's determined that the section must not exist, cache_find_section returns -ENOENT to indicate that the download should be skipped. This patch fixes a bug where cache_find_section returns -ENOENT even though the section exists. If the cache contains the executable but not the debuginfo with the given build-id and the section only exists in the debuginfo (such as any of the .debug_* sections), then debuginfod_find_section returns -ENOENT even if the section could be downloaded. Fix this by having cache_find_section not return -ENOENT unless cached debuginfo was able to be read. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: Make sure there is only one typedef for debuginfod_clientMark Wielaard2023-02-064-0/+16
| | | | | | | | | | | | Both debuginfod.h and libdwfl.h have a simple typedef for struct debuginfod_client. Some compilers pedantically warn when including both headers that such typedefs are only officially supported in C11. So guard them with _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF to make them happy. https://sourceware.org/bugzilla/show_bug.cgi?id=30077 Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Check ELFUTILS_DISABLE_DEMANGLE in run-addr2line-C-test.shMark Wielaard2023-02-032-0/+9
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=30072 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Search for abstract origin in the correct CUMark Wielaard2023-01-306-8/+66
| | | | | | | | | | | | | | | With gcc -flto the abstract origin of an inlined subroutine could be in a different CU. dwarf_getscopes might return an empty scope if it cannot find the abstract origin scope. So make sure to search in the We also tried to add the origin match in pc_record directly in the current inlined scope. This always failed, causing to do a needless traversal, followed by the full CU scan in dwarf_getscopes. Just always stop the pc_record search and then do the CU origin_match in dwarf_getscopes. Signed-off-by: Mark Wielaard <mark@klomp.org>
* addr2line: -C should not try to handle optional (ignored) argumentMark Wielaard2023-01-305-2/+110
| | | | | | | | | | | | | | | | The --demangle option takes an option (ignored) argument. Since -C is the short option of --demangle it also takes that optional argument. But that means that something like -Cfi is like -C got fi as argument, while the user expects -Cfi to be like -C -f -i. Separate the --demangle and -C options. --demangle still takes an optional (ignored) argument, but -C doesn't take any arguments so -Cfi acts the same as -fiC. Also fix --target, -b, so that it is properly ignored (and not accidentially enables demangling). Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdwfl: add check for elf_memory return valueAleksei Vetrov2023-01-262-2/+11
| | | | | | | elf_memory call in __libdw_open_elf_memory can return NULL. It was not checked and led to the null pointer dereference. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
* tests: run-debuginfod-query-retry.sh /bin/sh might not have a build-idMark Wielaard2023-01-192-2/+8
| | | | | | | | | If /bin/sh wasn't build with build-id the test fails because debuginfod-find will not be able to even try to fetch something. Use libdebuginfod.so.1 instead as test file because we just build that and configure makes sure we always produce a build-id. Signed-off-by: Mark Wielaard <mark@klomp.org>
* backends: sparc uses NONE relocation type in ET_EXEC and ET_DYN filesMark Wielaard2023-01-192-1/+5
| | | | | | | | | Using the NONE relocation doesn't do anything, but is harmless. This fixes several (self) tests on sparc that use elflint to check files are valid ELF. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Check compression status of .debug section dataMark Wielaard2023-01-162-102/+130
| | | | | | | | | | The various print_debug_*_section functions didn't get the section data in the same way. Add a new get_debug_elf_data function that gets the (possibly relocated) section data and that checks (and warns) if the data might still be compressed in a way that we cannot decompress. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Fix typos from codespellSam James2023-01-1310-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | debuginfod/ChangeLog: * debuginfod-client.c: Typo simultaniously. doc/ChangeLog: * debuginfod.8: Typo succesfully. lib/ChangeLog: * dynamicsizehash_concurrent.c: Typo modul. * system.h: Typo dependend. libdwfl/ChangeLog: * open.c: Typo non-existant. src/ChangeLog: * nm.c: Typo Covert. * strings.c: Likewise. tests/ChangeLog: * elfstrmerge.c: Typo outselves. * run-debuginfod-extraction.sh: Typo accidentially. * run-debuginfod-fd-prefetch-caches.sh: Likewise. Signed-off-by: Sam James <sam@gentoo.org>
* debuginfod-find.1: note on how to find a comp_dirSerhei Makarov2023-01-131-0/+13
| | | | | | | | | | | | | | | | | | | | | | doc/ChangeLog: * debuginfod-find.1: add a note to DESCRIPTION section for the 'source' subcommand, clarifying where to find the CU compilation-directory. I'm looking at how to improve and document the workflow for using debuginfod-find to study the behaviour of packaged software on a system, e.g. in conjunction with a tracing tool like SystemTap. You can read the exact compiled source code with debuginfod-find source and use that to figure out which source code locations are interesting to trace. But that process has several non-obvious or inconvenient steps. This patch is a clarification to the debuginfod-find source man page pointing out the eu-readelf command that can show the comp_dir in downloaded debuginfo. Since debuginfod-find source could be picked up and used by a developer unfamiliar with DWARF terminology, I think such a clarification saves time for newbies figuring out what a CU compilation-directory is. Signed-off-by: Serhei Makarov <serhei@serhei.io>
* debuginfod PR29975 & PR29976: decrease default concurrencyFrank Ch. Eigler2023-01-116-7/+83
| | | | | | | ... based on rlimit (rlimig -n NUM) ... based on cpu-affinity (taskset -c A,B,C,D ...) Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client: Use CURLOPT_PROTOCOLS_STR for libcurl >= 7.85.0Mark Wielaard2023-01-112-0/+10
| | | | | | https://sourceware.org/bugzilla/show_bug.cgi?id=29926 Signed-off-by: Mark Wielaard <mark@klomp.org>
* support ZSTD compression algorithmMartin Liska2022-12-2310-125/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | config/ChangeLog: * libelf.pc.in: Add LIBLZSTD to Requires.private. ChangeLog: * configure.ac: Detect ZSTD streaming API. libelf/ChangeLog: * Makefile.am: Use zstd_LIBS. * elf_compress.c: (__libelf_compress): Split into ... (__libelf_compress_zlib): ... this. (do_zstd_cleanup): New. (zstd_cleanup): New. (__libelf_compress_zstd): New. (__libelf_decompress): Switch in between zlib and zstd. (__libelf_decompress_zlib): Renamed from __libelf_decompress. (__libelf_decompress_zstd): New. (__libelf_decompress_elf): Dispatch in between compression algorithms. (elf_compress): Likewise. * elf_compress_gnu.c (elf_compress_gnu): Call with ELFCOMPRESS_ZLIB. * libelfP.h (__libelf_compress): Add new argument. (__libelf_decompress): Add chtype argument. src/ChangeLog: * elfcompress.c (enum ch_type): Add ZSTD. (parse_opt): Parse "zstd". (get_section_chtype): New. (process_file): Support zstd compression. (main): Add zstd to help. * readelf.c (elf_ch_type_name): Rewrite with switch. tests/ChangeLog: * Makefile.am: Add ELFUTILS_ZSTD if zstd is enabled. * run-compress-test.sh: Test zstd compression algorithm for debug sections.
* libdwfl: Don't undef _Mark Wielaard2022-12-225-4/+7
| | | | | | | A couple of files undefined _, which is defined in lib/eu-config.h as gettext helper macro. This seems unnecessary and arbitrary. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Add support for Synopsys ARCv2 processorsShahab Vahedi2022-12-2213-3/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no regression in tests for an x86_64 build, while the new hello_arc_hs4.ko is added as well. This is the only meaningful test that I could add at the moment, given the features supported by this port. $ cat tests/test-suite.log ========================================== elfutils 0.188: tests/test-suite.log ========================================== # TOTAL: 236 # PASS: 235 # SKIP: 1 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 .. contents:: :depth: 2 SKIP: run-lfs-symbols.sh ======================== LFS testing is irrelevant on this system SKIP run-lfs-symbols.sh (exit status: 77) $ cat tests/run-strip-reloc.sh.log runtest hello_i386.ko runtest hello_x86_64.ko runtest hello_ppc64.ko runtest hello_s390.ko runtest hello_aarch64.ko runtest hello_m68k.ko runtest hello_riscv64.ko runtest hello_csky.ko runtest hello_arc_hs4.ko <-- [ new ARC HS4 test ] runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip.o runtest strip-uncompressed.o runtest strip-compressed.o runtest testfile-debug-rel-ppc64.o runtest testfile-debug-rel-ppc64-z.o runtest testfile-debug-rel-ppc64-g.o PASS run-strip-reloc.sh (exit status: 0) Signed-off-by: Shahab Vahedi <shahab@synopsys.email>
* lib: Remove -ffunction-sections for xmallocMark Wielaard2022-12-212-4/+4
| | | | | | The build used -ffunction-sections just for one file. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libcpu: Use __asm instead of asm to mark variables as usedYonggang Luo2022-12-212-2/+6
| | | | | | | This block of code can not be removed. As it's contains a goto label enomem that been used elsewhere. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* debuginfod: Define CURL_AT_LEAST_VERSION if necessaryMark Wielaard2022-12-212-0/+11
| | | | | | | | Older curl.h don't define CURL_AT_LEAST_VERSION, so define it ourselves because it is nicer than doing hex encoded version comparisons. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR29926: debuginfod: Fix usage of deprecated CURLINFO_*Andrew Paprocki2022-12-212-2/+6
| | | | | | | | | | | | | | | | | The `CURLINFO_SIZE_DOWNLOAD_T` and `CURLINFO_CONTENT_LENGTH_DOWNLOAD_T` identifiers are `enum`s, not pre-processor definitions, so the current `#ifdef` logic is not selecting the newer API. This results in the older identifiers being used and they now generate errors when compiled against Curl 7.87, which has silently deprecated them, causing GCC to emit `-Werror=deprecated-declarations`. Instead, the newer identifiers were added in Curl 7.55, so explicitly check for `CURL_AT_LEAST_VERSION(7, 55, 0)` instead of the current logic. This eliminates the error when compiling against Curl 7.87. Ref: https://github.com/curl/curl/pull/1511 Signed-off-by: Andrew Paprocki <andrew@ishiboo.com>
* Do not use relative include paths in library files.Mark Wielaard2022-12-2035-37/+82
| | | | | | | | | Rely on include dirs being set up correctly. Setup libdw AM_CPPFLAGS to include libebl directory. In libdwfl note that debuginfod.h is a generated file in the builddir. Only include it in the one file debuginfod-client.c that really needs it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Add support for LoongArchHengqi Chen2022-12-199-3/+228
| | | | | | This implements initial support for the LoongArch architecture. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
* libdwfl: Read no more than required in dwfl_segment_report_moduleGavin Li2022-12-132-25/+8
| | | | | | | | | | | | | | | Since read_portion and the standard dwfl_elf_phdr_memory_callback functions make sure to read at least minread bytes there is no need for dwfl_segment_report_module to check and adjust the data to the actual buffer size read. Reading beyond the end of the expected data size (if the buffer read is much larger) actually causes issues when passing the data to elfXX_xlatetom() because it is possible that src->d_size is not a multiple of recsize (for ELF_T_DYN, recsize is 16 while the minimum required alignment is 8), causing elfXX_xlatetom() to return ELF_E_INVALID_DATA. Signed-off-by: Gavin Li <gavin@matician.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Change typeof -> __typeof in memory-access.hYonggang Luo2022-12-122-5/+12
| | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* libcpu: Use "#define FCT_mod$64r_m FCT_mod$r_m" in i386_data.hYonggang Luo2022-12-122-1/+5
| | | | | | This is enough and can be recognized by clang-cl on windows Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* libelf: Sync elf.h from glibcMark Wielaard2022-12-012-7/+33
| | | | | | Adds various new ARC related declarations. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Refactor elf_compareMartin Liska2022-11-291-63/+110
| | | | | | | | | | | | | | | src/ChangeLog: * elfcompress.c (T_UNSET): Remove and use ch_type. (T_DECOMPRESS): Likewise. (T_COMPRESS_ZLIB): Likewise. (T_COMPRESS_GNU): Likewise. (enum ch_type): New. (parse_opt): Parse to new ch_type. (compress_section): Change gnu and compress arguments to schtype (source compression) and dchtype (destination compression). (process_file): Use new enum type and adjusted compress_section.
* Missing newline for: elfcompress -t zlib-gnu a.out -forceMartin Liska2022-11-281-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes: ./src/elfcompress -t zlib-gnu a.out -force [28] .zdebug_aranges unchanged, already GNU compressed[29] .zdebug_info unchanged, already GNU compressed[30] .zdebug_abbrev unchanged, already GNU compressed[31] .zdebug_line unchanged, already GNU compressed[32] .zdebug_str unchanged, already GNU compressed[33] .zdebug_line_str unchanged, already GNU compressed[34] .zdebug_rnglists unchanged, already GNU compressed to: ./src/elfcompress -t zlib-gnu a.out -force [28] .zdebug_aranges unchanged, already GNU compressed [29] .zdebug_info unchanged, already GNU compressed [30] .zdebug_abbrev unchanged, already GNU compressed [31] .zdebug_line unchanged, already GNU compressed [32] .zdebug_str unchanged, already GNU compressed [33] .zdebug_line_str unchanged, already GNU compressed [34] .zdebug_rnglists unchanged, already GNU compressed src/ChangeLog: * elfcompress.c (process_file): Add missing newline.
* readelf: print warning for -sWMartin Liska2022-11-282-5/+21
| | | | | | | | | | | | | | | | | | | | | The option -s accepts in elfutils (compared to binutils) a positional argument that is name of a symbol table section which should be printed. Thus, print a reasonable warning if -sW is used: ./src/readelf -sW a.out WARNING: cannot find section: 'W' PR29719 src/ChangeLog: * readelf.c (print_symtab): Change signature and return true if something is printed. (process_elf_file): Use it and print warning. tests/ChangeLog: * run-readelf-s.sh: Test -sW.
* debuginfod: Initialize response_data early in debuginfod-client queryMark Wielaard2022-11-212-2/+7
| | | | | | | | On error going to out2, the response_data is freed. So initialize the response_data to NULL immediately after allocation or when going back to query_in_parallel. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod-client.c: Don't treat 0 as an error code.Aaron Merey2022-11-072-2/+7
| | | | | | | Replace 'fd > 0' with 'fd >= 0' to avoid treating a possible file descriptor as an error code. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod_find_section: Always update rc with most recent error codeAaron Merey2022-11-042-1/+10
| | | | | | | | | debuginfod_find_section may attempt to download both the debuginfo and executable matching the given build-id. If neither of these files can be found, update rc to ensure that we always return an accurate error code in this case. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod.cxx: fix coverity-found use-after-release errorFrank Ch. Eigler2022-11-032-73/+75
| | | | | | | The debuginfod_client object lifetime needs more careful handling, made easier with the defer_dtor<> gadget. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* readelf: Check gelf_getdyn doesn't return NULLMark Wielaard2022-11-032-1/+6
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw: Don't dereference and assign values we are skippingMark Wielaard2022-11-032-1/+6
| | | | | | | We don't use the FDE address encoding byte, so no reason to read and store it. Just skip past it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: Check phdr != NULL or shdr != NULL in handle_dynamic.Mark Wielaard2022-11-032-5/+10
| | | | | | | | | The compiler doesn't know that when use_dynamic_segment is true, then phdr should/will be non-NULL and otherwise shdr is non-NULL. Add explicit checks to help the compiler out and in case an error is made calling the handle_dynamic function. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: Mark extract_section function staticMark Wielaard2022-11-022-1/+5
| | | | | | | The extract_section function in debuginfod-client.c is an internal function and should not be exported. Mark it as static. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Prepare for 0.188elfutils-0.188Mark Wielaard2022-11-0211-5937/+6189
| | | | | | | | Set version to 0.188 Update elfutils.spec.in Regenerate po/*.po files Signed-off-by: Mark Wielaard <mark@klomp.org>
* Changelog: Update entries from previous commits.Aaron Merey2022-11-012-0/+9
| | | | | | Update Changelogs with details from commits 04b1a3aa and 054b3bde9. Signed-off-by: Aaron Merey <amerey@redhat.com>
* run-debuginfod-section.sh: Avoid zstd-compressed rpmsAaron Merey2022-11-011-1/+1
| | | | | | | Only test using rpms without zstd compression. Older versions of libarchive may fail to handle these. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod-client: Fix out-of-bounds writeAaron Merey2022-11-011-2/+1
| | | | | | | Return early from path_escape when '\0' is seen in order to prevent an out-of-bounds write to the dest buffer. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: Support queries for ELF/DWARF sectionsAaron Merey2022-11-0117-103/+882
| | | | | | | | | | | | | | | | | | | | | | Add new function debuginfod_find_section which queries debuginfod servers for the raw binary contents of the specified ELF/DWARF section in a file matching the given build-id. Extend the server webapi to support section queries. Section query URLS have the following format: /buildid/BUILDID/section/SECTION The server will attempt to extract the section from a debuginfo file matching the given build-id. If the debuginfo file cannot be found or the section has type SHT_NOBITS, the server will attempt to extract the section from the executable file matching the build-id. If the server is built without section query support, the client will attempt to download the debuginfo matching the build-id and extract the section. If the debuginfo file cannot be found or the section has type SHT_NOBITS, the server will attempt to download the executable file matching the build-id and extract the section. Signed-off-by: Aaron Merey <amerey@redhat.com>
* Rename 'hello{2,3}.spec.' -> 'hello{2,3}.specfile'Yonggang Luo2022-10-318-5/+23
| | | | | | | | | | | These filenames are invalid on win32. We don't want to include multiple .spec files for make rpm. rpmbuild --sign is not supported anymore. Also include hello3.specfile in EXTRA_DIST. Escape some macros in the elfutils.spec.in file comments. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf: add binutils-style --syms optionArsen Arsenović2022-10-306-1/+23
| | | | | | This helps people with a lot of built up muscle memory :) Signed-off-by: Arsen Arsenović <arsen@aarsen.me>
* libelf: Sync elf.h from glibcMark Wielaard2022-10-292-5/+17
| | | | | | Adds ELFCOMPRESS_ZSTD, NT_S390_PV_CPU_DATA and NT_LOONGARCH_*. Signed-off-by: Mark Wielaard <mark@klomp.org>
* lib{asm,cpu,dw,dwfl,dwelf}: Move platform depended include into system.hYonggang Luo2022-10-2837-51/+55
| | | | Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* debuginfod-client: Add DEBUGINFOD_HEADERS_FILE.Daniel Thornburgh2022-10-287-3/+74
| | | | | | | | This DEBUGINFOD_HEADERS_FILE environment variable names a file to supply HTTP headers to outgoing requests. Notably, this allows for Authorization headers to be added from a file under OS access control. Signed-off-by: Daniel Thornburgh <dthorn@google.com>
* configure.ac: Update AC_PROG_CC and AC_PROG_LEX for autoconf 2.70Mark Wielaard2022-10-272-2/+7
| | | | | | | | | With autoconf 2.70 we must use AC_PROG_CC (which will check for c11 and c99), for earlier versions we'll use AC_PROG_CC_C99. Also use AC_PROG_LEX([noyywrap]), the extra argument is ignored with earlier versions, but required for 2.70. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Use grep -E instead of egrep, use grep -F instead of fgrep.Mark Wielaard2022-10-2710-11/+26
| | | | | | | GNU grep 3.8 gives a deprecation warning when using egrep or fgrep. Just use grep -E and grep -F. Signed-off-by: Mark Wielaard <mark@klomp.org>