summaryrefslogtreecommitdiff
path: root/binutils
Commit message (Collapse)AuthorAgeFilesLines
...
* ld test asciz and ascii failsAlan Modra2023-02-171-0/+15
| | | | | | | | | | | | | | | | | | | Fix these fails: alpha-dec-vms +FAIL: ld-scripts/asciz alpha-dec-vms +FAIL: ld-scripts/ascii i386-go32 +FAIL: ld-scripts/asciz sh-coff +FAIL: ld-scripts/asciz It's better to positively select targets for .section support than to try to exclude all targets that don't. Make a new is_coff_format so we can easily select such. binutils/ * testsuite/lib/binutils-common.exp (is_coff_format): New. ld/ * testsuite/ld-scripts/ascii.d: Use is_elf_format and is_coff_format to select targets, exclude ti coff. * testsuite/ld-scripts/asciz.d: Likewise. Accept trailing zeros.
* Delete PROGRESS macrosAlan Modra2023-02-164-33/+1
| | | | | | | | | | | | | | | | | | | | | I don't see much point in cluttering the source with the PROGRESS macros, which of course do nothing at all with the definitions in progress.h. progress.h is unchanged apart from the copyright comment since commit d4d4c53c68f0 in 1994. binutils/ * ar.c: Don't include progress.h, or invoke PROGRESS macros. * nm.c: Likewise. * objcopy.c: Likewise. * objdump.c: Likewise. gas/ * as.h: Don't include progress.h. * as.c: Don't invoke PROGRESS macros. * write.c: Likewise. include/ * progress.h: Delete. ld/ * ldmain.c: Don't include progress.h, or invoke PROGRESS macros.
* objdump read_section_stabsAlan Modra2023-02-151-63/+33
| | | | | | | | | | | | | | | This function is used to read sections other than stabs, and there is now another version of it that extracts different info from the bfd section. Rename it and return the bfd section instead of assorted fields of the bfd section. * objcopy.c (read_section): Renamed from read_section_stabs. Delete size_ptr and entsize_ptr params, add contents param. Return asection pointer. Don't unnecessarily free contents on failure from bfd_malloc_and_get_section. (find_stabs_section): Use read_section. (dump_ctf, dump_section_sframe): Likewise. (read_section_sframe): Delete.
* objdump -G memory leakAlan Modra2023-02-151-1/+4
| | | | * objdump.c (find_stabs_section): Free stabs.
* binutils stabs type listAlan Modra2023-02-151-21/+15
| | | | | | | | | | | | | | Fuzzers have found that specifying a large stab type number results in lots of memory being requested, as the list is extended with a 16 element array at a time until we reach the given stab type. It also takes a long time. Of course normal sane stab types use small positive integers, but it's not hard to modify the code to handle type numbers starting anyhere. * stabs.c (struct stab_types): Add base_index. (stab_find_slot): Simplify filenum check. Delete type number check. Don't allocate entire array from 0 to type number, allocate a sparse array.
* opcodes/mips: disassemble unknown micromips instructions as two shortsAndrew Burgess2023-02-135-0/+33
| | | | | | | | | | | | | | | | | | | | Before commit: commit 2438b771ee07be19d5b01ea55e077dd8b7cef445 Date: Wed Nov 2 15:53:43 2022 +0000 opcodes/mips: use .word/.short for undefined instructions unknown 32-bit microMIPS instructions were disassembled as a raw 32-bit number with no '.word' directive. The above commit changed this and added a '.word' directive before the 32-bit number. It was pointed out on the mailing list, that for microMIPS it would be better to display such 32-bit instructions using a '.short' directive followed by two 16-bit values. This commit updates the mips disassembler to do this, and adds a new test that validates this output.
* objcopy memory leaksAlan Modra2023-02-131-2/+1
| | | | | | | | | | | | | This fixes some objcopy memory leaks. commit 450da4bd38ae used xatexit to tidy most of the hash table memory, but of course that's ineffective without a call to xexit. The other major memory leak happens if there is an error of some sort writing the output file, due to not closing the input file and thus not freeing memory attached to the bfd. * objcopy.c (copy_file): Don't return when bfd_close of output gives an error, always bfd_close input too. (main): Call xexit.
* objdump -D of bss sections and -s with -jAlan Modra2023-02-112-17/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is some inconsistency between the behaviour of objdump -D and objdump -s, both supposedly operating on all sections by default. objdump -s ignores bss sections, while objdump -D dissassembles the zeros. Fix this by making objdump -D ignore bss sections too. Furthermore, "objdump -s -j .bss" doesn't dump .bss as it should, since the user is specifically asking to look at all those zeros. This change does find some tests that used objdump -D with expected output in bss-style sections. I've updated all the msp430 tests that just wanted to find a non-empty section to look at section headers instead, making the tests slightly more stringent. The ppc xcoff and spu tests are fixed by adding -j options to objdump, which makes the tests somewhat more lenient. binutils/ * objdump.c (disassemble_section): Ignore sections without contents, unless overridden by -j. (dump_section): Allow -j to override the default of not displaying sections without contents. * doc/binutils.texi (objdump options): Update -D, -s and -j description. gas/ * testsuite/gas/ppc/xcoff-tls-32.d: Select wanted objdump sections with -j. * testsuite/gas/ppc/xcoff-tls-64.d: Likewise. ld/ * testsuite/ld-msp430-elf/main-bss-lower.d, * testsuite/ld-msp430-elf/main-bss-upper.d, * testsuite/ld-msp430-elf/main-const-lower.d, * testsuite/ld-msp430-elf/main-const-upper.d, * testsuite/ld-msp430-elf/main-text-lower.d, * testsuite/ld-msp430-elf/main-text-upper.d, * testsuite/ld-msp430-elf/main-var-lower.d, * testsuite/ld-msp430-elf/main-var-upper.d: Expect -wh output. * testsuite/ld-msp430-elf/msp430-elf.exp: Use objdump -wh rather than objdump -D or objdump -d with tests checking for non-empty given sections. * testsuite/ld-spu/ear.d, * testsuite/ld-spu/icache1.d, * testsuite/ld-spu/ovl.d, * testsuite/ld-spu/ovl2.d: Select wanted objdump sections.
* Add full display feature to dwarf-mode.elTom Tromey2023-02-092-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've found that I often use dwarf-mode with relatively small test files. In this situation, it's handy to be able to expand all the DWARF, rather than moving to each "..." separately and using C-u C-m. This patch implements this feature. It also makes a couple of other minor changes: * I removed a stale FIXME from dwarf-mode. In practice I find I often use "g" to restore the buffer to a pristine state; checking the file mtime would work against this. * I tightened the regexp in dwarf-insert-substructure. This prevents the C-m binding from trying to re-read a DIE which has already been expanded. * Finally, I've bumped the dwarf-mode version number so that this version can easily be installed using package.el. 2023-02-09 Tom Tromey <tromey@adacore.com> * dwarf-mode.el: Bump version to 1.8. (dwarf-insert-substructure): Tighten regexp. (dwarf-refresh-all): New defun. (dwarf-mode-map): Bind "A" to dwarf-refresh-all. (dwarf-mode): Remove old FIXME.
* Clear cached file size when bfd changed to BFD_IN_MEMORYAlan Modra2023-02-091-38/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If file size is calculated by bfd_get_file_size, as it is by _bfd_alloc_and_read calls in coff_object_p, then it is cached and when pe_ILF_build_a_bfd converts an archive entry over to BFD_IN_MEMORY, the file size is no longer valid. Found when attempting objdump -t on a very small (27 bytes) ILF file and hitting the pr24707 fix (commit 781152ec18f5). So, clear file size when setting BFD_IN_MEMORY on bfds that may have been read. (It's not necessary in writable bfds, because caching is ignored by bfd_get_size when bfd_write_p.) I also think the PR 24707 fix is no longer neeeded. All of the testcases in that PR and in PR24712 are caught earlier by file size checks when reading the symbols from file. So I'm reverting that fix, which just compared the size of an array of symbol pointers against file size. That's only valid if on-disk symbols are larger than a host pointer, so the test is better done in format-specific code. bfd/ * coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Clear cached file size when making a BFD_IN_MEMORY bfd. * opncls.c (bfd_make_readable): Likewise. * peicode.h (pe_ILF_build_a_bfd): Likewise. binutils/ PR 24707 * objdump.c (slurp_symtab): Revert PR24707 fix. Tidy. (slurp_dynamic_symtab): Tidy.
* Fix documentation of the 'n' symbol type displayed by nm.Nick Clifton2023-02-072-1/+7
| | | | PR 30080 * doc/binutils.texi (nm): Update description of the 'n' symbol type.
* RISC-V: don't disassemble unrecognized insns as .byteJan Beulich2023-02-031-3/+3
| | | | | | | Insn width granularity being 16 bits, producing byte granular output isn't very useful. With there being a way to specific otherwise unknown insns to the assembler, use that same representation (to be precise: its <length>,<encoding> flavor) for disassembly.
* Updated Swedish translation for the binutils sub-directoryNick Clifton2023-01-312-762/+314
|
* PR 30060, ASAN error in bfd_cache_closeAlan Modra2023-01-312-8/+3
| | | | | | | | | | | After bfd_close nothing should access bfd memory. Now that bfd_close always tidies up even after an error, attempting to tidy the cached bfd list by calling bfd_cache_close is wrong and not needed. PR 30060 * ar.c (remove_output): Don't call bfd_cache_close. (output_bfd): Delete. * arsup.c (ar_end): Call bfd_close_all_done, not bfd_cache_close.
* testsuite XPASSesAlan Modra2023-01-311-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adjusts the testsuite to get rid of a number of XPASSes that have appeared. Someone might like to look into a better patch for the s390 change. aarch64-pe XPASS: weak symbols arm-nacl XPASS: rgn-over8 mcore-pe XPASS: ld-scripts/provide-8 mips64-linux-gnuabi64 XPASS: vers4 mips64-linux-gnuabi64 XPASS: vers4b mips-linux-gnu XPASS: vers4 mips-linux-gnu XPASS: vers4b s390-linux-gnu XPASS: undefined line sh4-linux-gnu XPASS: --gc-sections with __start_SECTIONNAME sh-coff XPASS: objcopy object (simple copy) sh-coff XPASS: objcopy executable (pr25662) binutils/ * testsuite/binutils-all/objcopy.exp: Don't xfail "simple copy" and "pr25662" on sh-*-coff. Remove all non-ELF xfails on "ELF unknown section type" test. ld/ * testsuite/ld-elfvers/vers.exp (vers4, vers4b): Don't xfail all mips, just xfail mips irix. * testsuite/ld-gc/pr19161.d: Don't xfail sh. * testsuite/ld-scripts/rgn-over8-ok.d: Don't xfail nacl. * testsuite/ld-scripts/weak.exp: Don't xfail aarch64-pe. * testsuite/ld-undefined/undefined.exp: Conditionally xfail "undefined line" depending on gcc version for s390.
* Updated Swedish translation for the binutils sub-directoryNick Clifton2023-01-232-393/+257
|
* Fix objdump --reloc for specific symbolVladislav Khmelevsky2023-01-231-0/+7
| | | | | | If objdump is used with both --disassemble=symbol and --reloc options skip relocations that have addresses before the symbol, so that they are not displayed.
* Upload SFrame spec files as wellIndu Bhagat2023-01-201-1/+5
| | | | | | binutils/ * README-how-to-make-a-release: Include sframe-spec html and pdf files.
* Speed up objcopy's note merging.Nick Clifton2023-01-182-7/+23
| | | | | PR 29993 * objcopy.c (merge_gnu_build_notes): Remember the last non-deleted note in order to speed up the scan for matching notes.
* Update release making howtoNick Clifton2023-01-161-1/+1
|
* Updated translations for the gas and binutils sub-directoriesNick Clifton2023-01-162-2476/+3147
|
* Update how-to-make-a-release file now that the 2.40 release is outNick Clifton2023-01-141-44/+65
|
* Remove myself as hppa32 maintainerAlan Modra2023-01-121-1/+0
| | | | Reflects the reality that I haven't done much on hppa32 for years.
* Add aarch64-w64-mingw32 targetMark Harmstone2023-01-104-4/+76
| | | | | | | This adds a mingw target for aarch64, including windres and dlltool. Note that the old value of jmp_aarch64_bytes was wrong, and this does the same thing as MSVC does.
* Updated transaltions for the gprof and binutils sub-directoriesNick Clifton2023-01-093-5943/+7150
|
* PR29972, inconsistent format specification in singular formAlan Modra2023-01-081-1/+1
| | | | | PR 29972 * readelf.c (process_dynamic_section): Correct format string.
* Make coff backend data read-onlyAlan Modra2023-01-061-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bfd_coff_backend_data struct should be read-only, the only thing preventing this is that objcopy writes to one of the fields, _bfd_coff_long_section_names. This patch creates a copy of the field in bfd coff_obj_tdata, which makes more sense anyway. When enabling long section names the intent is to do so for a particular bfd, not for all bfds that might happen to be using the target xvec. bfd/ * coffcode.h: Update coff long section name comment. (bfd_coff_set_long_section_names_allowed): Use macro accessor to set flag. (bfd_coff_set_long_section_names_disallowed): Tidy. (coff_backend_info): Return a const pointer. (bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table), (bigobj_swap_table): Make const. (bfd_coff_long_section_names): Use tdata copy. (coff_mkobject): Set long_section_names from coff_backend_info. * coff-go32.c (_bfd_go32_mkobject): Likewise. * peicode.h (pe_mkobject): Likewise. * coff-sh.c (bfd_coff_small_swap_table): Make const. * libcoff-in.h (struct coff_tdata): Add long_section_names, reorder fields. * libcoff.h: Regenerate. binutils/ * objcopy.c (set_long_section_mode): Move earlier in file. (copy_object): Call set_long_section_mode here, after setting output format. (copy_file): Don't call set_long_section_mode.
* Remove Stephen Casner as the PDP11 maintainer.Nick Clifton2023-01-052-1/+4
|
* MAINTAINERS: add myself as maintainer of libsframeIndu Bhagat2023-01-041-0/+1
| | | | | binutils/ * MAINTAINERS: Add myself as maintainer of libsframe.
* objcopy fuzzed pe out of memoryAlan Modra2023-01-041-0/+4
| | | | | | | | | This occurs when attempting to read back a section from the output file in _bfd_XX_bfd_copy_private_bfd_data_common. The copy of the section failed size sanity checking, thus it won't be written. * objcopy.c (copy_object): Return false if copy_section or copy_relocations_in_section fails.
* fuzzed file timeoutAlan Modra2023-01-041-1/+2
| | | | | | | | | | | objcopy of archive, element containing an object with a fuzzed section size far exceeding the element size. copy_section detects this, but the temp file is laid out for the large section. It can take a long time to write terabytes of sparse file, a waste of time when it will be deleted. * objcopy.c (copy_archive): Don't write element contents after bad status result from copy_object.
* Updated translations for various languages and sub-directoriesNick Clifton2023-01-033-5053/+5338
|
* Add new NT_ARM_ZA and NT_ARM_SSVE register set constants.Luis Machado2023-01-032-0/+9
|
* obsolete target tidyAlan Modra2023-01-025-36/+6
| | | | | | | Delete a few files only used for obsolete targets, and tidy config, xfails and other pieces of support specific to those targets. And since I was editing target triplets in test files, fix the nm alpha-linuxecoff fails.
* Update year range in copyright notice of binutils filesAlan Modra2023-01-01148-257/+259
| | | | | | The newer update-copyright.py fixes file encoding too, removing cr/lf on binutils/bfdtest2.c and ld/testsuite/ld-cygwin/exe-export.exp, and embedded cr in binutils/testsuite/binutils-all/ar.exp string match.
* Update version numbers in howto-make-a-release documentNick Clifton2022-12-311-5/+22
|
* Update version number and regenerate filesNick Clifton2022-12-313-2257/+2396
|
* Add markers for 2.40 branchNick Clifton2022-12-314-3/+9
|
* Updated Romanian translation for the binutils sub-directoryNick Clifton2022-12-313-826/+1032
|
* PR29948, heap-buffer-overflow in display_debug_lines_decodedAlan Modra2022-12-301-52/+64
| | | | | | | | | | | | | | | | | | | This fixes a couple of places in display_debug_lines_decoded that were off by one in checking DWARF5 .debug_line directory indices. It also displays the DWARF5 entry 0 for the program current directory rather than "." as is done for pre-DWARF5. I decided against displaying DW_AT_comp_dir for pre-DWARF5 since I figure it is better for readelf to minimally interpret debug info. binutils/ PR 29948 * dwarf.c (display_debug_lines_decoded): Display the given directory entry 0 for DWARF5. Properly check directory index against number of entries in the table. Revert to using unsigned int for n_directories and associated variables. Correct warning messages. gas/ * testsuite/gas/elf/dwarf-5-loc0.d: Update.
* Fix an attempt to allocate an unreasonably large amount of memory when ↵Nick Clifton2022-12-212-1/+9
| | | | | | | | parsing a corrupt ELF file. PR 29924 * objdump.c (load_specific_debug_section): Check for excessively large sections.
* Avoid compiler warning in dwarf-do-refreshTom Tromey2022-12-192-1/+5
| | | | | | | | | | | | | The Emacs 28 compiler warns about dwarf-mode.el: Warning (comp): dwarf-mode.el:180:32: Warning: Unused lexical argument `ignore' This is easily fixed by prepending "_" to the parameter's name. binutils/ChangeLog 2022-12-19 Tom Tromey <tromey@adacore.com> * dwarf-mode.el (dwarf-do-refresh): Avoid compiler warning.
* Tidy PR29893 and PR29908 fixAlan Modra2022-12-191-20/+4
| | | | | | | PR 29893 PR 29908 * dwarf.c (display_debug_addr): Combine dwarf5 unit_length checks. Delete dead code.
* Fix potential illegal memory accesses when parsing corrupt DWARF data.Nick Clifton2022-12-192-0/+22
| | | | | | | | PR 29914 * dwarf.c (fetch_indexed_value): Fail if the section is not big enough to contain a header size field. (display_debug_addr): Fail if the computed address size is too big or too small.
* Fix previous delta to allow for compilation on 32-bit systemsNick Clifton2022-12-165-3/+60
|
* Fix a potential illegal memory access when parsing corrupt DWARF information.Nick Clifton2022-12-162-1/+25
| | | | | PR 29908 * dwarf.c (display_debug_addr): Check for corrupt header lengths.
* asan: signed integer overflow in display_debug_framesAlan Modra2022-12-141-108/+116
| | | | | | | | | | * dwarf.c (struct Frame_Chunk): Make col_offset an int64_t. Adjust all places allocating col_offset and col_type to use the size of the array element rather than the size of a type. (frame_display_row): Adjust printing of col_offset. (display_debug_frames): Factor out multiplication by code_factor and data_factor. Avoid signed overflow. Use 64-bit variables.
* Don't access freed memory printing objcopy warningAlan Modra2022-12-141-3/+5
| | | | | | | | abfd->filename will be freed if bfd_close gets far enough to delete the bfd. It's possible to have an error from fclose at this point. * objcopy.c (copy_archive): Dup filename before closing bfd for potential use in bfd_nonfatal_message.
* PR29893, buffer overflow in display_debug_addrAlan Modra2022-12-131-2/+7
| | | | | | PR 29893 * dwarf.c (display_debug_addr): Sanity check dwarf5 unit_length field. Don't read past end.
* PR29872, uninitialised value in display_debug_lines_decoded dwarf.c:5413Alan Modra2022-12-121-27/+38
| | | | | | | | | | | Plus segvs if the C-library doesn't handle printf %s of NULL. PR 29872 * dwarf.c (null_name): New function. (process_debug_info): Use it here.. (display_debug_lines_raw): ..and here.. (display_debug_lines_decoded): ..and here. xcalloc directory_table. Simplify xcalloc of file_table.