aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2025-12-09lto-wrapper warning noteAlan Modra1-0/+1
Current gcc adds a note to the LTO "using serial compilation" warning. * lib/binutils-common.exp (prune_warnings_extra): Remove lto-wrapper note.
2025-12-09Revert "Re: Add warning message to readelf for local symbols"Alan Modra1-1/+0
This reverts commit f70242a98f91b7f5ec5b375346d8bfa7f9a61c4a. Nick already applied this..
2025-12-09Re: Add warning message to readelf for local symbolsAlan Modra1-0/+1
Limit the warning to ET_REL.
2025-12-08readelf: Only check for out of bounds local symbols in object filesAlan Modra1-5/+5
2025-12-08readelf: Do not warn about mapping symbols that extend beyond the end of ↵Nick Clifton1-5/+18
mergeable sections
2025-12-08PR 33701, abort in byte_get_little_endianAlan Modra1-3/+5
PR 33701 * dwarf.c (process_debug_info): Set debug_info_p NULL when DEBUG_INFO_UNAVAILABLE.
2025-12-08PR 33698 and PR 33700Alan Modra1-3/+3
It is possible for dump_relocations to return on an error from slurp_rela_relocs or slurp_rel_relocs without writing to "all_relocations". In that case an uninitialised r_symbol is passed to free at the end of process_got_section_contents. PR 33698 PR 33700 * readelf.c (update_all_relocations): Zero array. Remove unnecessary casts.
2025-12-08PR 33697, fuzzer segfaultAlan Modra1-5/+3
PR 33697 * readelf.c (process_relocs): Don't segfault on no sections.
2025-12-08elf: Add SHT_SUNW_ctf and SHT_SUNW_symnsortH.J. Lu1-4/+6
On Solaris 11.4, there is SHT_SUNW_symnsort and no SHT_SUNW_symtabnsort. SHT_SUNW_symnsort is defined to 0x6fffffec, which is the same as SHT_SUNW_symtabnsort. There is also SHT_SUNW_ctf. Add SHT_SUNW_ctf and rename SHT_SUNW_symtabnsort to SHT_SUNW_symnsort. Move SHT_SUNW_phname after SHT_SUNW_symnsort. binutils/ * readelf.c (get_solaris_section_type): Add SHT_SUNW_ctf and SHT_SUNW_symnsort. Move SHT_SUNW_phname after SHT_SUNW_symnsort. Remove SHT_SUNW_symtabnsort. include/ * elf/common.h (SHT_SUNW_ctf): New. (SHT_SUNW_symtabnsort): Renamed to ... (SHT_SUNW_symnsort): This. (SHT_SUNW_phname): Moved after SHT_SUNW_symnsort. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-04Add warning message to readelf for local symbols that reference beyond the ↵Nick Clifton1-2/+19
end of a mergeable section.
2025-12-04copy_object: Re-indentH.J. Lu1-2/+2
* objcopy.c (copy_object): Re-indent. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-12-02Synchronize the dwarf2.h and dwarf2.def files with their gcc counterparts, ↵Nick Clifton1-0/+76
bringing the definitions of DW_AT_language_name and DW_AT_language_version. Add code to binutils/dwarf.c to display these attributes.
2025-11-30PR 33637, abort in byte_getAlan Modra1-18/+6
When DWARF5 support was added to binutils in commit 77145576fadc, the loop over CUs in process_debug_info set do_types when finding a DW_UT_type unit, in order to process the signature and type offset entries. Unfortunately that broke debug_information/debug_info_p handling, which previously was allocated and initialised for each unit in .debug_info. debug_info_p was NULL when processing a DWARF4 .debug_types section. After the 77145576fadc change it was possible for debug_infp_p to be non-NULL but point to zeroed data, in particular a zeroed offset_size. A zero for offset_size led to the byte_get_little_endian abort triggered by the fuzzer testcase. I haven't investigated whether there is any need for a valid offset_size when processing a non-fuzzed DWARF4 .debug_types section. Presumably we'd have found that out in the last 6 years if that was the case. We don't want to change debug_information[] for .debug_types! PR 33637 * dwarf.c (process_debug_info): Don't change DO_TYPES flag bit depending on cu_unit_type. Instead test cu_unit_type along with DO_TYPES to handle signature and type_offset for a type unit. Move find_cu_tu_set_v2 call a little later.
2025-11-30Re: bfd/Dwarf: Add suitable defines to use at call and use sitesAlan Modra1-31/+28
Commit 1f7e70ddd2c4 made changes to process_debug_info parameters without adjusting the function comment to suit. Fix that, and tidy do_printing flag use. * dwarf.c (process_debug_info): Edit function comment. Make do_printing a bool. Fold DO_LOC test into do_printing.
2025-11-28bfd/Dwarf: Add suitable defines to use at call and use sitesGuillaume VACHERIAS1-32/+43
use do_loc and do_types arguments into a signle unsigned int do_flags for better code readability. binutils/ * dwarf.c (DO_LOC, DO_TYPES): Define. (process_debug_info): Change arguments do_loc and do_types to a single unsigned int do_flags. (find_cu_tu_set_v2): Change parameter do_types from int to bool. Signed-off-by: Guillaume VACHERIAS <guillaume.vacherias@foss.st.com>
2025-11-25replace tail with sedAlan Modra1-1/+1
The default Solaris tail doesn't support "tail -n +4", apparently. Use sed instead. PR 33396 * testsuite/binutils-all/objdump.exp: Replace tail with an equivalent sed expression in dwarf5 objdump -Wi test.
2025-11-24Make readelf not print 'foo@@' for normal symbolsMichael Matz1-2/+2
when a symbol 'foo' is exported and non-hidden and hence is available for resolving from other objects it's unreasonable for readelf to print it as 'foo@@'. If it's not available for unversioned resolving because its version is hidden (but without name), then continue printing it as 'foo@' to indicate that something special goes on.
2025-11-22Re: dlltool memory leaksAlan Modra1-0/+1
I missed one needed strdup of symbol names, needed since the original symbol name memory is freed on bfd_close. PR 33651 * dlltool.c (scan_filtered_symbols): xstrdup symbol name.
2025-11-22PR 33639 .debug_loclists outputAlan Modra1-6/+14
The fuzzed testcase in this PR prints an almost endless table of offsets, due to a bogus offset count. Limit that count, and the total length too. PR 33639 * dwarf.c (display_loclists_unit_header): Return error on length too small to read header. Limit length to section size. Limit offset count similarly.
2025-11-22PR 33638, debug_rnglists outputAlan Modra1-33/+34
The fuzzed testcase in this PR continuously outputs an error about the debug_rnglists header. Fixed by taking notice of the error and stopping output. The patch also limits the length in all cases, not just when a relocation is present, and limits the offset entry count read from the header. I removed the warning and the test for relocs because the code can't work reliably with unresolved relocs in the length field. PR 33638 * dwarf.c (display_debug_rnglists_list): Return bool. Rename "inital_length" to plain "length". Verify length is large enough to read header. Limit length to rest of section. Similarly limit offset_entry_count. (display_debug_ranges): Check display_debug_rnglists_unit_header return status. Stop output on error.
2025-11-22bfd_copy_private_symbol_dataAlan Modra1-1/+1
Allow copy_private_symbol_data to replace osym if a target desires. Change isym similarly for symmetry. The idea is to make it possible to give the asymbol an output target specific extension. Some targets, eg. som, use such an extension when outputting symbols, behaving badly if the input object is not som. There are no functional changes in this patch; It just changes the signatures. bfd/ * elf-bfd.h (_bfd_elf_copy_private_symbol_data): Replace asymbol* params with asymbol**. * elf.c (_bfd_elf_copy_private_symbol_data): Likewise. * libbfd-in.h (_bfd_bool_bfd_asymbol_bfd_asymbol_true): Likewise. * libbfd.c (_bfd_bool_bfd_asymbol_bfd_asymbol_true): Likewise. * mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Likewise. * mach-o.h (bfd_mach_o_bfd_copy_private_symbol_data): Likewise. * plugin.c (bfd_plugin_bfd_copy_private_symbol_data): Likewise. * som.c (som_bfd_copy_private_symbol_data): Likewise. * targets.c (bfd_target <_bfd_copy_private_symbol_data>): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. binutils/ * objcopy.c (copy_object): Adjust bfd_copy_private_symbol_data call. gas/ * symbols.c symbol_clone): Adjust bfd_copy_private_symbol_data call.
2025-11-17bfd/ELF: Core file support for AArch64 FPMREzra Sitorus1-0/+2
The Floating Point Mode Register is a new register which controls the behaviour of FP8 instructions. This is handled by the Linux kernel through a new NT_ARM_FPMR register set. This patch adds required code to support core file dumps with NT_ARM_FPMR in them.
2025-11-14objcopy binary symbol type checkAlan Modra1-2/+5
This exposes an error on alpha-linux-gnuecoff where the start and end syms are given the wrong storage class. * testsuite/binutils-all/objcopy.exp (binary_symbol): Tighten symbol type checking.
2025-11-11objcopy binary symbol testAlan Modra1-13/+17
A small tidy that allows other symbols or warnings to appear in nm output, and works around the case problem of windows drive letters by simply omitting the $srcdir match. * testsuite/binutils-all/objcopy.exp (binary_symbol): Check objcopy and nm return status. Don't repeat prune_warnings already done in binutils_run. Match each symbol separately, reporting which match failed on a failure. Don't match $srcdir in implicit test.
2025-11-10readelf: Fix typo in --version-info documentationDennis Dyallo1-1/+1
Change "it they exist" to "if they exist" in the description of the --version-info option in the readelf man page.
2025-11-08readelf: Display the base symbol version as empty stringH.J. Lu1-2/+6
Update readelf to display the base symbol version as Symbol table for image contains 5 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000003008 0 OBJECT GLOBAL DEFAULT 10 bar@@ 2: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS VERS_1 3: 0000000000003008 0 OBJECT GLOBAL DEFAULT 10 bar@@VERS_1 4: 0000000000003000 0 OBJECT GLOBAL DEFAULT 10 foo@ instead of Symbol table for image contains 5 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000003008 0 OBJECT GLOBAL DEFAULT 10 bar 2: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS VERS_1 3: 0000000000003008 0 OBJECT GLOBAL DEFAULT 10 bar@@VERS_1 4: 0000000000003000 0 OBJECT GLOBAL DEFAULT 10 foo That is bar@@ and foo@ vs bar and foo. binutils/ PR binutils/33599 * readelf.c (process_version_sections): Replace 0x8001 with (VERSYM_HIDDEN | VERSYM_BASE). (get_symbol_version_string): Likewise. Return "" for the base version. include/ PR binutils/33599 * elf/common.h (VERSYM_BASE): New. ld/ PR binutils/33599 * testsuite/ld-elf/pr33599.d: New file. * testsuite/ld-elf/pr33599.map: Likewise. * testsuite/ld-elf/pr33599.s: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-05binutils/MAINTAINERS: list new gprofng maintainersJose E. Marchesi1-0/+2
As agreed with Nick I will be co-maintaining gprofng moving forward along with Claudiu. Update the MAINTAINERS file accordingly.
2025-11-03Remove call to abort in the DGB debug format printing code, thus allowing ↵Nick Clifton1-1/+0
the display of a fuzzed input file to complete without triggering an abort. PR 33448
2025-11-03tidy m4 plugin config supportAlan Modra2-80/+78
In CLANG_PLUGIN_FILE it is possible for plugin_file to be non-NULL when LLVMgold.so does not exist. configure output is messy, with results not printed against their "checking.." line, eg. checking for clang... (cached) yes checking for clang plugin file... checking for x86_64-pc-linux-gnu-ar... (cached) ar --plugin /usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so /usr/lib/llvm-20/lib/clang/20/../../LLVMgold.so This patch fixes those problems, and a similar interposition of other configure output between AC_MSG_CHECKING and AC_MSG_RESULT in gcc-plugin.m4. It also tidies some of the message text, and makes similar code in gcc-plugin.m4 and clang-plugin.m4 a little more consistent. config/ * clang-plugin.m4 (CLANG_PLUGIN_FILE): Don't place checks for tools (llvm-config, ar) inside AC_MSG_CHECKING..AC_MSG_RESULT for clang plugin file. Clear plugin_file before loop exit. (CLANG_PLUGIN_FILE_FOR_TARGET): Similarly. * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Similarly. (GCC_PLUGIN_OPTION_FOR_TARGET): Correct AC_MSG_CHECKING. Tidy return code. binutils/ * testsuite/lib/binutils-common.exp <llvm_plug_opt>: Set for non-native. * configure: Regenerate. / * configure: Regenerate. bfd/ * configure: Regenerate. gas/ * configure: Regenerate. gdb/ * configure: Regenerate. gprof/ * configure: Regenerate. gprofng/ * configure: Regenerate. * libcollector/configure: Regenerate. ld/ * configure: Regenerate. libbacktrace/ * configure: Regenerate. libctf/ * configure: Regenerate. libiberty/ * configure: Regenerate. libsframe/ * configure: Regenerate. opcodes/ * configure: Regenerate. sim/ * configure: Regenerate. zlib/ * configure: Regenerate.
2025-10-31Pass -B to objcopy binary symbol testAlan Modra1-3/+5
objcopy -I binary -O some_coff_target does not currently work without choosing a valid arch with -B. This used to be the case for ELF targets too, until commit 6765ee1825d9. * testsuite/binutils-all/objcopy.exp (binary_symbol): Pass -B arch to objcopy. Choose different output object files for the two tests.
2025-10-30objcopy: add option to specify custom prefix for symbol of binary inputAlon Bar-Lev3-0/+66
When using --input-target=binary, objcopy currently derives symbol names from a mangled version of the input file name. This approach can lead to unpredictable results, as the generated symbols depend on the file path and working directory. This patch introduces a new option: --binary-symbol-prefix <prefix> Use <prefix> as the base symbol name for the input file (default: derived from file name) It allows specifying an explicit symbol prefix, while preserving the existing behavior as a fallback. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2025-10-22objcopy: Don't add zstd to the debug compression options if not availablePietro Monteiro1-2/+8
If zstd is not available or was intentionally disabled by the user don't add it to the list of the available options to compress debug sections when showing usage. binutils/ * objcopy.c (copy_usage): Only output --compress-debug-sections=zstd if HAVE_ZSTD.
2025-10-15gas: sframe: Represent .cfi_undefined RA as FRE without offsetsJens Remus1-0/+5
In DWARF CFI an "undefined" register rule for the return address (RA) register indicates that there is no return address and the stack trace is complete. Represent DW_CFA_undefined as SFrame FRE without any offsets, so that a stack tracer implementation can use this as indication that an outermost frame has been reached and the stack trace is complete. This representation is backward compatible, as existing stack tracers should already deal with the case, that an SFrame FRE a so far invalid offset count of zero and stop the trace. include/ * sframe.h (SFRAME_V2_FRE_RA_UNDEFINED_P): New macro to test FRE info word for RA undefined (FRE without any offsets). binutils/ * NEWS: Mention SFrame can represent an undefined RA as FRE without any offsets. gas/ * gen-sframe.h (struct sframe_row_entry): Add ra_undefined_p flag. * gen-sframe.c (sframe_row_entry_new): Initialize ra_undefined_p flag to not set. (sframe_row_entry_initialize): Treat ra_undefined_p flag as sticky. (sframe_fre_set_ra_track): Reset ra_undefined_p flag. (sframe_xlate_do_restore): Reset ra_undefined_p flag to saved state. (sframe_xlate_do_same_value): Reset ra_undefined_p flag. (sframe_xlate_do_cfi_undefined): For RA set ra_undefined_p flag. (output_sframe_row_entry): Represent RA undefined as SFrame FRE without any offsets and FRE info word fields zeroed. * NEWS: Mention assembler represents .cfi_undefined RA in SFrame as FRE without any offsets. libsframe/ * doc/sframe-spec.texi (Changes from Version 1 to Version 2): Mention that a SFrame FRE without any offsets flag indicates an outermost frame with an undefined RA. (fre_offset_count): Document that a FRE offset count of zero indicates an outermost frame with an undefined RA. * sframe.c (sframe_get_fre_ra_undefined_p): Use macro SFRAME_V2_FRE_RA_UNDEFINED_P. (sframe_fre_get_fp_offset, sframe_fre_get_ra_offset): Do not return fixed FP/RA offset if RA undefined. * sframe-dump.c (dump_sframe_func_with_fres): Show FRE without any offsets as "RA undefined". gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Run tests for .cfi_undefined RA on AArch64, s390x, and x86-64. * gas/cfi-sframe/cfi-sframe-aarch64-ra-undefined-1.d: Add test for .cfi_undefined RA on AArch64. * gas/cfi-sframe/cfi-sframe-aarch64-ra-undefined-1.s: Likewise. * as/cfi-sframe/cfi-sframe-s390x-ra-undefined-1.d: Add test for .cfi_undefined RA on s390x. * gas/cfi-sframe/cfi-sframe-s390x-ra-undefined-1.s: Likewise. * gas/cfi-sframe/cfi-sframe-x86_64-ra-undefined-1.d: Add test for .cfi_undefined RA on x86-64. * gas/cfi-sframe/cfi-sframe-x86_64-ra-undefined-1.s: Likewise. Signed-off-by: Jens Remus <jremus@linux.ibm.com>
2025-10-13Add a position statement about LLM generated contentNick Clifton1-0/+62
2025-10-13Add note about how to obtain permission to upload new releasesNick Clifton1-2/+4
2025-10-10objdump: enable PE support for InterixJan Beulich2-2/+2
This is just so the target won't need excluding in a forthcoming new testcase. Without doing so objdump would fail saying "option -P/--private not supported by this file".
2025-10-08cris: bfd: Default selected target to the configured targetHans-Peter Nilsson5-0/+45
Whether targ_defvec is set to the best match for the configured target or some of the other supported targets usually doesn't matter, as the actual target being used, usually is set by some other mechanism, like an input object file. In some situations it matters though: it might be confusing to see --help output not showing the configured target first in the list of supported targets. Also, some corner cases risk running into bugs like PR33485, for cris-elf and cris-linux because cris_aout_vec is the default target where instead the bug-free behavior of cris_elf32_us_vec or cris_elf32_vec would be expected. The test just verifies that the target list emitted for the --help option has the expected target first. bfd: * config.bfd <cris-*-* | crisv32-*-*>: Split into <cris-*-*aout*>, <cris-*-linux-* | crisv32-*-linux-*>, <cris-*-* | crisv32-*-*> cases respectively setting targ_defvec per the target instead of always cris_aout_vec. binutils: * testsuite/binutils-all/cris: New directory intended for tests focused on behavior of the binutils programs, not the assembler or linker. * testsuite/binutils-all/cris/cris.exp: New file with run_dump_test loop. testsuite/binutils-all/cris/tgt-a.d, testsuite/binutils-all/cris/tgt-e.d, testsuite/binutils-all/cris/tgt-l.d: New tests. Co-authored-by: Maciej W. Rozycki <macro@redhat.com>
2025-10-06segv in debug_write_typeAlan Modra1-3/+8
In commit 6c3458a8b7ee I claimed that u.kenum is always non-NULL, which is true for debug_make_enum_type, but not for enums made by debug_make_undefined_tagged_type. Fix that oversight PR 32829 * debug.c (debug_write_type): Handle NULL u.kenum. (debug_type_samep): Likewise.
2025-10-06readelf reloc range checkAlan Modra1-21/+21
A fuzzed object file hit this sanitizer error. readelf.c:16764:9: runtime error: pointer index expression with base 0x6dd4491e1590 overflowed to 0xe7af96d4491e17a1 The same could occur in any of the IN_RANGE reloc checks, where the reloc address is calculated as "start + r_offset" then compared against "start" and "end". So don't do that. Compare r_offset against the memory size, first. * readelf.c (IN_RANGE): Delete. (in_range): New inline funcion. (target_specific_reloc_handling): Replace "end" param with "size". Update uses. Replace IN_RANGE with in_range. (apply_relocations): Delete "end" variable. Update target_specific_reloc_handling calls and replace IN_RANGE. Avoid pointer overflow.
2025-09-26Dwarf: adjust fetch_indirect{,_line}_string()'s return typeJan Beulich1-42/+40
As already is the case for fetch_indexed_string() and fetch_alt_indirect_string(), have them return a pointer to plain char, properly compatible with e.g. the %s format specifier that the return values are used with in several cases. This way no casts at call sites are necessary, and several (bogus) ones in the functions can be exchanged for just one each. Some other constification is needed elsewhere, now that const-ness isn't being cast away anymore.
2025-09-25Binutils: Add clang LTO support to AR and RANLIBH.J. Lu3-15/+395
Detect the clang plugin file and and pass it to --plugin for ar and ranlib so that binutils can be built with clang LTO. bfd/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. binutils/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. gas/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. gprof/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * testsuite/Makefile.in: Likewise. gprofng/ PR binutils/33470 * Makefile.am (ACLOCAL_AMFLAGS): Add -I ../config. * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. * gp-display-html/Makefile.in: Likewise. * libcollector/Makefile.in: Likewise. * libcollector/aclocal.m4: Likewise. * libcollector/configure: Likewise. * src/Makefile.in: Likewise. * libcollector/Makefile.am (ACLOCAL_AMFLAGS): Add -I ../../config. ld/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. libctf/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. libsframe/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. opcodes/ PR binutils/33470 * Makefile.in: Regenerated. * aclocal.m4: Likewise. * configure: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-09-18Updated and new translations for the binutilsNick Clifton3-1952/+15836
2025-09-16binutils: testsuite: fix duplicate testnames in readelf.expRichard Earnshaw1-3/+1
There are two places in readelf.exp where we generate duplicate testnames. The first is due to calling readelf_find_size twice with the same iteration index (2). This is fixed by using 4 for the second instance. The other is at the end of readelf_thin_archive_test. This test calls readelf_test before unconditionally passing. It happens to construct exactly the same test name as readelf test (might not be a coincidence), so we end up with a duplicate test. But it seems wrong anyway to 'pass' a test that readelf_test might have failed, so simply delete this duplicate pass entry.
2025-09-16binutils: testsuite: avoid dup names when using multiple as: directivesRichard Earnshaw1-11/+16
binutils tests support running a test with distinct options to the assembler by allowing #as: <optset-1> #as: <optset-2> But results in both test runs using the same test name in the summary file. This causes confusion if one test fails but the other doesn't (and GCC's compare_tests script will diagnose this as an error). To fix the ambiguity append the appropriate optset to the test name. We only do this if a test has multiple runs in this way to avoid causing every test result name to change.
2025-09-10Revert "binutils: Require GNU tail for 'objdump -Wi' test"H.J. Lu6-63/+4
This reverts commit 897d8d7bba581e4c1614af5712b730b006f03407.
2025-09-10readelf: tidy dump_relr_relocationsAlan Modra1-5/+12
A comment in display_relocations said "RELRS has been freed by dump_relr_relocations". Except that hadn't happened on all return paths. Tidy that by freeing relrs allocated in dump_relr_relocations in that function, and relrs allocated in display_relocation in that function. * readelf.c (dump_relr_relocations): Only free relrs allocated in this function. (display_relocations): Free relrs here, on error return paths too.
2025-09-09Correct -Ue output for nm, objdump and readelfAndrew C Aitchison3-6/+6
..., like PR33360 does for strings. Signed-off-by: Andrew C Aitchison <github@aitchison.me.uk>
2025-09-09nm: fix treating an ifunc symbol as a stab if '--ifunc-chars=--' is givenDmitry Klochkov2-3/+24
If an ifunc symbol is processed in print_symbol(), a 'type' field of a 'syminfo' structure is set to any character specified by a user with an '--ifunc-chars' option. But afterwards the 'type' field is used to check whether a symbol is a stab in print_symbol_info_{bsd,sysv}() functions in order to print additional stab related data. If the 'type' field equals '-', a symbol is treated as a stab. If '--ifunc-chars=--' is given, all ifunc symbols will be treated as stab symbols and uninitialized stab related fields of the 'syminfo' structure will be printed which can lead to segmentation fault. To fix this, check if a symbol is a stab before override the 'type' field. Also, add a test case for this fix. PR binutils/32556 * nm.c (extended_symbol_info): Add is_stab. (print_symbol): Check if a symbol is a stab. (print_symbol_info_bsd): Use info->is_stab. (print_symbol_info_sysv): Use info->is_stab. * testsuite/binutils-all/nm.exp: Test nm --ifunc-chars=--. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32556 Fixes: e6f6aa8d184 ("Add option to nm to change the characters displayed for ifunc symbols") Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com>
2025-09-09PR 33406 SEGV in dump_dwarf_sectionAlan Modra1-4/+6
Trying to dump .sframe in a PE file results in a segfault accessing elf_section_data. * objdump (dump_sframe_section, dump_dwarf_section): Don't access elf_section_type without first checking the file is ELF.
2025-09-09objcopy: when an invalid bfd target string is used as a target option, print ↵Nick Clifton1-3/+12
an error message that references the target string, not the file being copied