aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2022-12-18Comment bfd_get_section_limit_octets and bfd_get_section_alloc_sizeAlan Modra4-13/+12
* bfd.c (bfd_get_section_limit_octets): Add comment. (bfd_get_section_alloc_size): Likewise. * libbfd.c (_bfd_generic_get_section_contents): Use bfd_get_section_limit_octets. * section.c (bfd_get_section_contents): Likewise. * bfd-in2.h: Regenerate.
2022-12-18Automatic date update in version.ingdb-13-branchpointGDB Administrator1-1/+1
2022-12-17bfd_get_relocated_section_contents allow NULL data bufferAlan Modra18-51/+143
This patch removes the bfd_malloc in default_indirect_link_order and bfd_simple_get_relocated_section_contents, pushing the allocation down to bfd_get_relocated_section_contents. The idea is to make use of the allocation done with sanity checking in bfd_get_full_section_contents, which is called by bfd_generic_get_relocated_section_contents. Doing this exposed a bug in bfd_get_full_section_contents. With relaxation it is possible that an input section rawsize is different to the section size. In that case we want to use the larger of rawsize (the on-disk size for input sections) and size. * reloc.c (bfd_generic_get_relocated_section_contents), * reloc16.c (bfd_coff_reloc16_get_relocated_section_contents), * coff-alpha.c (alpha_ecoff_get_relocated_section_contents), * coff-sh.c (sh_coff_get_relocated_section_contents), * elf-m10200.c (mn10200_elf_get_relocated_section_contents), * elf-m10300.c (mn10300_elf_get_relocated_section_contents), * elf32-avr.c (elf32_avr_get_relocated_section_contents), * elf32-cr16.c (elf32_cr16_get_relocated_section_contents), * elf32-crx.c (elf32_crx_get_relocated_section_contents), * elf32-h8300.c (elf32_h8_get_relocated_section_contents), * elf32-nds32.c (nds32_elf_get_relocated_section_contents), * elf32-sh.c (sh_elf_get_relocated_section_contents), * elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents): Handle NULL data buffer. * bfd.c (bfd_get_section_alloc_size): New function. * bfd-in2.h: Regenerate. * compress.c (bfd_get_full_section_contents): Correct section malloc size. * linker.c (default_indirect_link_order): Don't malloc memory here before calling bfd_get_relocated_section_contents. * simple.c (bfd_simple_get_relocated_section_contents): Likewise.
2022-12-17asan: elf.c:12621:18: applying zero offset to null pointerAlan Modra1-1/+1
That's this line in elf_parse_notes: while (p < buf + size) * elf.c (_bfd_elf_make_section_from_shdr): Don't call elf_parse_notes when sh_size is zero.
2022-12-17Re: The problem with warning in elf_object_pAlan Modra9-75/+279
Commit 5aa0f10c424e added a per_xvec_warn array to provide support for warnings from elf_object_p (and a later patch for warnings from pe_bfd_object_p) to be cached and then only printed if the target matches. It was quite limited in the style of message supported, only one message could be printed, and didn't really meet the stated aim of only warning when a target matches: There are many other errors and warnings that can be emitted by functions called from elf_object_p. So this patch extends the error handler functions to support printing to a string buffer, extends per_xvec_warn to support multiple errors/ warnings, and hooks this all into bfd_check_format_matches. If bfd_check_format_matches succeeds then any errors/warnings are printed for the matching target. If bfd_check_format_matches fails either due to no match or to multiple matches and only one target vector produced errors, then those errors are printed. * bfd.c (MAX_ARGS): Define, use throughout. (print_func): New typedef. (_bfd_doprnt): Add new print param. Replace calls to fprintf with print. (PRINT_TYPE): Similarly. (error_handler_fprintf): Renamed from error_handler_internal. Use _bfd_get_error_program_name. Add fprintf arg. Move code setting up args.. (_bfd_doprnt_scan): ..to here. Add ap param. (struct buf_stream): New. (err_sprintf): New function. (error_handler_bfd): New static variable. (error_handler_sprintf): New function. (_bfd_set_error_handler_caching): New function. (_bfd_get_error_program_name): New function. * elfcode.h (elf_swap_shdr_in): Use _bfd_error_handler in warning messages. (elf_object_p): Likewise. * format.c (print_warnmsg): New function. (clear_warnmsg): Rewrite. (null_error_handler): New function. (bfd_check_format_matches): Ignore warnings from recursive calls checking first element of an archive. Use caching error handler otherwise. Print warnings on successful match, or when only one target has emitted warnings/errors. * peicode.h (pe_bfd_object_p): Use _bfd_error_handler in warning messages. * targets.c (per_xvec_warn): Change type of array elements. (struct per_xvec_message): New. (_bfd_per_xvec_warn): Rewrite. * Makefile.am (LIBBFD_H_FILES): Add bfd.c. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
2022-12-17Automatic date update in version.inGDB Administrator1-1/+1
2022-12-16Automatic date update in version.inGDB Administrator1-1/+1
2022-12-15libsframe asan: avoid generating misaligned loadsIndu Bhagat1-12/+12
There are two places where unaligned loads were seen on aarch64: - #1. access to the SFrame FRE stack offsets in the in-memory representation/abstraction provided by libsframe. - #2. access to the SFrame FRE start address in the on-disk representation of the frame row entry. For #1, we can fix this by reordering the struct members of sframe_frame_row_entry in libsframe/sframe-api.h. For #2, we need to default to using memcpy instead, and copy out the bytes to a location for output. SFrame format is an unaligned on-disk format. As such, there are other blobs of memory in the on-disk SFrame FRE that are on not on their natural boundaries. But that does not pose further problems yet, because the users are provided access to the on-disk SFrame FRE data via libsframe's sframe_frame_row_entry, the latter has its' struct members aligned on their respective natural boundaries (and initialized using memcpy). PR 29856 libsframe asan: load misaligned at sframe.c:516 ChangeLog: PR libsframe/29856 * bfd/elf64-x86-64.c: Adjust as the struct members have been reordered. * libsframe/sframe.c (sframe_decode_fre_start_address): Use memcpy to perform 16-bit/32-bit reads. * libsframe/testsuite/libsframe.encode/encode-1.c: Adjust as the struct members have been reordered. include/ChangeLog: PR libsframe/29856 * sframe-api.h: Reorder fre_offsets for natural alignment.
2022-12-15Automatic date update in version.inGDB Administrator1-1/+1
2022-12-14asan: buffer overflow in sh_relocAlan Modra1-1/+2
* coff-sh.c (sh_reloc): Use bfd_reloc_offset_in_range.
2022-12-14ld, gold: remove support for -z bndplt (MPX prefix)Martin Liska4-38/+5
bfd/ChangeLog: * elf-linker-x86.h (struct elf_linker_x86_params): Remove bndplt. * elf64-x86-64.c (elf_x86_64_scan_relocs): Ignore R_X86_64_PLT32_BND. (elf_x86_64_relocate_section): Similarly here. (elf_x86_64_link_setup_gnu_properties): Ignore bndplt. * elfxx-x86.c: Likewise. * elfxx-x86.h: Likewise. gold/ChangeLog: * NEWS: Document -z bndplt. * options.h (class General_options): Remove bndplt option. * x86_64.cc (class Output_data_plt_x86_64_bnd): Remove. (Target_x86_64::do_make_data_plt): Do not use Output_data_plt_x86_64_bnd. (Target_x86_64::Scan::get_reference_flags): Likewise. (Target_x86_64::Scan::check_non_pic): Likewise. (Target_x86_64::Scan::local): Likewise. (Target_x86_64::Scan::global): Likewise. ld/ChangeLog: * NEWS: Document -z bndplt. * emulparams/elf_x86_64.sh: Remove bndplt option. * ld.texi: Likewise. * testsuite/ld-x86-64/x86-64.exp: * testsuite/ld-x86-64/bnd-branch-1-now.d: Removed. * testsuite/ld-x86-64/bnd-branch-1.d: Removed. * testsuite/ld-x86-64/bnd-branch-1.s: Removed. * testsuite/ld-x86-64/bnd-ifunc-1-now.d: Removed. * testsuite/ld-x86-64/bnd-ifunc-1.d: Removed. * testsuite/ld-x86-64/bnd-ifunc-1.s: Removed. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Removed. * testsuite/ld-x86-64/bnd-ifunc-2.d: Removed. * testsuite/ld-x86-64/bnd-ifunc-2.s: Removed. * testsuite/ld-x86-64/bnd-plt-1-now.d: Removed. * testsuite/ld-x86-64/bnd-plt-1.d: Removed. * testsuite/ld-x86-64/mpx.exp: Removed. * testsuite/ld-x86-64/mpx1.out: Removed. * testsuite/ld-x86-64/mpx1a.c: Removed. * testsuite/ld-x86-64/mpx1a.rd: Removed. * testsuite/ld-x86-64/mpx1b.c: Removed. * testsuite/ld-x86-64/mpx1c.c: Removed. * testsuite/ld-x86-64/mpx1c.rd: Removed. * testsuite/ld-x86-64/mpx2.out: Removed. * testsuite/ld-x86-64/mpx2a.c: Removed. * testsuite/ld-x86-64/mpx2a.rd: Removed. * testsuite/ld-x86-64/mpx2b.c: Removed. * testsuite/ld-x86-64/mpx2c.c: Removed. * testsuite/ld-x86-64/mpx2c.rd: Removed. * testsuite/ld-x86-64/mpx3.dd: Removed. * testsuite/ld-x86-64/mpx3a.s: Removed. * testsuite/ld-x86-64/mpx3b.s: Removed. * testsuite/ld-x86-64/mpx3n.dd: Removed. * testsuite/ld-x86-64/mpx4.dd: Removed. * testsuite/ld-x86-64/mpx4a.s: Removed. * testsuite/ld-x86-64/mpx4b.s: Removed. * testsuite/ld-x86-64/mpx4n.dd: Removed. * testsuite/ld-x86-64/pr20800a.S: Removed. * testsuite/ld-x86-64/pr20800b.S: Removed. * testsuite/ld-x86-64/pr21038a-now.d: Removed. * testsuite/ld-x86-64/pr21038a.d: Removed. * testsuite/ld-x86-64/pr21038a.s: Removed. * testsuite/ld-x86-64/pr21038b-now.d: Removed. * testsuite/ld-x86-64/pr21038b.d: Removed. * testsuite/ld-x86-64/pr21038b.s: Removed. * testsuite/ld-x86-64/pr21038c-now.d: Removed. * testsuite/ld-x86-64/pr21038c.d: Removed. * testsuite/ld-x86-64/pr21038c.s: Removed.
2022-12-14Automatic date update in version.inGDB Administrator1-1/+1
2022-12-13asan: mips_hi16_list segfault in bfd_get_section_limit_octetsAlan Modra5-24/+50
static variables like mips_hi16_list are nasty for applications using bfd. It is possible when opening and closing bfds with mis-matched hi/lo relocs to leave a stale section pointer on the list. That can cause a segfault if multiple bfds are being processed. Tidying the list when closing is sufficient to stop this happening (and fixes small memory leaks). This patch goes further and moves mips_hi16_list to where it belongs in the bfd tdata. * elf32-mips.c (bfd_elf32_close_and_cleanup(: Define. * elf64-mips.c (bfd_elf64_close_and_cleanup): Define. * elfn32-mips.c (bfd_elf32_close_and_cleanup(: Define. * elfxx-mips.c (struct mips_hi16): Move earlier. (mips_hi16_list): Move to.. (struct mips_elf_obj_tdata): ..here. (_bfd_mips_elf_close_and_cleanup): New function. (_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_lo16_reloc), (_bfd_elf_mips_get_relocated_section_contents): Adjust uses of mips_hi16_list. * elfxx-mips.h (_bfd_mips_elf_close_and_cleanup): Declare.
2022-12-13Automatic date update in version.inGDB Administrator1-1/+1
2022-12-12PR29892, Field file_table of struct module is uninitializedAlan Modra1-3/+6
PR 29892 * vms-alphs.c (new_module): Use bfd_zmalloc to alloc file_table. (parse_module): Rewrite file_table reallocation code and clear.
2022-12-12Lack of bounds checking in vms-alpha.c parse_moduleAlan Modra1-45/+168
PR 29873 PR 29874 PR 29875 PR 29876 PR 29877 PR 29878 PR 29879 PR 29880 PR 29881 PR 29882 PR 29883 PR 29884 PR 29885 PR 29886 PR 29887 PR 29888 PR 29889 PR 29890 PR 29891 * vms-alpha.c (parse_module): Make length param bfd_size_type. Delete length == -1 checks. Sanity check record_length. Sanity check DST__K_MODBEG, DST__K_RTNBEG, DST__K_RTNEND lengths. Sanity check DST__K_SOURCE and DST__K_LINE_NUM elements before accessing. (build_module_list): Pass dst_section size to parse_module.
2022-12-12Automatic date update in version.inGDB Administrator1-1/+1
2022-12-11Automatic date update in version.inGDB Administrator1-1/+1
2022-12-10Automatic date update in version.inGDB Administrator1-1/+1
2022-12-09libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_infoIndu Bhagat1-3/+3
The new name better reflects the purpose of the function. ChangeLog: * bfd/elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Use new name. * libsframe/sframe.c (sframe_fde_create_func_info): Rename sframe_fde_func_info to this. * libsframe/testsuite/libsframe.encode/encode-1.c: Use new name. include/ChangeLog: * sframe-api.h (sframe_fde_create_func_info): Rename sframe_fde_func_info to this.
2022-12-09PR28306, segfault in _bfd_mips_elf_reloc_unshuffleAlan Modra5-22/+96
Access to section data during relocation processing should be bounds checked, as it is in bfd_perform_relocation. bfd_perform_relocation does these checks after any special_function is called. So a reloc special_function needs to do its own bounds checking before accessing section data. This patch adds many such checks to the mips backend. Checking mips relocs is not without some difficulty. See the comment in _bfd_mips_reloc_offset_in_range. In a multitple reloc sequence applied to the same location, relocs that may appear somewhere other than the last one of the sequence need to be treated specially since they apply to the addend for the next relocation rather than the section contents. If the addend is in the section then it needs to be checked but not when the addend is in the reloc. check_inplace handles this situation. _bfd_mips_reloc_offset_in_range with check_shuffle handles the case where contents are shuffled before applying the relocation. PR 28306 * elf32-mips.c (_bfd_mips_elf32_gprel16_reloc): Check reloc address using _bfd_mips_reloc_offset_in_range. (gprel32_with_gp, mips16_gprel_reloc): Likewise. * elf64-mips.c (mips_elf64_gprel32_reloc): Likewise. (mips16_gprel_reloc): Likewise. * elfn32-mips.c (mips16_gprel_reloc): Likewise. (gprel32_with_gp): Check reloc address using bfd_reloc_offset_in_range. * elfxx-mips.h (enum reloc_check): Define. (_bfd_mips_reloc_offset_in_range): Declare. * elfxx-mips.c (needs_shuffle): New function. (_bfd_mips_elf_reloc_unshuffle, _bfd_mips_elf_reloc_shuffle): Use it. (_bfd_mips_reloc_offset_in_range): New function. (_bfd_mips_elf_gprel16_with_gp): Move reloc address checks to partial_inplace handling. Use bfd_reloc_offset_in_range. (_bfd_mips_elf_lo16_reloc): Check reloc address using bfd_reloc_offset_in_range. (_bfd_mips_elf_generic_reloc): Check reloc address using _bfd_mips_reloc_offset_in_range. (mips_elf_calculate_relocation): Check reloc address before calling mips_elf_nullify_got_load. (_bfd_mips_elf_check_relocs): Likewise. (mips_elf_read_rel_addend): Add sec param, check reloc address before reading. Adjust callers. (mips_elf_add_lo16_rel_addend): Add sec param, adjust callers.
2022-12-09Automatic date update in version.inGDB Administrator1-1/+1
2022-12-08x86-64: Remove BND from 64-bit IBT PLTH.J. Lu1-11/+33
Since MPX support has been removed from x86-64 psABI, remove BND from 64-bit IBT PLT by using x32 IBT PLT. bfd/ PR ld/29851 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Also check x32 IBT PLT for 64-bit. (elf_x86_64_link_setup_gnu_properties): Always use x32 IBT PLT. ld/ PR ld/29851 * testsuite/ld-x86-64/ibt-plt-1.d: Updated. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Moved to ... * testsuite/ld-x86-64/plt-main-ibt.dd: This. * testsuite/ld-x86-64/x86-64.exp: Don't use plt-main-ibt-x32.dd.
2022-12-08Automatic date update in version.inGDB Administrator1-1/+1
2022-12-07coff make_a_section_from_file tidyAlan Modra1-53/+41
Also support compressing a few more sections. * coffgen.c (make_a_section_from_file): Rename return_section to newsect. Don't try to be clever matching section name. Compress .gnu.debuglto_.debug_ and .gnu.linkonce.wi. too. Only rename debug sections when decompressing for linker.
2022-12-07_bfd_elf_slurp_secondary_reloc_section sanity checkAlan Modra1-3/+14
* elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check section header against file size. Avoid overflow in reloc_count.
2022-12-07bfd_compress_section_contents access to elf_section_dataAlan Modra1-1/+2
* compress.c (bfd_compress_section_contents): Don't access elf_section_data for non-ELF.
2022-12-07Compression tidy and fixesAlan Modra5-89/+92
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-07Automatic date update in version.inGDB Administrator1-1/+1
2022-12-06bfd: Avoid signed overflow for new_size adjustmentH.J. Lu1-1/+1
When bfd_size_type is unsigned 64-bit integer and sizeof is unsigned 32-bit integer, subtraction in *new_size += sizeof (Elf32_External_Chdr) - sizeof (Elf64_External_Chdr); will overflow. Use *new_size -= sizeof (Elf64_External_Chdr) - sizeof (Elf32_External_Chdr); to avoid overflow. PR binutils/29860 * compress.c (bfd_convert_section_setup): Avoid signed overflow for new_size adjustment.
2022-12-06Fix a dereference of NULL when scanning the symbol hashes array in the ARM ↵Nick Clifton2-0/+12
linker. PR 29852 * elf32-arm.c (cmse_scan): Check for NULL entries in the sym_hashes array. (elf32_arm_gc_mark_extra_sections): Likewise.
2022-12-06Get rid of SEC_ELF_COMPRESSAlan Modra5-91/+61
This flag also isn't needed, except for some sanity checks which we can omit. * elf.c (elf_fake_sections): Don't set SEC_ELF_COMPRESS for compressed debug sections, just leave sh_name as -1. (assign_file_positions_for_non_load_sections), (assign_file_positions_except_relocs): Decide whether a section needs compressing and thus should not have its file offset set by looking at sh_name. (_bfd_elf_assign_file_positions_for_non_load): Similarly decide which sections need compressing. * elflink.c (bfd_elf_final_link): Don't test SEC_ELF_COMPRESS. * merge.c (_bfd_write_merged_section): Likewise. * section.c (SEC_ELF_COMPRESS): Don't define. (SEC_ELF_PURECODE): Renumber. * bfd-in2.h: Regenerate.
2022-12-06Get rid of SEC_ELF_RENAMEAlan Modra4-100/+78
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 Modra4-384/+376
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-06LoongArch: Fix dynamic reloc not generated bug in some cases.mengqinggang1-1/+1
bfd/ChangeLog: * elfnn-loongarch.c (loongarch_elf_relocate_section): Likewise.
2022-12-06PR29855, ch_type in bfd_init_section_decompress_status can be uninitializedAlan Modra1-0/+1
PR 29855 * compress.c (bfd_init_section_decompress_status): Set ch_type to zero for zlib-gnu case.
2022-12-06Automatic date update in version.inGDB Administrator1-1/+1
2022-12-05Fix an illegal memory access when parsing a corrupt VMS Alpha file.Nick Clifton2-1/+7
PR 29848 * vms-alpha.c (parse_module): Fix potential out of bounds memory access.
2022-12-05Re: Renaming .debug to .zdebug and vice versaAlan Modra2-4/+4
* compress.c (bfd_debug_name_to_zdebug): Fix C++ compile error. (bfd_zdebug_name_to_debug): Likewise. * bfd-in2.h: Regenerate.
2022-12-05Automatic date update in version.inGDB Administrator1-1/+1
2022-12-04COFF compressed debug supportAlan Modra1-8/+8
Since commit 4bea06d73c04 COFF support for compressed debug sections has been broken due to the "flags" variable not getting SEC_HAS_CONTENTS. * coffgen.c (make_a_section_from_file): Correct section flags handling. Delete extraneous condition. Update error messages to be the same as in elf.c.
2022-12-04Renaming .debug to .zdebug and vice versaAlan Modra4-47/+64
Move a couple of elf.c functions to compress.c. * compress.c (bfd_debug_name_to_zdebug): New inline function. (bfd_zdebug_name_to_debug): Likewise. * elf.c (convert_debug_to_zdebug, convert_zdebug_to_debug): Delete. (_bfd_elf_make_section_from_shdr, elf_fake_sections), (_bfd_elf_assign_file_positions_for_non_load): Adjust to suit. * coffgen.c (make_a_section_from_file): Use new inlines here.
2022-12-04Automatic date update in version.inGDB Administrator1-1/+1
2022-12-03Automatic date update in version.inGDB Administrator1-1/+1
2022-12-02Automatic date update in version.inGDB Administrator1-1/+1
2022-12-01Fix verilog output when the width is > 1.Nick Clifton2-4/+27
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-12-01Automatic date update in version.inGDB Administrator1-1/+1
2022-11-30regen SRC-POTFILES.inAlan Modra1-0/+1
2022-11-30Automatic date update in version.inGDB Administrator1-1/+1
2022-11-28xtensa: allow dynamic configurationMax Filippov7-18/+170
Import include/xtensa-dynconfig.h that defines XCHAL_* macros as fields of a structure returned from the xtensa_get_config_v<x> function call. Define that structure and fill it with default parameter values specified in the include/xtensa-config.h. Define reusable function xtensa_load_config that tries to load configuration and return an address of an exported object from it. Define functions xtensa_get_config_v{1,2} that use xtensa_load_config to get structures xtensa_config_v{1,2}, either dynamically configured or the default. bfd/ * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append xtensa-dynconfig.c. * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add xtensa-dynconfig.lo to the tb. * elf32-xtensa.c (xtensa-config.h): Replace #include with xtensa-dynconfig.h. (XSHAL_ABI, XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove definitions. * xtensa-dynconfig.c: New file. * xtensa-isa.c (xtensa-dynconfig.h): New #include. (xtensa_get_modules): New function. (xtensa_isa_init): Call xtensa_get_modules instead of taking address of global xtensa_modules. gas/ * config/tc-xtensa.c (xtensa-config.h): Replace #include with xtensa-dynconfig.h. (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0, XTENSA_MARCH_EARLIEST): Remove definitions. * config/tc-xtensa.h (xtensa-config.h): Replace #include with xtensa-dynconfig.h. * config/xtensa-relax.c (xtensa-config.h): Replace #include with xtensa-dynconfig.h. (XCHAL_HAVE_WIDE_BRANCHES): Remove definition. include/ * xtensa-dynconfig.h: New file. ld/ * emultempl/xtensaelf.em (xtensa-config.h): Replace #include with xtensa-dynconfig.h. (XTHAL_ABI_WINDOWED, XTHAL_ABI_CALL0): Remove definitions.