aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2022-08-16PR29362, some binutils memory leaksAlan Modra3-28/+43
2022-08-16 Alan Modra <amodra@gmail.com> Cunlong Li <shenxiaogll@163.com> PR 29362 * dwarf.c (free_debug_information): New function, extracted.. (free_debug_memory): ..from here. (process_debug_info): Use it when before clearing out unit debug_information. Clear all fields. * objcopy.c (delete_symbol_htabs): New function. (main): Call it via xatexit. (copy_archive): Free "dir". * objdump.c (free_debug_section): Free reloc_info.
2022-08-13readelf: print 0x0 as 0, and remove trailing spacesAlan Modra22-292/+292
This changes readelf output a little, removing the 0x prefix on hex output when the value is 0, except in cases where a fixed field width is shown. %#010x is not a good replacement for 0x%08x.
2022-08-13Make dwarf_vma uint64_tAlan Modra8-1302/+931
This replaces dwarf_vma, dwarf_size_type and dwarf_signed_vma with uint64_t and int64_t everywhere. The patch also gets rid of DWARF_VMA_FMT since we can't use that with uint64_t, and all of the configure support for deciding the flavour of HOST_WIDEST_INT. dwarf_vmatoa also disappears, replacing most uses with one of PRIx64, PRId64 or PRIu64. Printing of size_t and ptrdiff_t values now use %z and %t rather than by casting to unsigned long. Also, most warning messages that used 0x%lx or similar now use %#lx and a few that didn't print the 0x hex prefix now also use %#. The patch doesn't change normal readelf output, except in odd cases where values previously might have been truncated.
2022-08-13Don't use bfd_vma in readelf.cAlan Modra1-221/+172
This replaces bfd_vma with uint64_t in readelf, defines BFD64 unconditionally, removes tests of BFD64 and sizeof (bfd_vma), and removes quite a few now unnecessary casts.
2022-08-13Don't use bfd_size_type in readelf.c and dwarf.cAlan Modra2-98/+89
Replacing bfd_size_type with dwarf_size_type or uint64_t is mostly cosmetic. The point of the change is to avoid use of a BFD type in readelf, where we'd like to keep as independent of BFD as possible. Also, the patch is a step towards using standard types.
2022-08-13Replace elf_vma with uint64_tAlan Modra3-110/+93
This patch replaces all uses of elf_vma with uint64_t, removes tests of sizeof (elf_vma), and does a little tidying of byte_get_little_endian and byte_get_big_endian.
2022-08-10objdump: fix extended (256) disassembler colorsAndrew Burgess1-1/+1
After commit: commit a88c79b77036e4778e70d62081c3cfd1044bb8e3 Date: Tue Aug 9 14:57:48 2022 +0100 Default to enabling colored disassembly if output is to a terminal. The 256 extended-color support for --disassembler-color was broken. This is fixed in this commit. PR 29457 * objdump (objdump_styled_sprintf): Check disassembler_color against an enum value, don't treat it as a bool.
2022-08-10bfd: Add support for LoongArch64 EFI (efi-*-loongarch64).Youling Tang3-0/+78
This adds support for efi-loongarch64 by virtue of adding a new PEI target pei-loongarch64. This is not a full target and only exists to support EFI at this time. This means that this target does not support relocation processing and is mostly a container format. This format has been added to elf based loongarch64 targets such that efi images can be made natively on Linux. However this target is not valid for use with gas but only with objcopy. We should't limit addresses to 32-bits for 64-bit vma, otherwise there will be "RVA truncated" error when using objcopy on loongarch64. With these changes the resulting file is recognized as an efi image. Any magic number is based on the Microsoft PE specification [1]. The test results are as follows: $ make check-binutils RUNTESTFLAGS='loongarch64.exp' PASS: Check if efi app format is recognized $ objdump -h -f tmpdir/loongarch64copy.o tmpdir/loongarch64copy.o: file format pei-loongarch64 architecture: Loongarch64, flags 0x00000132: EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED start address 0x0000000000000000 Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000003c 00000000200000b0 00000000200000b0 00000200 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE [1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format bfd: * .gitignore (pe-loongarch64igen.c): New. * Makefile.am (pei-loongarch64.lo, pe-loongarch64igen.lo, pei-loongarch64.c, pe-loongarch64igen.c): Add support. * Makefile.in: Likewise. * bfd.c (bfd_get_sign_extend_vma): Add pei-loongarch64. * coff-loongarch64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags, coff_write_object_contents) Add loongarch64 (loongarch64_pei_vec) support. * config.bfd: Likewise. * configure: Likewise. * configure.ac: Likewise. * libpei.h (GET_OPTHDR_IMAGE_BASE, PUT_OPTHDR_IMAGE_BASE, GET_OPTHDR_SIZE_OF_STACK_RESERVE, PUT_OPTHDR_SIZE_OF_STACK_RESERVE, GET_OPTHDR_SIZE_OF_STACK_COMMIT, PUT_OPTHDR_SIZE_OF_STACK_COMMIT, GET_OPTHDR_SIZE_OF_HEAP_RESERVE, PUT_OPTHDR_SIZE_OF_HEAP_RESERVE, GET_OPTHDR_SIZE_OF_HEAP_COMMIT, PUT_OPTHDR_SIZE_OF_HEAP_COMMIT, GET_PDATA_ENTRY, _bfd_peLoongArch64_bfd_copy_private_bfd_data_common, _bfd_peLoongArch64_bfd_copy_private_section_data, _bfd_peLoongArch64_get_symbol_info, _bfd_peLoongArch64_only_swap_filehdr_out, _bfd_peLoongArch64_print_private_bfd_data_common, _bfd_peLoongArch64i_final_link_postscript, _bfd_peLoongArch64i_only_swap_filehdr_out, _bfd_peLoongArch64i_swap_aouthdr_in, _bfd_peLoongArch64i_swap_aouthdr_out, _bfd_peLoongArch64i_swap_aux_in, _bfd_peLoongArch64i_swap_aux_out, _bfd_peLoongArch64i_swap_lineno_in, _bfd_peLoongArch64i_swap_lineno_out, _bfd_peLoongArch64i_swap_scnhdr_out, _bfd_peLoongArch64i_swap_sym_in, _bfd_peLoongArch64i_swap_sym_out, _bfd_peLoongArch64i_swap_debugdir_in, _bfd_peLoongArch64i_swap_debugdir_out, _bfd_peLoongArch64i_write_codeview_record, _bfd_peLoongArch64i_slurp_codeview_record, _bfd_peLoongArch64_print_ce_compressed_pdata): New. * peXXigen.c (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out, _bfd_XXi_swap_scnhdr_out, pe_print_pdata, _bfd_XX_print_private_bfd_data_common, _bfd_XX_bfd_copy_private_section_data, _bfd_XXi_final_link_postscript): Support COFF_WITH_peLoongArch64, * pei-loongarch64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd, pe_ILF_object_p): Support COFF_WITH_peLoongArch64. (jtab): Add dummy entry that traps. * targets.c (loongarch64_pei_vec): New. binutils * testsuite/binutils-all/loongarch64/loongarch64.exp: New file. * testsuite/binutils-all/loongarch64/pei-loongarch64.d: New test. * testsuite/binutils-all/loongarch64/pei-loongarch64.s: New test. include * coff/loongarch64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_LOONGARCH64): New. Signed-off-by: Youling Tang <tangyouling@loongson.cn>
2022-08-09Default to enabling colored disassembly if output is to a terminal.Nick Clifton5-19/+71
PR 29457 * objdump.c (disassembler_color): Change type to an enum. (disassembler_extended_color): Remove. (usage): Update. (objdump_color_for_assembler_style): Update. (main): Update initialisation of disassembler_color. If not initialised via a command line option, set based upon terminal output. * doc/binutils.texi: Update description of disassmbler-color option. * testsuite/binutils-all/arc/objdump.exp: Add --disassembler-color=off option when disassembling. * testsuite/binutils-all/arm/objdump.exp: Likewise.
2022-08-08Add a link to the NEWS files in the release announcement email.Nick Clifton2-0/+11
2022-08-06objcopy section alignmentAlan Modra1-19/+7
bfd_set_section_alignment currently always returns true. This patch changes it to return false on silly alignment values, avoiding yet another way to trigger ubsan errors like coffcode.h:3192:12: runtime error: shift exponent 299 is too large for 32-bit type 'int'. We'll catch that one in objcopy.c:setup_sections. However, setup_sections gives up on other setup operations that are necessary even after an error of some sort. Change that to keep going, which might change the error message but that shouldn't matter in the least. bfd/ * section.c (bfd_set_section_alignment): Return false and don't set alignment_power for stupidly large alignments. * bfd-in2.h: Regenerate. * coffcode.h (coff_compute_section_file_positions): Don't use an int constant when calculating alignment. binutils/ * objcopy.c (setup_section): Keep on going after hitting non-fatal errors.
2022-08-05Update following 2.39 releaseNick Clifton1-17/+28
2022-08-05Sanity check loc_offsets indexAlan Modra1-10/+20
Fixes a segfault found by the fuzzers. * dwarf.c (fetch_indexed_value): Return -1 on error. (read_and_display_attr_value): Don't display string when fetch_indexed_value returns an error. Sanity check loc_offsets index.
2022-08-05binutils/Dwarf: avoid "shadowing" of glibc function nameJan Beulich1-13/+13
As before: Old enough glibc has an (unguarded) declaration of index() in string.h, which triggers a "shadows a global declaration" warning.
2022-08-04Recognize the new ELF compression type for ZSTD.Cary Coutant1-0/+2
There is more work to be done to actually support compression and decompression using the zstd library, but I will leave that to the champions of the new compression option. binutils/ * binutils/readelf.c (process_section_headers): Add support for ELFCOMPRESS_ZSTD.
2022-08-04Don't use BFD_VMA_FMT in binutilsAlan Modra5-107/+83
BFD_VMA_FMT can't be used in format strings that need to be translated, because the translation won't work when the type of bfd_vma differs from the machine used to compile .pot files. We've known about this for a long time, but patches slip through review. So just get rid of BFD_VMA_FMT, instead using the appropriate PRId64, PRIu64, PRIx64 or PRIo64 and SCN variants for scanf. The patch is mostly mechanical, the only thing requiring any thought is casts needed to preserve PRId64 output from bfd_vma values, or to preserve one of the unsigned output formats from bfd_signed_vma values.
2022-08-01Get rid of fprintf_vma and sprintf_vmaAlan Modra4-83/+52
These two macros print either a 16 digit hex number or an 8 digit hex number. Unfortunately they depend on both target and host, which means that the output for 32-bit targets may be either 8 or 16 hex digits. Replace them in most cases with code that prints a bfd_vma using PRIx64. In some cases, deliberately lose the leading zeros. This change some output, notably in base/offset fields of m68k disassembly which I think looks better that way, and in error messages. I've kept leading zeros in symbol dumps (objdump -t) and in PE header dumps. bfd/ * bfd-in.h (fprintf_vma, sprintf_vma, printf_vma): Delete. * bfd-in2.h: Regenerate. * bfd.c (bfd_sprintf_vma): Don't use sprintf_vma. (bfd_fprintf_vma): Don't use fprintf_vma. * coff-rs6000.c (xcoff_reloc_type_tls): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (xcoff_ppc_relocate_section): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * mmo.c (mmo_write_symbols_and_terminator): Likewise. * srec.c (srec_write_symbols): Likewise. * elf32-xtensa.c (print_r_reloc): Similarly for fprintf_vma. * pei-x86_64.c (pex64_dump_xdata): Likewise. (pex64_bfd_print_pdata_section): Likewise. * som.c (som_print_symbol): Likewise. * ecoff.c (_bfd_ecoff_print_symbol): Use bfd_fprintf_vma. opcodes/ * dis-buf.c (perror_memory, generic_print_address): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. * i386-dis.c (print_operand_value, print_displacement): Likewise. * m68k-dis.c (print_base, print_indexed): Likewise. * ns32k-dis.c (print_insn_arg): Likewise. * ia64-gen.c (_opcode_int64_low, _opcode_int64_high): Delete. (opcode_fprintf_vma): Delete. (print_main_table): Use PRIx64 to print opcode. binutils/ * od-macho.c: Replace all uses of printf_vma with bfd_printf_vma. * objcopy.c (copy_object): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (copy_main): Likewise. * readelf.c (CHECK_ENTSIZE_VALUES): Likewise. (dynamic_section_mips_val): Likewise. (print_vma): Don't use printf_vma. Instead use PRIx64 to print bfd_vma values. (dump_ia64_vms_dynamic_fixups): Likewise. (process_version_sections): Likewise. * rddbg.c (stab_context): Likewise. gas/ * config/tc-i386.c (offset_in_range): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. (md_assemble): Likewise. * config/tc-mips.c (load_register, macro): Likewise. * messages.c (as_internal_value_out_of_range): Likewise. * read.c (emit_expr_with_reloc): Likewise. * config/tc-ia64.c (note_register_values): Don't use fprintf_vma. Instead use PRIx64 to print bfd_vma values. (print_dependency): Likewise. * listing.c (list_symbol_table): Use bfd_sprintf_vma. * symbols.c (print_symbol_value_1): Use %p to print pointers. (print_binary): Likewise. (print_expr_1): Use PRIx64 to print bfd_vma values. * write.c (print_fixup): Use %p to print pointers. Don't use fprintf_vma. * testsuite/gas/all/overflow.l: Update expected output. * testsuite/gas/m68k/mcf-mov3q.d: Likewise. * testsuite/gas/m68k/operands.d: Likewise. * testsuite/gas/s12z/truncated.d: Likewise. ld/ * deffilep.y (def_file_print): Don't use fprintf_vma. Instead use PRIx64 to print bfd_vma values. * emultempl/armelf.em (gld${EMULATION_NAME}_finish): Don't use sprintf_vma. Instead use PRIx64 to print bfd_vma values. * emultempl/pe.em (gld${EMULATION_NAME}_finish): Likewise. * ldlang.c (lang_map): Use %V to print region origin. (lang_one_common): Don't use sprintf_vma. * ldmisc.c (vfinfo): Don't use fprintf_vma or sprintf_vma. * pe-dll.c (pe_dll_generate_def_file): Likewise. gdb/ * remote.c (remote_target::trace_set_readonly_regions): Replace uses of sprintf_vma with bfd_sprintf_vma.
2022-07-26Updated translations for various sub-directoriesNick Clifton3-5895/+6527
2022-07-25opcodes: add new sub-mnemonic disassembler styleAndrew Burgess1-0/+2
When adding libopcodes disassembler styling support for AArch64, it feels like the results would be improved by having a new sub-mnemonic style. This will be used in cases like: add w16, w7, w1, uxtb #2 ^^^^----- Here And: cinc w0, w1, ne ^^----- Here This commit just adds the new style, and prepares objdump to handle the style. A later commit will add AArch64 styling, and will actually make use of the style. As this style is currently unused, there should be no user visible changes after this commit.
2022-07-25bfd: Delete R_LARCH_NONE from dyn info of LoongArch.liuzhensong1-0/+2
Some R_LARCH_64 in section .eh_frame will to generate R_LARCH_NONE, we change relocation to R_LARCH_32_PCREL from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation for R_LARCH_32_PCREL. Add New relocate type R_LARCH_32_PCREL for .eh_frame. include/elf/ loongarch.h bfd/ bfd/bfd-in2.h libbfd.h reloc.c elfxx-loongarch.c elfnn-loongarch.c gas/config/ tc-loongarch.c binutils/ readelf.c ld/testsuite/ld-elf/ eh5.d
2022-07-22PR17122, OSX 10.9 build failureAlan Modra4-26/+3
sbrk hasn't been used in binutils/ or ld/ for quite some time (so the PR was fixed a while ago). Tidy up configury. PR 17122 binutils/ * configure.ac: Don't check for sbrk. * sysdep.h (sbrk): Don't supply fallback declaration. * config.in: Regenerate. * configure: Regenerate. ld/ * configure.ac: Don't check for sbrk. * config.in: Regenerate. * configure: Regenerate.
2022-07-22PR15951, binutils testsuite builds status wrapper unconditionallyAlan Modra1-1/+6
PR 15951 * testsuite/binutils-all/objcopy.exp: Build testglue.o when needs_status_wrapper.
2022-07-21PR29390, DW_CFA_AARCH64_negate_ra_state vs. DW_CFA_GNU_window_saveAlan Modra1-2/+11
PR 29390 binutils/ * dwarf.c (is_aarch64, DW_CFA_GNU_window_save_name): New. (display_debug_frames): Use them. (init_dwarf_regnames_aarch64): Set is_aarch64. (init_dwarf_regnames_by_elf_machine_code): Clear is_aarch64. (init_dwarf_regnames_by_bfd_arch_and_mach): Likewise. gas/ * testsuite/gas/aarch64/pac_ab_key.d: Adjust expected output. * testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
2022-07-21PR29337, readelf CU/TU mixup in .gdb_indexAlan Modra1-2/+2
Commit 244e19c79111 changed a number of variables in display_gdb_index to count entries rather than words. PR 29337 * dwarf.c (display_gdb_index): Correct use of cu_list_elements.
2022-07-21PR29370, infinite loop in display_debug_abbrevAlan Modra1-13/+6
The PR29370 testcase is a fuzzed object file with multiple .trace_abbrev sections. Multiple .trace_abbrev or .debug_abbrev sections are not a violation of the DWARF standard. The DWARF5 standard even gives an example of multiple .debug_abbrev sections contained in groups. Caching and lookup of processed abbrevs thus needs to be done by section and offset rather than base and offset. (Why base anyway?) Or, since section contents are kept, by a pointer into the contents. PR 29370 * dwarf.c (struct abbrev_list): Replace abbrev_base and abbrev_offset with raw field. (find_abbrev_list_by_abbrev_offset): Delete. (find_abbrev_list_by_raw_abbrev): New function. (process_abbrev_set): Set list->raw and list->next. (find_and_process_abbrev_set): Replace abbrev list lookup with new function. Don't set list abbrev_base, abbrev_offset or next.
2022-07-21binutils/dwarf.c: abbrev cachingAlan Modra1-98/+110
I'm inclined to think that abbrev caching is counter-productive. The time taken to search the list of abbrevs converted to internal form is non-zero, and it's easy to decode the raw abbrevs. It's especially silly to cache empty lists of decoded abbrevs (happens with zero padding in .debug_abbrev), or abbrevs as they are displayed when there is no further use of those abbrevs. This patch stops caching in those cases. * dwarf.c (record_abbrev_list_for_cu): Add free_list param. Put abbrevs on abbrev_lists here. (new_abbrev_list): Delete function. (process_abbrev_set): Return newly allocated list. Move abbrev base, offset and size checking to.. (find_and_process_abbrev_set): ..here, new function. Handle lookup of cached abbrevs here, and calculate start and end for process_abbrev_set. Return free_list if newly alloc'd. (process_debug_info): Consolidate cached list lookup, new list alloc and processing into find_and_process_abbrev_set call. Free list when not cached. (display_debug_abbrev): Similarly.
2022-07-21miscellaneous dwarf.c tidiesAlan Modra1-110/+106
* dwarf.c: Leading and trailing whitespace fixes. (free_abbrev_list): New function. (free_all_abbrevs): Use the above. Free cu_abbrev_map here too. (process_abbrev_set): Print actual section name on error. (get_type_abbrev_from_form): Add overflow check. (free_debug_memory): Don't free cu_abbrev_map here.. (process_debug_info): ..or here. Warn on another case of not finding a neeeded abbrev.
2022-07-19[AArch64] Support AArch64 MTE memory tag dumps in core filesLuis Machado1-0/+1
The Linux kernel can dump memory tag segments to a core file, one segment per mapped range. The format and documentation can be found in the Linux kernel tree [1]. The following patch adjusts bfd and binutils so they can handle this new segment type and display it accordingly. It also adds code required so GDB can properly read/dump core file data containing memory tags. Upon reading, each segment that contains memory tags gets mapped to a section named "memtag". These sections will be used by GDB to lookup the tag data. There can be multiple such sections with the same name, and they are not numbered to simplify GDB's handling and lookup. There is another patch for GDB that enables both reading and dumping of memory tag segments. Tested on aarch64-linux Ubuntu 20.04. [1] Documentation/arm64/memory-tagging-extension.rst (Core Dump Support)
2022-07-09Regenerate with automake-1.15.1Alan Modra3-482/+304
Until we update the recommended versions of autoconf/automake, files should be regenerated with automake-1.15.1 and autoconf-2.69. That's not because we think those versions are golden, and newer versions are bad. It's simply because maintainers want to be able to update configury files without trouble, and if someone regenerates files with automake-1.16.5 then --enable-maintainer-mode builds will hit errors: checking that generated files are newer than configure... configure.ac:26: error: version mismatch. This is Automake 1.15.1, configure.ac:26: but the definition used by this AM_INIT_AUTOMAKE configure.ac:26: comes from Automake 1.16.5. You should recreate configure.ac:26: aclocal.m4 with aclocal and run automake again. WARNING: 'automake-1.15' is probably too old. Correcting this requires regenerating the files by hand.
2022-07-08Update release README with new version numbersNick Clifton1-7/+7
2022-07-08Update version to 2.39.50 and regenerate filesNick Clifton5-2278/+2621
2022-07-08Add markers for 2.39 branchNick Clifton4-1/+9
2022-07-06Descriptive DWARF operations dump support for DW_AT_rankBhuvanendra Kumar N1-0/+1
DW_AT_rank is a dwarf-5 feature.
2022-07-05Support for location and range lists for split-dwarf and dwarf-5.Bhuvanendra Kumar N2-9/+34
Adding support for location and range lists for split-dwarf and dwarf-5. Following issues are taken care. 1. Display of the index values for DW_FORM_loclistx and DW_FORM_rnglistx. 2. Display of .debug_loclists.dwo and .debug_rnglists.dwo sections. * dwarf.c(read_and_display_attr_value): Handle DW_FORM_loclistx and DW_FORM_rnglistx for .dwo files. (process_debug_info): Load .debug_loclists.dwo and .debug_rnglists.dwo if exists. (load_separate_debug_files): Load .debug_loclists and .debug_rnglists if exists. Include 2 entries in debug_displays table. * dwarf.h (enum dwarf_section_display_enum): Include 2 entries.
2022-07-04objcopy: bfd_alloc orelocationAlan Modra3-24/+28
This fixes an inconsequential objcopy memory leak. I'd normally ignore reports of leaks like this one, that are merely one block or fewer per section processed, since objcopy soon exits and frees all memory. However I thought it worth providing support for allocating memory on a bfd objalloc in objcopy and other utils. PR 29233 * bucomm.c (bfd_xalloc): New function. * bucomm.h (bfd_xalloc): Declare. * objcopy.c (copy_relocations_in_section): Use it to allocate array of reloc pointers. Rewrite code stripping relocs to do without extra memory allocation.
2022-07-04Modified changes for split-dwarf and dwarf-5.Bhuvanendra Kumar N1-3/+9
* dwarf.c(process_debug_info): Include DW_TAG_skeleton_unit. (display_debug_str_offsets): While dumping .debug_str_offsets.dwo, pass proper str_offsets_base to fetch_indexed_string(). (load_separate_debug_files): Skip DWO ID dump for dwarf-5.
2022-07-01Add newline to the end of the rnglists displsy.Nick Clifton2-0/+5
2022-06-30Fix implementation of readelf's -wE and -wN options,Nick Clifton3-4/+18
* dwarf.c (dwarf_select_sections_by_name): If the entry's value is zero then clear the corresponding variable. (dwarf_select_sections_by_letters): Likewise. * testsuite/binutils-all/debuginfo.exp: Expect -WE and -wE debuginfod tests to fail.
2022-06-28windres: add quotes around preprocessor cmd if neededClément Chigot1-12/+14
This patch ensures that the gcc binary called by windres is quoted if needed. Otherwise, errors can occur if the gcc is under a folder having a name containing a space (eg "Program Files"). binutils/ * resrc.c (DEFAULT_PREPROCESSOR): Split into... (DEFAULT_PREPROCESSOR_CMD): that... (DEFAULT_PREPROCESSOR_ARGS): and that. (look_for_default): Add quotes around the command if needed. (read_rc_file): Adapt to new defines.
2022-06-28Fix the display of the idnex values for DW_FORM_loclistx and ↵Nick Clifton3-127/+183
DW_FORM_rnglistx. Correct the display of .debug.loclists sections. PR 29267 * dwarf.c (display_debug_rnglists): New function, broken out of.. (display_debug_ranges): ... here. (read_and_display_attr_value): Correct calculation of index displayed for DW_FORM_loclistx and DW_FORM_rnglistx. * testsuite/binutils-all/x86-64/pr26808.dump: Update expected output.
2022-06-27Replace a run-time assertion failure with a warning message when parsing ↵Nick Clifton2-1/+12
corrupt DWARF data. PR 29289 * dwarf.c (display_debug_names): Replace assert with a warning message.
2022-06-27Fix NULL pointer indirection when parsing corrupt DWARF data.Nick Clifton2-6/+12
PR 29290 * dwarf.c (read_and_display_attr_value): Check that debug_info_p is set before dereferencing it.
2022-06-27Stop bogus warnings about DWARF indexed string offsets being too big.Nick Clifton3-75/+26
* dwarf.c (fetch_indexed_string): Do not use length of first table in string section as the length of every table in the section. * testsuite/binutils-all/pr26112.r: Update expected output.
2022-06-27drop XC16x bitsJan Beulich1-14/+0
Commit 04f096fb9e25 ("Move the xc16x target to the obsolete list") moved the architecture from the "obsolete but still available" to the "obsolete / support removed" list in config.bfd, making the architecture impossible to enable (except maybe via "enable everything" options"). Note that I didn't touch */po/*.po{,t} on the assumption that these would be updated by some (half)automatic means.
2022-06-27Fix location list offset address dump under DW_AT_location (dwarf-5)Bhuvanendra Kumar N1-12/+26
For clang compiled objects with dwarf-5, location list offset address dump under DW_AT_location is corrected, where DW_FORM_loclistx is used. While dumping the location list offset, the address dumped is wrong where it was refering to .debug_addr instead of .debug_loclists * dwarf.c (fetch_indexed_value): Add base_address as parameter and use it to access the section offset. (read_and_display_attr_value): Handle DW_FORM_loclistx form separately. Pass loclists_base to fetch_indexed_value().
2022-06-22Binutils support for split-dwarf and dwarf-5Kumar N, Bhuvanendra3-15/+56
* dwarf.c (fetch_indexed_string): Added new parameter str_offsets_base to calculate the string offset. (read_and_display_attr_value): Read DW_AT_str_offsets_base attribute. (process_debug_info): While allocating memory and initializing debug_information, do it for do_debug_info also, if its true. (load_separate_debug_files): Load .debug_str_offsets if exists. * dwarf.h (struct debug_info): Add str_offsets_base field.
2022-06-22readelf: replace xmalloc with malloc in slurp_relr_relocsMarcus Nilsson2-1/+6
Using xmalloc makes the null check redundant since failing allocation will exit the program. Instead use malloc and let the error be conveyed up the call chain.
2022-06-22PR29270, DW_FORM_udata signed outputAlan Modra1-1/+5
PR 29270 * dwarf.c (read_and_display_attr_value): Output DW_FORM_udata as unsigned.
2022-06-21Binutils support for dwarf-5 (location and range lists related)Nick Clifton3-13/+51
* dwarf.h (struct debug_info): Add rnglists_base field. * dwarf.c (read_and_display_attr_value): Read attribute DW_AT_rnglists_base. (display_debug_rnglists_list): While handling DW_RLE_base_addressx, DW_RLE_startx_endx, DW_RLE_startx_length items, pass the proper parameter value to fetch_indexed_addr(), i.e. fetch the proper entry in .debug_addr section. (display_debug_ranges): Add rnglists_base to the .debug_rnglists base address. (load_separate_debug_files): Load .debug_addr section, if exists.
2022-06-20PR29262, memory leak in pr_function_typeAlan Modra1-5/+2
PR 29262 * prdbg.c (pr_function_type): Free "s" on failure path.