aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16Update release making howtoNick Clifton1-1/+1
2023-01-16Updated translations for the gas and binutils sub-directoriesNick Clifton2-2476/+3147
2023-01-14Update how-to-make-a-release file now that the 2.40 release is outNick Clifton1-44/+65
2023-01-12Remove myself as hppa32 maintainerAlan Modra1-1/+0
Reflects the reality that I haven't done much on hppa32 for years.
2023-01-10Add aarch64-w64-mingw32 targetMark Harmstone4-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.
2023-01-09Updated transaltions for the gprof and binutils sub-directoriesNick Clifton3-5943/+7150
2023-01-08PR29972, inconsistent format specification in singular formAlan Modra1-1/+1
PR 29972 * readelf.c (process_dynamic_section): Correct format string.
2023-01-06Make coff backend data read-onlyAlan Modra1-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.
2023-01-05Remove Stephen Casner as the PDP11 maintainer.Nick Clifton2-1/+4
2023-01-04MAINTAINERS: add myself as maintainer of libsframeIndu Bhagat1-0/+1
binutils/ * MAINTAINERS: Add myself as maintainer of libsframe.
2023-01-04objcopy fuzzed pe out of memoryAlan Modra1-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.
2023-01-04fuzzed file timeoutAlan Modra1-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.
2023-01-03Updated translations for various languages and sub-directoriesNick Clifton3-5053/+5338
2023-01-03Add new NT_ARM_ZA and NT_ARM_SSVE register set constants.Luis Machado2-0/+9
2023-01-02obsolete target tidyAlan Modra5-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.
2023-01-01Update year range in copyright notice of binutils filesAlan Modra148-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.
2022-12-31Update version numbers in howto-make-a-release documentNick Clifton1-5/+22
2022-12-31Update version number and regenerate filesNick Clifton3-2257/+2396
2022-12-31Add markers for 2.40 branchNick Clifton4-3/+9
2022-12-31Updated Romanian translation for the binutils sub-directoryNick Clifton3-826/+1032
2022-12-30PR29948, heap-buffer-overflow in display_debug_lines_decodedAlan Modra1-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.
2022-12-21Fix an attempt to allocate an unreasonably large amount of memory when ↵Nick Clifton2-1/+9
parsing a corrupt ELF file. PR 29924 * objdump.c (load_specific_debug_section): Check for excessively large sections.
2022-12-19Avoid compiler warning in dwarf-do-refreshTom Tromey2-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.
2022-12-19Tidy PR29893 and PR29908 fixAlan Modra1-20/+4
PR 29893 PR 29908 * dwarf.c (display_debug_addr): Combine dwarf5 unit_length checks. Delete dead code.
2022-12-19Fix potential illegal memory accesses when parsing corrupt DWARF data.Nick Clifton2-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.
2022-12-16Fix previous delta to allow for compilation on 32-bit systemsNick Clifton5-3/+60
2022-12-16Fix a potential illegal memory access when parsing corrupt DWARF information.Nick Clifton2-1/+25
PR 29908 * dwarf.c (display_debug_addr): Check for corrupt header lengths.
2022-12-14asan: signed integer overflow in display_debug_framesAlan Modra1-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.
2022-12-14Don't access freed memory printing objcopy warningAlan Modra1-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.
2022-12-13PR29893, buffer overflow in display_debug_addrAlan Modra1-2/+7
PR 29893 * dwarf.c (display_debug_addr): Sanity check dwarf5 unit_length field. Don't read past end.
2022-12-12PR29872, uninitialised value in display_debug_lines_decoded dwarf.c:5413Alan Modra1-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.
2022-12-11PR29870, objdump SEGV in display_debug_lines_decoded dwarf.c:5524Alan Modra1-2/+2
DWARF5 directory and file table allow more opportunity for fuzzers to break things. There are likely other places in dwarf.c that should be fixed too. PR 29870 * dwarf.c (display_debug_lines_decoded): Handle NULL file_table name entry.
2022-12-09objdump: sframe: fix memory leaksIndu Bhagat1-1/+7
ChangeLog: * binutils/objdump.c (dump_section_sframe): free up contents and SFrame decoder context on exit.
2022-12-07Compression tidy and fixesAlan Modra1-6/+8
Tidies: - Move stuff from bfd-in.h and libbfd.c to compress.c - Delete COMPRESS_DEBUG from enum compressed_debug_section_type - Move compress_debug field out of link_info to ld_config. Fixes: - Correct test in bfd_convert_section_setup to use obfd flags, not ibfd. - Apply bfd_applicable_file_flags to compression bfd flags added by gas and ld to the output bfd. bfd/ * bfd-in.h (enum compressed_debug_section_type), (struct compressed_type_tuple), (bfd_get_compression_algorithm), (bfd_get_compression_algorithm_name), * libbfd.c (compressed_debug_section_names), (bfd_get_compression_algorithm), (bfd_get_compression_algorithm_name): Move.. * compress.c: ..to here, deleting COMPRESS_DEBUG from enum compressed_debug_section_type. (bfd_convert_section_setup): Test obfd flags not ibfd for compression flags. * elf.c (elf_fake_sections): Replace link_info->compress_debug test with abfd->flags test. * bfd-in2.h: Regenerate. binutils/ * objcopy.c (copy_file): Tidy setting of bfd compress flags. Expand comment. gas/ * write.c (compress_debug): Test bfd compress flags rather than flag_compress_debug. (write_object_file): Apply bfd_applicable_file_flags to compress debug flags added to output bfd. include/ * bfdlink.h (struct bfd_link_info): Delete compress_debug. ld/ * ld.h (ld_config_type): Add compress_debug. * emultempl/elf.em: Replace references to link_info.compress_debug with config.compress_debug. * lexsup.c (elf_static_list_options): Likewise. * ldmain.c (main): Likewise. Apply bfd_applicable_file_flags to compress debug flags added to output bfd.
2022-12-06Get rid of SEC_ELF_RENAMEAlan Modra1-2/+7
SEC_ELF_RENAME is a flag used to effect section name changes when compressing/decompressing zlib-gnu debug sections. This can be accomplished more directly in one of the objcopy specific bfd functions. Renaming for ld input is simplified too. Ld input object files always have BFD_DECOMPRESS set. bfd/ * compress.c (bfd_convert_section_size): Rename to.. (bfd_convert_section_setup): ..this. Handle objcopy renaming of compressed/decompressed debug sections. * elf.c (_bfd_elf_make_section_from_shdr): Only rename zdebug input for linker. (elf_fake_sections): Don't handle renaming of debug sections for objcopy here. * section.c (SEC_ELF_RENAME): Delete. * bfd-in2.h: Regenerate. binutils/ * objcopy.c (setup_section): Call bfd_convert_section_setup. Don't call bfd_convert_section_size.
2022-12-06Compression header enumAlan Modra1-8/+8
Define an enum instead of using ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD in bfd and binutils, and move some functions from bfd.c to compress.c. When looking at the COFF/PE debug compression support, I wondered about extending it to support zstd. I likely won't do that, but the compression header ch_type field isn't just ELF specific if these headers are to be used in COFF/PE too. bfd/ * bfd.c (bfd_update_compression_header), (bfd_check_compression_header, bfd_get_compression_header_size), (bfd_convert_section_size, bfd_convert_section_contents): Move to.. * compress.c: ..here. (enum compression_type): New. Use it throughout file. * elf.c (_bfd_elf_make_section_from_shdr): Replace uses of ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with ch_compress_zlib and ch_compress_zstd. * bfd-in2.h: Regenerate. binutils/ * readelf.c (process_section_headers, dump_section_as_strings), (dump_section_as_bytes, load_specific_debug_section): Replace uses of ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD with ch_compress_zlib and ch_compress_zstd.
2022-12-05testsuite: support mold linkerMartin Liska2-6/+4
Mold linker demotes symbols like main to be local and the patch adjusts expected output from nm. Moreover, simplify the regex patterns.
2022-12-05Arm: .noinit and .persistent are not supported for Linux targetsJan Beulich1-2/+2
Respective tests being run means guaranteed failures.
2022-12-05opcodes/mips: use .word/.short for undefined instructionsAndrew Burgess10-34/+34
While working on disassembler styling for MIPS, I noticed that undefined instructions are printed by the disassembler as raw number with no assembler directive prefix (e.g. without .word or .short). I think adding something like .word, or .short, helps to make it clearer the size of the value that is being displayed, and is inline with what many of the other libopcode disassemblers do. In this commit I've added the .word and .short directives, and updated all the tests that I spotted that failed as a result.
2022-12-04PR29846, segmentation fault in objdump.c compare_symbolsAlan Modra1-13/+10
Fixes a fuzzed object file problem where plt relocs were manipulated in such a way that two synthetic symbols were generated at the same plt location. Won't occur in real object files. PR 29846 PR 20337 * objdump.c (compare_symbols): Test symbol flags to exclude section and synthetic symbols before attempting to check flavour.
2022-12-02Add Jan Beulich as an x86_64 maintainer.Nick Clifton1-0/+1
2022-12-01binutils: improve holes detection in .debug_loclists.Clément Chigot1-14/+33
The previous warnings about holes in .debug_loclists sections don't take into account the headers of each CU and could include the locviews if they precede the loclist. The following warning can be triggered between two CU. ... <previous CU views> ... 0000001d <End of list> 0000002a v000000000000000 v000000000000000 location view pair 0000002c v000000000000000 v000000000000000 location view pair readelf: Warning: There is a hole [0x1e - 0x2e] in .debug_loclists section. 0000002e v000000000000000 v000000000000000 views at 0000002a for: ... But [0x1e - 0x2a] corresponds to the CU header and [0x2a - 0x2e] are the locviews. Thus there is no hole here. binutils/ChangeLog: * dwarf.c (display_debug_loc): Adjust holes detections for headers and locviews.
2022-12-01Fix verilog output when the width is > 1.Nick Clifton4-4/+75
PR 25202 bfd * bfd.c (VerilogDataEndianness): New variable. (verilog_write_record): Use VerilogDataEndianness, if set, to choose the endianness of the output. (verilog_write_section): Adjust the address by the data width. binutils* objcopy.c (copy_object): Set VerilogDataEndianness to the endianness of the input file. (copy_main): Verifiy the value set by the --verilog-data-width option. * testsuite/binutils-all/objcopy.exp: Add tests of the new behaviour. * testsuite/binutils-all/verilog-I4.hex: New file.
2022-11-28PR10368, ISO 8859 mentioned as 7bit encoding in strings documentationAlan Modra1-1/+1
PR 10368 * doc/binutils.texi (strings): Delete example of 7-bit encoding.
2022-11-25Revert "readelf: Do not require EI_OSABI for IFUNC."Martin Liska1-3/+5
This reverts commit ffbbab0b3a1000f862b6d4ce3d9a76ed14f08801.
2022-11-24readelf: Do not require EI_OSABI for IFUNC.Martin Liska1-5/+3
PR 29718 binutils/ChangeLog: * readelf.c (get_symbol_type): Consider STT_GNU_IFUNC as reserved name.
2022-11-24Tidy objdump printing of section sizeAlan Modra1-2/+2
* objdump.c (load_specific_debug_section): Use PRIx64 format.
2022-11-24Constify nm format arrayAlan Modra1-2/+2
* nm.c (formats, format): Make const.
2022-11-23PR22509 - Null pointer dereference on coff_slurp_reloc_tableAlan Modra1-1/+1
This extends the commit 4581a1c7d304 fix to more targets, which hardens BFD a little. I think the real underlying problem was the bfd_canonicalize_reloc call in load_specific_debug_section which passed a NULL for "symbols". Fix that too. PR 22509 bfd/ * aoutx.h (swap_ext_reloc_out): Gracefully handle NULL symbols. * i386lynx.c (swap_ext_reloc_out): Likewise. * pdp11.c (pdp11_aout_swap_reloc_out): Likewise. * coff-tic30.c (reloc_processing): Likewise. * coff-tic4x.c (tic4x_reloc_processing): Likewise. * coff-tic54x.c (tic54x_reloc_processing): Likewise. * coff-z80.c (reloc_processing): Likewise. * coff-z8k.c (reloc_processing): Likewise. * ecoff.c (ecoff_slurp_reloc_table): Likewise. * som.c (som_set_reloc_info): Likewise. binutils/ * objdump.c (load_specific_debug_section): Pass syms to bfd_canonicalize_reloc.
2022-11-23Don't use "long" in readelf for file offsetsAlan Modra5-499/+532
The aim here is to improve readelf handling of large 64-bit object files on LLP64 hosts (Windows) where long is only 32 bits. The patch changes more than just file offsets. Addresses and sizes are also changed to avoid "long". Most places get to use uint64_t even where size_t may be more appropriate, because that allows some overflow checks to be implemented easily (*alloc changes). * dwarf.c (cmalloc, xcmalloc, xcrealloc, xcalloc2): Make nmemb parameter uint64_t. * dwarf.h: Update prototypes. (struct dwarf_section): Make num_relocs uint64_t. * elfcomm.c (setup_archive): Update error format. * elfcomm.h (struct archive_info): Make sym_size, longnames_size, nested_member_origin, next_arhdr_offset uint64_t. * readelf.c (struct filedata): Make archive_file_offset, archive_file_size, string_table_length, dynamic_addr, dynamic_nent, dynamic_strings_length, num_dynamic_syms, dynamic_syminfo_offset uint64_t. (many functions): Replace uses of "unsigned long" with "uint64_t" or "size_t".