aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2026-04-24x86 disassembler: Add -Mannotate option to display symbolic names associated ↵Nick Clifton3-0/+41
with immediates
2026-04-17Add --debug-dir option to readelf and objdumo. Load separate debug info ↵Nick Clifton6-49/+69
files when disassemblng.
2026-04-09binutils/readelf: Remove unused static variablesBratislav Filipovic1-4/+0
Remove static variables do_ctf and do_sframe that are set but never read, causing build failures with LLVM's extended -Wunused-but-set-variable warning. These variables are dead code: - Declared at lines 244-245 as static booleans - Set to true when --ctf or --sframe options are parsed - Never actually used or read anywhere in the code - The actual dump functionality is triggered by request_dump() calls Build error with -Werror enabled: binutils/readelf.c:244:13: error: variable 'do_ctf' set but not used [-Werror,-Wunused-but-set-variable] binutils/readelf.c:245:13: error: variable 'do_sframe' set but not used [-Werror,-Wunused-but-set-variable]
2026-04-03ld: Pass --no-rosegment to ld in some linker testsH.J. Lu1-0/+18
For elf/x86, --rosegment places code after read-only data, instead of before read-only data. Pass --no-rosegment to ld in some linker tests to avoid extra linker test failures when binutils is configured with --enable-rosegment for elf/x86. binutils/ PR ld/34003 * testsuite/lib/binutils-common.exp (check_rosegment_support): New. (run_dump_test): Make NO_ROSEGMENT_LDFLAGS global. ld/ PR ld/34003 * testsuite/config/default.exp (NO_ROSEGMENT_LDFLAGS): New. * testsuite/ld-elf/mbind1a.d: Pass $NO_ROSEGMENT_LDFLAGS to ld. * testsuite/ld-elf/pr26256-2b.d: Likewise. * testsuite/ld-srec/srec.exp (extra_flags): Add $NO_ROSEGMENT_LDFLAGS. * testsuite/ld-x86-64/no-plt.exp: Pass -Wl,--no-rosegment to compiler. * testsuite/ld-x86-64/pr27491-1c.d: Pass --no-rosegment to ld. * testsuite/ld-x86-64/pr27491-2.d: Likewise. * testsuite/ld-x86-64/pr27491-3.d: Likewise. * testsuite/ld-x86-64/pr27491-4.d: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2026-04-02remove arm-linux-gnu from supports_gnu_osabiAlan Modra1-13/+19
arm-linux-gnueabi allows OS/ABI to be set to ELFOSABI_GNU, but plain arm-linux-gnu like arm-elf is ELFOSABI_ARM.
2026-03-30MAINTAINERS: update my email addressIndu Bhagat1-1/+1
Signed-off-by: Indu Bhagat <ibhagatgnu@gmail.com>
2026-03-13binutils/testsuite: don't leave temporary files in main dirJan Beulich1-0/+3
Leaving files in tmpdir/ is generally okay (often intended and helpful), but the main directory really shouldn't be cluttered.
2026-03-13testsuites: prune checking gas for CFI / SFrameJan Beulich1-2/+10
Both leave the generated assembler file around. Maybe that's okay-ish when left in tmpdir/, but the main directories really shouldn't be cluttered. The file actually doesn't even need putting there when not working with a remote host. The SFrame test additionally leaves an a.out file in the main directory, then the assembler output isn't really of interest anyway.
2026-03-13check sframe version in _bfd_elf_parse_sframeAlan Modra1-0/+3
Currently if you attempt to link an object file with sframe version 2 contents, the linker will complain in _bfd_elf_merge_section_sframe and fail to produce an output. This affects anyone who has objects assembled by binutils-2.45 with .sframe sections. A work-around is to pass --discard-sframe to ld. Ideally the linker would rewrite version 2 sframe input to version 3, but in the absence of that support it would be nicer if ld just ignored version 2 (or 1) sframe sections without needing to pass --discard-sframe. That is the aim of this patch. It does so by checking the sframe version in _bfd_elf_parse_sframe where various failing checks result in an error being printed and the section not being marked as SEC_INFO_TYPE_SFRAME, but causes no overall linker failure. In addition, an sframe version failure now also marks the sframe section with SEC_EXCLUDE. This is also done for other sframe failures. See the changelog below for other fixes. bfd/ * elf-sframe.c (_bfd_elf_merge_section_sframe): Don't check sframe version here. (_bfd_elf_parse_sframe): Check sframe version here instead. Do the "already parsed" check first. Reorder various other checks. Do not bother parsing or print errors when discard_sframe is set. Free section contents on failure paths. Set SEC_EXCLUDE for fails. Check for NULL bfd_zalloc return, and only allocate after successfully parsing sframe. On errors report that the section will be ignored, not "no .sframe will be created". binutils/ * testsuite/lib/binutils-common.exp: Ignore sframe version errors.
2026-03-13prune_warnings_extra quotingAlan Modra1-10/+10
This patch just tidies the code a little. By using tcl {} quoting rather than "" we can reduce the need for backslash quoting. * testsuite/lib/binutils-common.exp (prune_warnings_extra): Use tcl {} quoting.
2026-03-11MAINTAINERS: Add myself as a PRU maintainerDimitar Dimitrov1-0/+1
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2026-03-10Remove POISON_BFD_BOOLEANAlan Modra1-2/+0
We don't need this definition any more. Incidentally, the poisoning wasn't effective in gas since the define came after bfd.h was included.
2026-02-27PR 33743 readelf abort during RELR relocation handlingAlan Modra1-2/+3
Rather than aborting, use "unknown relative" as the reloc type should display_elf_relocation_at want to print a relocation. Also fix another case where readelf doesn't understand the relocation and sets all_relocations[i].r_name to NULL. PR 33743 * readelf.c (dump_relr_relocations): Don't abort on unknown e_machine. (dump_relocations): Don't assume we can pass NULL to a %s format.
2026-02-26Work around gcc-4.9 bugAlan Modra1-6/+6
Commit 893eb49c9b12 exposed a gcc-4.9 build error, with gcc-4.9 erroneously complaining that F_MIN_SUBSECTION_DATA_LEN has a non-constant initialisation. * readelf.c (F_MIN_SUBSECTION_DATA_LEN): Use #define to work around gcc-4.9 bug. (F_SUBSECTION_LEN, F_SUBSECTION_COMPREHENSION), (F_SUBSECTION_ENCODING): Use #define here too. (elf_parse_attrs_subsection_v2): Adjust format string.
2026-02-24readelf: endless loop on attrv2Alan Modra1-21/+18
Given a short attributes section, elf_parse_attrs_subsection_v2 prints an error message but does not return an error status or consume any input. That results in endless printing of "Object attributes section ends prematurely". The length checks also ignored a single excess byte at the end of the section. * readelf.c (elf_parse_attrs_subsection_v2): Move various constants out of function. Don't check for min length here.. (process_attributes_v2): ..do so here instead.
2026-02-23binutils: fix a typo in docRocketDev1-1/+1
Add a missing dash to indicate j is a flag Signed-off-by: RocketDev <marocketbd@gmail.com>
2026-02-23binutils.texi: break overlong synopsis options linesAlan Modra1-25/+79
Also fix typos in objdump options (-wD/-wE should be -WD/-WE), and move ar man synopsis where it belongs.
2026-02-23readelf .debug_aranges header displayAlan Modra3-6/+6
Print "Address size" rather than "Pointer Size" and "Segment size" rather than "Segment Size", using the same names and capitalisation as is used when printing other headers with these fields. binutils/ * dwarf.c * testsuite/binutils-all/i386/compressed-1a.d * testsuite/binutils-all/x86-64/compressed-1a.d gas/ * testsuite/gas/aarch64/dwarf.d: Update expected output. * testsuite/gas/i386/dw2-compress-3a.d: Likewise. * testsuite/gas/i386/dw2-compress-3b.d: Likewise. * testsuite/gas/i386/dw2-compressed-3a.d: Likewise. * testsuite/gas/i386/dw2-compressed-3b.d: Likewise. * testsuite/gas/elf/dwarf-5-irp.d: Likewise. * testsuite/gas/elf/dwarf2-20.d: Likewise, and match mn10200 output, removing xfail.
2026-02-23binutils: rename ar_pointer_sizeAlan Modra2-9/+9
The field is named "address size" in all versions of the DWARF spec that have and name the field. Reflect that by renaming ar_pointer_size to ar_address_size.
2026-02-23PR 33914 abort parsing fuzzed .debug_lineAlan Modra1-68/+58
The abort is due to an unexpected DW_FORM_addrx3 entry in the testcase, which requires pointer_size to be known. * dwarf.c (address_size_ok): New function. (read_debug_line_header): Use address_size_ok. (display_formatted_table): Pass li_address_size as pointer_size to read_and_display_attr_value. (display_debug_lines_decoded): Likewise. (display_debug_macro, display_debug_names): Similarly pass offset_size. (display_loclists_unit_header): Use address_size_ok. (display_debug_loc, display_debug_addr): Likewise. (display_debug_aranges): Likewise. Remove power of two check on address_size. Calculate and pad to tuple_size.
2026-02-20PR ld/24600: BFD: Add general linker support for fake archivesMaciej W. Rozycki1-0/+1
Add support to BFD for file collections pretending to be archives, with the usual linker symbol resolution semantics as with actual archives. This is an underlying feature to implement `--start-lib'/`--end-lib' group support of the GOLD linker being phased out. It comes in the form of `bfd_openr_fake_archive' function which arranges for a list of input files supplied to be treated as an archive, with `bfd_openr_next_archived_file' then referring to successive elements of the list previously supplied. Use the BFD pointer member of the first file and proxy handle members of `struct bfd' and `struct artdata' respectively to hold references to the members of such an artificial archive once arranged. Such an archive has to be a mapless one necessarily and any use will require a symbol index to be produced on the fly. Add assertions throughout backend code that is supposed not to be ever reached in the handling of such archives and which continues to use the first file and proxy handle members of `struct bfd' and `struct artdata' solely to keep offsets into the owning archive file.
2026-02-20BFD: Add BFD pointer member to archive member referencesMaciej W. Rozycki1-2/+3
In preparation for the next change replace a file offset with a union of one and a BFD pointer in `struct bfd' and `struct artdata' members used to refer to archive members and rename the members accordingly. No functional change at this point.
2026-02-20PR ld/24600: BFD: Add general linker support for mapless archivesMaciej W. Rozycki1-10/+6
Expand linker mapless archive support from XCOFF targets only across the remaining ones, except for VMS targets whose archive format always has a symbol map. For this tranform BFD code used by AR to produce symbol maps to archive files such as to have a handler supplied to either write a map to a file or convert symbol data to an archive symbol definition table attached to an archive BFD as if read from a symbol map, but using pointers to member BFDs rather than file offsets. Retain XCOFF handling code as it is. Where the archive group feature is used a given archive may be opened multiple times in a single link. If this happens then a reference to a symbol the definition of which is provided by said archive will change from undefined on the first access to the archive to defined on later accesses. The symbol table is pulled from an archive only for undefined references, so if a symbol table has been pulled on first access and then dropped by on-the-fly symbol map generation on a subsequent access, then the symbol table is never re-read. Later on when the linker wants to access it to actually resolve symbol references it won't have been reloaded and a crash would happen on a null pointer dereference. To prevent this from happening add code to `_bfd_compute_and_push_armap' to let the caller request the symbol table to be retained and ask for it when building a symbol map on the fly in the linker. The symbol table will likely be used further down the link anyway. Additionally always check the format of the first member of an archive, even if no symbol map is present, and respect the format determined, so that the correct format is used even if it is not the default one the LD has been configured for, preventing segmentation faults from triggering in `cris-aout' LD with the default (`crisaout') emulation or with the `criself' emulation explicitly requested where archive members are in the ELF format and consequntly removing failures with new tests: cris-aout -FAIL: CRIS regular archive w/o index link (explicit emulation) cris-aout -FAIL: CRIS regular archive w/o index link (implicit emulation) cris-aout -FAIL: CRIS thin archive w/o index link (explicit emulation) cris-aout -FAIL: CRIS thin archive w/o index link (implicit emulation) Update documentation and adjust test cases accordingly now that mapless archives are accepted for link by all targets except for VMS ones, which never produce them in the first place.
2026-02-13binutils: fix C23 -Wdiscarded-qualifiers errorsSimon Marchi3-5/+7
When compiling with gcc 15, I get these: CC prdbg.o /home/simark/src/binutils-gdb/binutils/prdbg.c: In function ‘tg_start_function’: /home/simark/src/binutils-gdb/binutils/prdbg.c:2658:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2658 | sep = strchr (name, '('); | ^ cc1: all warnings being treated as errors make[2]: *** [Makefile:1220: prdbg.o] Error 1 CC addr2line.o /home/simark/src/binutils-gdb/binutils/addr2line.c: In function ‘translate_addresses’: /home/simark/src/binutils-gdb/binutils/addr2line.c:390:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 390 | h = strrchr (filename, '/'); | ^ cc1: all warnings being treated as errors make[2]: *** [Makefile:1220: addr2line.o] Error 1 CC nm.o /home/simark/src/binutils-gdb/binutils/nm.c: In function ‘print_symname’: /home/simark/src/binutils-gdb/binutils/nm.c:689:21: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 689 | char *atver = strchr (name, '@'); | ^~~~~~ cc1: all warnings being treated as errors I think they are related to the fact that strchr having changed to return const when passed a const. Change-Id: Idb829916378f0a18e717d1e80414aaa5eba4f7f0
2026-02-11readelf: ubsan unsigned offset overflowAlan Modra1-57/+60
PR 33897 * dwarf.c (display_debug_frames): Don't calculate "look_for" until we have checked that cie_off is valid.
2026-02-11readelf: fix sframe memory leakAlan Modra1-2/+1
Not a significant leak, but there is no need for this strdup. * readelf (parse_args): Don't strdup ".sframe" passed to request_dump_byname.
2026-02-10Update readme for making releases to indicate that for even numbered ↵Nick Clifton1-0/+6
releases there should be both binutils.tar and binutils-with-gold.tar files.
2026-02-09Adding credit to myself for the objdump new feature --map-global-varsGuillaume Vacherias1-2/+3
2026-02-09Mark all Solaris targets. except Solaris 10, as obsolete. Update readme ↵Nick Clifton1-25/+32
file after making the 2.46 release.
2026-02-06objdump: sframe: fix multiple emission of SFrame and DWARF FrameIndu Bhagat4-38/+62
Currently, when a user specifies both -WF (to dump DWARF Frame) and --sframe, the dump_dwarf () call is triggered twice, First, in dump_bfd (): if (dump_dwarf_section_info) dump_dwarf (abfd, is_mainfile); And then again in dump_bfd () via: if (dump_sframe_section_info) dump_sframe_section (abfd, dump_sframe_section_name, is_mainfile); Where dump_sframe_section () itself invokes dump_dwarf () to emit SFrame section. The original intent of making dump_sframe_section () to invoke dump_dwarf () was to reuse the existing (DWARF) machinery for relocation and emission of SFrame section (along with DWARF sections). But this may cause duplicate emission as noted above (PR 33806). So, carve out the necessary work into dump_sframe_section () to make it not invoke dump_dwarf (): explicitly load the SFrame section and then invoke the associated display function directly. This ensures that the SFrame textual dump is emitted exactly once as intended. Additionally, this patch removes: - the temporary "sframe-internal-only" debug option because it not needed anymore, now that we dont use dump_dwarf () for SFrame dumping anymore. - stubs from dump_dwarf_section () specific to SFrame, as it is not called for it anymore. While at it, xstrdup consistently and free the dump_sframe_section_name var. Update the existing sframe-func.s to ensure .eh_frame section is emitted as well. Add new test objdump-sframe-2.d to verify that textual dump using objdump contains single textual dumps of .eh_frame and .sframe (if both --sframe and -WF are specified). PR libsframe/33806 binutils/ PR libsframe/33806 * dwarf.c (debug_option_table): Remove sframe-internal-only. * objdump.c (dump_sframe_section): Call display function directly instead of dump_dwarf. (dump_bfd): Update call to dump_sframe_section. (main): Remove 'sframe-internal-only' hack. binutils/testsuite/ * binutils-all/x86-64/sframe-func.s: Emit .eh_frame section as well. * binutils-all/x86-64/objdump-sframe-2.d: New test.
2026-02-06Updated/new translation files for the 2.46 releaseNick Clifton5-8187/+23927
2026-02-05Objdump: New feature display of global variable info based on DWARF info sectionNick Clifton6-25/+2114
Adds the new option --map-global-vars to objdump. This displays the type and location of global files in binaries that contain suiteable debug information.
2026-02-04objdump -d with -j and objdump disassembly of .pltAlan Modra2-5/+9
objdump -D disassembles non-code sections, paying no heed to symbols in those sections. I think "objdump -d -j .data" should do the same, ie. not switch into dumping the section as data because an object symbol is encountered. On the other hand, dissassembly of .plt which is a code section, can dump the first part of .plt as data due to the presense of _PROCEDURE_LINKAGE_TABLE_. Fix that too. PR 33243 PR 33389 PR 33515 binutils/ * objdump.c (disassemble_section): Ignore symbols in non-code sections. Ignore _PROCEDURE_LINKAGE_TABLE_ too. * testsuite/binutils-all/compress.exp (test_gnu_debuglink): Don't xfail on Solaris/amd64. ld/ * testsuite/ld-aarch64/rela-abs-relative-be.d, * testsuite/ld-aarch64/rela-abs-relative-opt.d, * testsuite/ld-aarch64/rela-abs-relative.d, * testsuite/ld-mips-elf/no-shared-1-n32.d, * testsuite/ld-mips-elf/no-shared-1-n64.d, * testsuite/ld-mips-elf/no-shared-1-o32.d: Update expected output.
2026-01-31readelf vs. mapping symbolsAlan Modra1-20/+7
This reverts commit 45cf0b829303, which isn't needed after commit 6d7e5bcca5. Mapping symbols are like any other local symbol, and shouldn't appear after the end of a section. The real bug that resulted in both of these commits is that st_value in an executable or shared library is the symbol address. It was wrong to compare an address against a section size (you'd need to subtract off the section vma first). The second commit limited the warning to ET_REL where st_value is a section offset and thus can be compared directly to the section size.
2026-01-29Update version now that the 2.46 branch has been createdNick Clifton1-10/+10
2026-01-28PR 33718 objcopy and strip of Solaris binariesH.J. Lu1-1/+32
non-SHF_ALLOC SHT_SUNW_symsort and SHT_SUNW_symnsort sections aren't removed when all symbols are removed. Fix that. PR 33718 PR 33684 * objcopy.c (is_strip_section_1): Handle SHT_SUNW_symsort and SHT_SUNW_symnsort sections.
2026-01-28regen pot filesAlan Modra1-1/+1
2026-01-27Update release readmeNick Clifton1-4/+5
2026-01-26binutils: xfail "gnu-debuglink (objdump 1)" on Solaris/amd64 [PR33243,PR33389]Rainer Orth1-0/+1
As reported in PR binutils/33243, one test FAILs on Solaris/amd64: FAIL: gnu-debuglink (objdump 1) 30c30,32 < 400660: ff 35 b2 15 00 00 ff 25 b4 15 00 00 0f 1f 40 00 .5.....%......@. --- > 400660: ff 35 b2 15 00 00 push 0x15b2(%rip) # 401c18 <_GLOBAL_OFFSET_TABLE_+0x8> > 400666: ff 25 b4 15 00 00 jmp *0x15b4(%rip) # 401c20 <_GLOBAL_OFFSET_TABLE_+0x10> > 40066c: 0f 1f 40 00 nopl 0x0(%rax) This is another instance of PR binutils/33389, so this patch xfail's the test. Tested on {amd64,i386}-pc-solaris2.11 and {x86_64,i686}-pc-linux-gnu. 2026-01-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> binutils: PR binutils/33243 PR binutils/33389 * testsuite/binutils-all/compress.exp (test_gnu_debuglink): xfail on Solaris/amd64.
2026-01-26regen pot filesAlan Modra1-63/+78
2026-01-26PR 33838 Truncated translation in objcopy.cAlan Modra1-2/+2
The only macros allowed are the ones specially handled by gettext, such as PRId64. * objcopy.c (copy_usage): Don't use string literal concatenation of macros in translated strings. Patch from Andreas Schwab <schwab@linux-m68k.org>
2026-01-26PR 33835 readelf incorrect handling of DWARF5 CU DIE addr_base attributeThan McIntosh1-1/+1
Users of "readelf" report problems running the tool's DWARF dump flag on binaries built with the most recent version of the Go compiler (1.25), Go bug report here https://github.com/golang/go/issues/77246 dwarf.c (skip_attribute <DW_FORM_string>): Skip terminating NUL too.
2026-01-26Hard-coded plural in readelf.cAlan Modra1-6/+6
PR 33837 * readelf.c (process_got_section_contents): Use ngettext.
2026-01-25Regenerate autogenerated filesNick Clifton2-2057/+2207
2026-01-25Add 2.46 release markers to NEWS files. Update BRANCHES. Update README.Nick Clifton3-3/+3
2026-01-24windres: quote the angled brackets to avoid confusing shellAlibek Omarov1-1/+1
When invoking windres with a preprocessor parameter that contains angled brackets, the shell will try to interpret them, leading to an error. For example with an empty test.rc file: $ i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc sh: 1: cannot open foo: No such file i686-w64-mingw32-windres: preprocessing failed. After patch it correctly complains about no resources baked in: $ ./i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc ./i686-w64-mingw32-windres: no resources Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
2026-01-24amend supports_oa targetsAlan Modra1-2/+4
Add vxworks and windiss to supported targets. is_elf_target excludes them as a hack to work around multiple other elf test failures. On these targets, fixes FAIL: GNU attributes v1/v2: no support for directive .gnu_attribute
2026-01-23Reword the section of the AI Acceptance Policy that refers to labelling ↵Nick Clifton1-11/+10
submissions.
2026-01-23binutils: testsuite: Fix is_elf_format indentationRainer Orth1-1/+1
One line in is_elf_format isn't indented correctly. Fixed thus. Tested on x86_64-pc-linux-gnu. 2026-01-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> binutils: * testsuite/lib/binutils-common.exp (is_elf_format): Fix indentation.
2026-01-22binutils: Fix broken bullet lists in objcopy documentationThiago C Silva1-13/+20
The documentation for --add-gnu-debuglink and --extract-symbol uses diverse formatting styles for list items, including @table and manual bullets. This looked broken in the generated man pages, showing raw text artifacts like "*<..>" instead of real bullet points. This patch unifies these sections to use @itemize @bullet, resulting in cleaner output and better readability for these options. binutils/ * doc/binutils.texi (objcopy): Use @itemize @bullet for --add-gnu-debuglink and --extract-symbol.