summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libdwelf: add dwelf_elf_remove_debug_relocsupstream/users/amerey/try-remove-relocs2Di Chen2024-10-189-348/+513
| | | | | | | | | | | | | Provide a public function for removing debug section relocations. eu-strip previously contained the code to remove debug section relocations. This patch moves that code into dwelf_elf_remove_debug_relocs. https://sourceware.org/bugzilla/show_bug.cgi?id=31447 Signed-off-by: Di Chen <[email protected]> Signed-off-by: Aaron Merey <[email protected]>
* eu-stacktrace [5/5]: NEWS: add entry for new toolSerhei Makarov2024-10-171-0/+7
| | | | Signed-off-by: Serhei Makarov <[email protected]>
* eu-stacktrace [4/5]: src: add unwind origin diagnostics to eu-stackSerhei Makarov2024-10-172-8/+37
| | | | | | | | | | | | | | | | | | | Since we obtain diagnostics about unwind method, another logical place to show them is in eu-stack. * src/stack.c (show_unwound_source): New global variable. (struct frame): Add unwound_source field. (frame_callback): Copy over unwound_source from Dwfl_Frame. (print_frame): Take unwound_source string and print it. (print_inline_frames): Take unwound_source argument and pass it on, except for subsequent frames where we pass the string "inline". (print_frames): Take unwound_source field from struct frame and pass it on. (parse_opt): Add --cfi-type,-c option to set show_unwound_source. (main): Ditto. * tests/run-stack-i-test.sh: Add testcase for --cfi-type. Signed-off-by: Serhei Makarov <[email protected]>
* eu-stacktrace [3/5]: libdwfl: add unwind origin diagnosticsSerhei Makarov2024-10-176-11/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Track the method used to unwind each Dwfl_Frame using an enum field unwound_source; provide access to the field. Then use that in eu-stacktrace to display the unwind methods used for each process. This is an important diagnostic to verify how many processes are adequately covered by the eh_frame unwinder. * libdw/libdw.map (ELFUTILS_0.192): Add dwfl_frame_unwound_source, dwfl_unwound_source_str. * libdwfl/libdwfl.h (Dwfl_Unwound_Source): New enum. (dwfl_frame_unwound_source) (dwfl_unwound_source_str): New functions. * libdwfl/dwfl_frame.c (dwfl_frame_unwound_source) (dwfl_unwound_source_str): New functions. * libdwfl/libdwflP.h: Add INTDECL for dwfl_frame_unwound_source, dwfl_unwound_source_str. (struct Dwfl_Frame): Add unwound_source field. * libdwfl/frame_unwind.c (__libdwfl_frame_unwind): Set state->unwound_source depending on the unwind method used. * src/stacktrace.c (struct sysprof_unwind_info): Add last_pid field to provide access to the current sample's dwfltab entry. (sysprof_unwind_frame_cb): Add unwound_source to the data displayed with the show_frames option. (sysprof_unwind_cb): Set last_pid when processing a sample. (main): Add unwind_source to the data displayed in the final summary table. Signed-off-by: Serhei Makarov <[email protected]>
* eu-stacktrace [2/5]: configure.ac: initial version (x86/sysprof only)Serhei Makarov2024-10-172-2/+63
| | | | | | | | | | | | | | | | | | | | | Due to the x86-specific code in the initial version the configury has significant restrictions. If --enable-stacktrace is not explicitly provided, then eu-stacktrace will be disabled by default. The way we test for x86 is a bit unusual. What we actually care about is that the register file provided by perf_events on the system is an x86 register file; this is done by checking that <asm/perf_regs.h> is Linux kernel arch/x86/include/uapi/asm/perf_regs.h. Once eu-stacktrace is properly portable across architectures, these grody checks can be simplified. Enablement of the feature by default depends on a released Sysprof version we can point to for the patches. * configure.ac: Add configure checks and conditionals for stacktrace tool. * src/Makefile.am: Add stacktrace tool conditional on ENABLE_STACKTRACE. Signed-off-by: Serhei Makarov <[email protected]>
* eu-stacktrace [1/5]: src: add eu-stacktrace toolSerhei Makarov2024-10-171-0/+1571
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eu-stacktrace is a utility to process a stream of raw stack samples (such as those obtained from the Linux kernel's PERF_SAMPLE_STACK facility) into a stream of stack traces (such as those obtained from PERF_SAMPLE_CALLCHAIN), freeing other profiling utilities from having to implement their own backtracing logic. eu-stacktrace accepts data from a profiling tool via a pipe or fifo. The initial version of the tool works on x86 architectures and accepts data from Sysprof [1]. For future work, it will make sense to expand support to other profilers, in particular perf tool. Further patches in this series provide configury, docs, and improved diagnostics for tracking the method used to unwind each frame in the stack trace. [1]: The following patched version of Sysprof (upstream submission ETA ~very_soon) can produce data with stack samples: https://git.sr.ht/~serhei/sysprof-experiments/log/serhei/samples-via-fifo Invoking the patched sysprof with eu-stacktrace: $ sudo sysprof-cli --use-stacktrace $ sudo sysprof-cli --use-stacktrace --stacktrace-path=/path/to/eu-stacktrace Invoking the patched sysprof and eu-stacktrace manually through a fifo: $ mkfifo /tmp/test.fifo $ sudo eu-stacktrace --input /tmp/test.fifo --output test.syscap & $ sysprof-cli --sample-method=stack --use-fifo=/tmp/test.fifo test.syscap Note that sysprof polkit actions must be installed systemwide (e.g. installing the system sysprof package will provide these). Otherwise, "Action org.gnome.sysprof3.profile is not registered" error will result. * src/stacktrace.c: Add new tool. Signed-off-by: Serhei Makarov <[email protected]>
* Remove usage of "unlocked" variant of stdio print functionsMichael Pratt2024-10-179-91/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These "unlocked" Linux Standard Base variants of standard functions are not available on some systems that are still capable of building Linux and ELFs. The difference is negligible for simple printing to stdout. POSIX also states for the similar putc_unlocked(): These functions can safely be used in a multi-threaded program if and only if they are called while the invoking thread owns the (FILE *) object, as is the case after a successful call to the flockfile() or ftrylockfile() functions. ... These unlocked versions can be safely used only within explicitly locked program regions, using exported locking primitives. and these precautions were never done. Use the standard forms of these print functions. There is inconsistent use of fputc_unlocked() with putc_unlocked(), so consistently use the safer fputc() instead. Signed-off-by: Michael Pratt <[email protected]>
* doc/Makefile.am: Add man pagesAaron Merey2024-10-161-1/+19
| | | | | | | | | | | | Add the following man pages to notrans_dist_man3_MANS: elf32_xlatetom.3 elf64_xlatetom.3 elf32_xlatetof.3 elf64_xlatetof.3 elf32_newphdr.3 elf64_newphdr.3 elf32_newehdr.3 elf64_newehdr.3 elf32_getshdr.3 elf64_getshdr.3 elf32_getphdr.3 elf64_getphdr.3 elf32_getchdr.3 elf64_getchdr.3 elf32_fsize.3 elf64_fsize.3 elf32_checksum.3 elf64_checksum.3 Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf{32,64}_xlatetof.3 and elf{32,64}_xlatetom.3Aaron Merey2024-10-164-0/+133
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_newphdr.3 and elf64_newphdr.3Aaron Merey2024-10-162-0/+73
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_newehdr.3 and elf64_newehdr.3Aaron Merey2024-10-162-0/+61
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_getshdr.3 and elf64_getshdr.3Aaron Merey2024-10-162-0/+60
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_getphdr.3 and elf64_getphdr.3Aaron Merey2024-10-162-0/+67
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_getchdr.3 and elf64_getchdr.3Aaron Merey2024-10-162-0/+61
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_fsize.3 and elf64_fsize.3Aaron Merey2024-10-162-0/+79
| | | | Signed-off-by: Aaron Merey <[email protected]>
* doc: Add elf32_checksum.3 and elf64_checksum.3Aaron Merey2024-10-162-0/+61
| | | | Signed-off-by: Aaron Merey <[email protected]>
* PR32218: debuginfod-client: support very long source file namesFrank Ch. Eigler2024-10-168-47/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | debuginfod clients & servers may sometimes encounter very long source file names. Previously, the client would synthesize a path name like $CACHEDIR/$BUILDID/source-$PATHNAME where $PATHNAME was a funky ##-encoded version of the entire source path name. See https://sourceware.org/PR32218 for a horror case. This can get too long to store as a single component of a file system pathname (e.g. linux/limits.h NAME_MAX), resulting on client-side errors even after a successful download. New code switches encoding of the $PATHNAME part to use less escaping, and a merciless truncation to the tail part of the filename. (We keep the tail rather than the head, so that the extension is preserved, which makes some consumers happier.) To limit collision damage from truncation, we add also insert a goofy hash (4-byte DJBX33A) of the name into the path name. The result is a relatively short name: $CACHEDIR/$BUILDID/source-$HASH-$NAMETAIL This is a transparent change to clients, who are not to make any assumptions about cache file naming structure. However, one existing test did make such assumptions, so is fixed with some globness. A new test is also added, using a pre-baked tarball with a very long srcfile name. Signed-off-by: Frank Ch. Eigler <[email protected]>
* libdw: Let clean targets be unconditionalMichael Pratt2024-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | The automake rule "maintainer-clean-generic" is always available and never conditional, so let the variable that uses it be define non-conditionally. If one actually wants conditional cleaning they should write a custom rule and set it as a dependency of a "*clean-local" automake rule. There is no need to do conditional cleaning here, so move the MAINTAINERCLEANFILES variable definition to the end of the Makefile.am file as it is in the rest of the project. * libdw/Makefile.am: move MAINTAINERCLEANFILES variable to the end of the file as a non-conditional definition. Signed-off-by: Michael Pratt <[email protected]>
* libcpu: Include config.h before standard headers in lexer sourceMichael Pratt2024-10-141-4/+6
| | | | | | | | | | | | | | | | | As part of the processing of flex, definitions and headers are added to output source before any literal text or generated code. This causes standard headers to come before config.h unless config.h is included in a %top block instead as specified in the flex manual, section 5.1 "Format of the Definitions". The %top block is non-POSIX, so using it reinforces the requirement of "flex" over a standardized "lex" even more. * libcpu/i386_lex.l (%top): add flex %top block and move config.h header inclusion to it. Signed-off-by: Michael Pratt <[email protected]>
* lib: Add missing config.h include to next_prime.cMichael Pratt2024-10-141-0/+4
| | | | | | | | | | This is the last remaining C source file as of this commit without the standard conditional inclusion of config.h as the very first header. * lib/next_prime.c: add missing config.h header. Signed-off-by: Michael Pratt <[email protected]>
* tests/test-subr.sh: Put test_dir under /var/tmp.Frank Ch. Eigler2024-10-101-2/+3
| | | | | | | | | | | | | | | | | Every individual test in elfutils involves a temporary directory. Previous version of this script put that directory under the build tree. That's OK if it's a local disk, but if it's on NFS, then some tests - run-large-elf-file.sh, several run-debuginfod-*.sh - take long enough to run to fail tests intermittently. This patch moves the temp_dir under ${TMPDIR-/var/tmp/}, so it operates at local disk speed rather than whatever-build-filesystem speed. Individual test scripts are all unaffected. (One could consider /tmp instead, which is a RAM disk on modern systems, except that some of the elfutils tests produce GB-sized temporary files. That's probably too big for RAM.) Signed-off-by: Frank Ch. Eigler <[email protected]>
* tests: Fix specifying constant of double typeKhem Raj2024-10-031-1/+1
| | | | | | | | | | | | | | | 'd' suffix seems to be not acceptable by clang compiler Using 'e0' fixes this by keeping value to be same Fixes funcretval_test_struct.c:83:27: error: invalid suffix 'd' on floating constant 83 | dpoint_t dp = dmkpt (3.0d, 1.0d); | ^ funcretval_test_struct.c:83:33: error: invalid suffix 'd' on floating constant 83 | dpoint_t dp = dmkpt (3.0d, 1.0d); | Signed-off-by: Khem Raj <[email protected]>
* elflint: Fix memory leak in check_gnu_hash functionMaks Mishin2024-09-201-0/+1
| | | | | | | | | Dynamic memory, referenced by 'collected', is allocated at elflint.c:2235 and lost at elflint.c:2296. Found by RASU JSC with SVACE. Signed-off-by: Maks Mishin <[email protected]>
* libelf: Don't crash elf[32|64]_xlateto[fm] on bad arguments.Mark Wielaard2024-09-112-0/+18
| | | | | | | | | | Check that src and dest aren't NULL and that src->d_type < ELF_T_NUM. * elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Check src, dest and src->d_type are valid. * elf32_xlatetom.c (elfw2(LIBELFBITS, xlatetom)): Likewise. Signed-off-by: Mark Wielaard <[email protected]>
* elf*_xlatetof: do not check ELF_T_NHDR[8] has integer number of recordsMark Wielaard2024-09-111-1/+5
| | | | | | | | | | | | commit bc0f7450c "elf*_xlatetom: do not check ELF_T_NHDR has integer number of records" fixed https://bugzilla.redhat.com/show_bug.cgi?id=835877 But only for xlatetom. Do the same for xlatetof. * elf32_xlatetof.c (elfw2(LIBELFBITS, xlatetof)): Do not check for integer number of records in case of ELF_T_NHDR[8]. Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Allow .gdb_index const table to be emptyMark Wielaard2024-09-101-1/+1
| | | | | | | | | | | The .gdb_index const table can be empty, if no symbol table entry refers to a name or CU. Which technically means the symbol table is empty or has only zero members. * src/readelf.c (print_gdb_index_section): Check const_off is not past the end of the data section, it can be at the end. Signed-off-by: Mark Wielaard <[email protected]>
* srcfiles: Fix compile with --disable-libdebuginfodMark Wielaard2024-09-103-3/+4
| | | | | | | | | | | | | | | | | The eu-srcfiles --no-backup option is only valid when build with libdebuginfod support. Adjust the ENABLE_LIBDEBUGINFOD conditional to not use no_backup anywhere. Also only run the run-srcfiles-self.sh test when debuginfod is enabled. * src/srcfiles.cxx (zip_files): Move endif ENABLE_LIBDEBUGINFOD after no_backup check. * tests/Makefile.am (TESTS): Only add run-srcfiles-self.sh if DEBUGINFOD and !DUMMY_LIBDEBUGINFOD. * tests/run-srcfiles.self.sh: Use local DEBUGINFOD_CACHE_PATH. https://sourceware.org/bugzilla/show_bug.cgi?id=32155 Signed-off-by: Mark Wielaard <[email protected]>
* readelf: Fix printing of .gdb_index symbol table offset.Mark Wielaard2024-09-072-5/+5
| | | | | | | | | | | | | We were printing the addr_off instead of the sym_off. And the testcases all expected the address offset instead of the symbol table offset. * src/readelf.c (print_gdb_index_section): Print sym_off as Symbol table offset. * tests/run-readelf-gdb_index.sh: Fix up all symbol table offsets that were the same as the address offset. Signed-off-by: Mark Wielaard <[email protected]>
* debuginfod: Make sure extra libs are also included in static link in src/ tooFrank Ch. Eigler2024-09-061-1/+1
| | | | | | | | | commit 742fb81f3 did most of the work for supporting --enable-gcov, but one debuginfod client is hiding in the src/ directory, namely srcfiles, which also needs this enumeration of dependent libraries for static linkage. Signed-off-by: Frank Ch. Eigler <[email protected]>
* configure.ac: Restore HAVE_LIBARCHIVEAaron Merey2024-09-061-0/+1
| | | | | | | | src/srcfiles.cxx depends on the HAVE_LIBARCHIVE macro to enable the srcfiles --zip option. Defining this macro was accidentally removed from configure.ac in commit 30b5592a3. Signed-off-by: Aaron Merey <[email protected]>
* debuginfod: service metadata queries in separate, timed-out connectionsFrank Ch. Eigler2024-09-031-15/+67
| | | | | | | | | | | | | | | | | | | | | | | | | The --metadata-maxtime=SECONDS parameter was intended to limit elapsed time debuginfod spends attempting to answer metadata queries. These can be slow because they have to apply glob matches across a large set of strings, potentially taking many seconds. However, this option was not implemented fully. It checked for timeouts only when rows of data were finally served up by the database, not during. Also, it used the same database connection that normal debuginfod queries were using, locking them out. New code creates a new temporary database connection for these infrequent(?) metadata queries, and enforces timeouts using the sqlite3 progress-handler callback. This effectively limits total query runtime, inside or outside the database. The elfutils testsuite dataset is not large enough to show either the slow-glob or the locking-out-normal-queries phenomenon, so the behavioral impact was hand-tested on a moderate sized debuginfod index on a live federation server. A full valgrind leak check indicated it's clean. Signed-off-by: Frank Ch. Eigler <[email protected]>
* aarch64: Add NT_ARM_PAC_* regsetKuan-Ying Lee2024-08-302-0/+11
| | | | | | | Add the NT_ARM_PAC_MASK and NT_ARM_PAC_ENABLED_KEYS for aarch64. Recognize and print the new core item. Signed-off-by: Kuan-Ying Lee <[email protected]>
* libdwfl, aarch64: Read PAC mask from coreSteve Capper2024-08-302-2/+49
| | | | | | | | | | We need to read the PAC mask from a core file when debugging offline as the information is still needed to demangle return addresses. This commit pulls out the NT_ARM_PAC_MASK info from the core and feeds it through to dwfl_thread_state_registers for each thread. Signed-off-by: Steve Capper <[email protected]>
* libdwfl, aarch64: extend dwfl_thread_state_registers to handle PACSteve Capper2024-08-303-2/+23
| | | | | | | | | | | | | | | | | On AArch64 systems with pointer authentication enabled, one needs to know the PAC mask in order to unwind functions that employ PAC. This patch extends dwfl_thread_state_registers to handle the PAC mask information by introducing a special register -2. (-1 is used in a similar manner already for handling the program counter). The AArch64 linux process attach logic is also extended to query ptrace for the PAC mask. A subsequent patch will add support for retrieving the PAC mask from an AArch64 linux core file. Signed-off-by: Steve Capper <[email protected]>
* libdwfl, aarch64: Demangle return addresses using a PAC maskGerman Gomez2024-08-303-1/+22
| | | | | | | | | Demangle mangled return addresses on AARCH64. The value of the masks is stored in the struct Dwfl_Thread. Signed-off-by: German Gomez <[email protected]> [SteveC: remove dwfl_thread_state_aarch64_pauth] Signed-off-by: Steve Capper <[email protected]>
* libdw, aarch64: Implement DW_CFA_AARCH64_negate_ra_state CFI instructionGerman Gomez2024-08-301-1/+13
| | | | | | | | | | | | | Implement DW_CFA_AARCH64_negate_ra_state in accordance with the DWARF AARCH64 ABI [1]. Followup commits will use the value of this register to remove the PAC from return addresses. [1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#44call-frame-instructions Signed-off-by: German Gomez <[email protected]> Signed-off-by: Steve Capper <[email protected]>
* aarch64: Create definitions for AARCH64_RA_SIGN_STATE registerGerman Gomez2024-08-305-1/+13
| | | | | | | | | | | This register will be used to indicate whether a return address is mangled with a PAC or not, in accordance with the DWARF AARCH64 ABI [1]. [1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#41dwarf-register-names Signed-off-by: German Gomez <[email protected]> [SteveC: move DW_AARCH64_RA_SIGN_STATE to cfi.h, fix comments] Signed-off-by: Steve Capper <[email protected]>
* tests: When BUILD_STATIC always link against libeuMark Wielaard2024-08-211-1/+1
| | | | | | | | | | libeu is a static library with internal helper functions normally included in all shared libraries. But when linking static (with --enable-gcov) we need to explicitly link it into the test binaries. * tests/Makefile.am (libelf): Add $(libeu) when BUILD_STATIC. Signed-off-by: Mark Wielaard <[email protected]>
* debuginfod: Make sure crypto and jsonc are also included in static linkMark Wielaard2024-08-211-1/+1
| | | | | | | | | | | When doing a --enable-gcov build we link all binaries static. libdebuginfod.so now depends on crypto an jsonc. So also add those when linking against libdebuginfod.a debuginfod/Makefile.am (libdebuginfod): Add $(crypto_LIBS) $(jsonc_LIBS) when BUILD_STATIC. Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Make libdw_findcu thread-safeHeather McIntyre2024-08-201-13/+25
| | | | | | | | * libdw/libdw_findcu.c (__libdw_findcu): Add locking. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdw: Make libdw_find_split_unit thread-safeHeather McIntyre2024-08-205-2/+21
| | | | | | | | | | | | | | | * libdw/dwarf_end.c (cu_free): Free split_lock. * libdw/dwarf_formref_die.c (dwarf_formref_die): Add locking around call to __libdw_intern_next_unit. * libdw/libdwP.h (struct Dwarf_CU): Add split_lock. * libdw/libdw_find_split_unit.c (__libdw_find_split_unit): Add locking. * libdw/libdw_findcu.c (__libdw_intern_next_unit): Init split_lock. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdwP.h: Add locking to __libdw_dieabbrevHeather McIntyre2024-08-203-4/+27
| | | | | | | | | | | | * libdw/dwarf_end.c (cu_free): Free abbrev_lock. * libdw/libdwP.h (__libdw_dieabbrev): Add locking. (struct Dwarf_CU): Define abbrev_lock. * libdw/libdw_findcu.c (__libdw_intern_next_unit): Init abbrev_lock. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libdw: make dwarf_getalt and dwarf_setalt thread-safeHeather McIntyre2024-08-205-4/+36
| | | | | | | | | | | | * libdw/dwarf_begin_elf.c (dwarf_begin_elf): Init dwarf_lock. * libdw/dwarf_end.c (dwarf_end): Free dwarf_lock. * libdw/dwarf_getalt.c (dwarf_getalt): Add locking. * libdw/dwarf_setalt.c (dwarf_setalt): Ditto. * libdw/libdwP.h (struct Dwarf): Define dwarf_lock. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroyHeather McIntyre2024-08-2025-118/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add struct search_tree to hold tree root and lock. Add new eu_t* functions for ensuring synchronized tree access. Replace tsearch, tfind, etc with eu_t* equivalents. lib: * Makefile.am (libeu_a_SOURCES): Add eu-search.c. (noinst_HEADERS): Add eu-search.h and locks.h. * eu-config.h: Move rwlock macros to locks.h. * eu-search.c: New file containing tree search functions with locking. * eu-search.h: New file. * locks.h: New file containing rwlock macros previously in eu-config.h. libdw: * cfi.h (struct Dwarf_CFI_s): Change type of search tree members from void * to search_tree. * cie.c: Replace tree search functions with eu-search equivalents. * dwarf_begin_elf.c (valid_p): Initialize search trees. * dwarf_end.c (cu_free): Replace tree search functions with eu-search equivalents. * dwarf_getcfi.c (dwarf_getcfi): Initialize search trees. * dwarf_getlocations.c: Replace search tree functions with eu-search equivalents. (__libdw_intern_expression): Change type of cache parameter to search_tree *. * dwarf_getmacros.c: Replace tree search functions with eu-search equivalents. * dwarf_getsrclines.c: Ditto. * fde.c: Ditto. * frame-cache.c (__libdw_destroy_frame_cache): Initialize search trees. * libdwP.h (struct Dwarf): Change type of search tree members from void * to search_tree. (struct Dwarf_CU): Ditto. (__libdw_intern_expression): Change type of cache parameter to search_tree *. * libdw_find_split_unit.c: Replace tree search functions with eu-search equivalents. * libdw_findcu.c: Ditto. libdwfl: * cu.c: Ditto. * libdwflP.h (struct Dwfl_Module): Replace void *lazy_cu_root with search_tree lazy_cu_tree. libelf: * elf_begin.c (file_read_elf): Initialize rawchunck_tree. * elf_end.c (elf_end): Replace tree search function with eu-search equivalent. * elf_getdata_rawchunck.c: Ditto. * libelfP.h (struct Elf): Replace void * rawchuncks member with search_tree rawchunk_tree. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Fix deadlock in elf_cntlHeather McIntyre2024-08-201-11/+3
| | | | | | | | | * libelf/elf_cntl.c (elf_cntl): Move rwlock_wrlock, rwlock_unlock, inside case switch statements. Remove unnecessary early return. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* libelf: Fix deadlock in __libelf_readallHeather McIntyre2024-08-202-12/+16
| | | | | | | | Apply locking during __libelf_readall. Signed-off-by: Heather S. McIntyre <[email protected]> Signed-off-by: Aaron Merey <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* aarch64: add some new core note types nameKuan-Ying Lee2024-08-171-0/+3
| | | | | | Recognize names of some new core note types in ebl_core_note_type_name. Signed-off-by: Kuan-Ying Lee <[email protected]>
* aarch64: Add NT_ARM_TAGGED_ADDR_CTRL regsetKuan-Ying Lee2024-08-172-1/+11
| | | | | | | Add the NT_ARM_TAGGED_ADDR_CTRL regset for aarch64. Recognize and print this new core itme. Signed-off-by: Kuan-Ying Lee <[email protected]>
* libelf: Sync elf.h from glibcMark Wielaard2024-08-171-0/+4
| | | | | | * libelf/elf.h: Adds NT_ARM_{SSVE,ZA,ZT,FPRM} Signed-off-by: Mark Wielaard <[email protected]>
* Avoid overriding libcxx system headerAlfred Wingate2024-08-142-1/+3
| | | | | | | | | | Replace -I with -iquote to avoid overriding stack system header from libcxx-18 with the previously built stack binary. Override DEFAULT_INLCUDES because m4 adds -I. by default. https://bugs.gentoo.org/925241 Signed-off-by: Aaron Merey <[email protected]>