aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2024-06-17PR31898 bug in processing DW_RLE_startx_endxAlan Modra1-4/+4
PR 31898 * dwarf.c (display_debug_rnglists_list): Correct fetch of "end" indexed address. Remove excess parens. (cherry picked from commit 1b19566b18a1208f84b89029785a1e93a6544514)
2024-05-16aarch64: Remove asserts from operand qualifier decodersNick Clifton2-0/+4
PR31595
2024-02-13PowerPC: Add support for Power11 optionsPeter Bergner1-5/+6
binutils/ * doc/binutils.texi (PowerPC -M option): Mention power11 and pwr11. gas/ * config/tc-ppc.c: (md_show_usage): Mention -mpower11 and -mpwr11. * doc/c-ppc.texi: Likewise. opcodes/ * ppc-dis.c (ppc_opts): Add "power11" and "pwr11" entries. (powerpc_init_dialect): Default to "power11". (cherry picked from commit 4199cf1e152daab0460f08cc7dbd1f727ac3e4cc)
2024-02-08PR 31283 windmc: Parse input correctly on big endian hostsRichard W.M. Jones4-4/+259
On big endian hosts (eg. s390x) the windmc tool fails to parse even trivial files: $ cat test.mc ; $ ./binutils/windmc ./test.mc In test.mc at line 1: parser: syntax error. In test.mc at line 1: fatal: syntax error. The tool starts by reading the input as Windows CP1252 and then converting it internally into an array of UTF-16LE, which it then processes as an array of unsigned short (typedef unichar). There are lots of ways this is wrong, but in the specific case of big endian machines the little endian pairs of bytes are byte-swapped. For example, the ';' character in the input above is first converted to UTF16-LE byte sequence { 0x3b, 0x00 }, which is then cast to unsigned short. On a big endian machine the first unichar appears to be 0x3b00. The lexer is unable to recognize this as the comment character ((unichar)';') and so parsing fails. The simple fix is to convert the input to UTF-16BE on big endian machines (and do the reverse conversion when writing the output). Fixes: https://sourceware.org/bugzilla/show_bug.cgi?id=31283 Signed-off-by: Richard W.M. Jones <rjones@redhat.com> (cherry picked from commit 3f8f9745c75b333515f399fc2908ede2ed8014e9)
2024-01-29Set version number to 2.42.0 and re-enable developmentNick Clifton2-12/+12
2024-01-29Update version number to 2.42binutils-2_42Nick Clifton1-10/+10
2024-01-18Updated translations for various sub-directoriesNick Clifton4-8930/+9265
2024-01-15Update version number and regenerate configure filesNick Clifton3-761/+808
2024-01-15Add markers for 2.42 branchNick Clifton4-2/+9
2024-01-15Update branch/release creation documentationNick Clifton1-5/+5
2024-01-15nm: Replace --with-symbol-versions with --without-symbol-versions in --help ↵Nick Clifton1-1/+1
output PR 31243 nm: Fix --help output
2024-01-08MAINTAINERS: Update my email addressJoseph Myers1-1/+1
2024-01-04Update year range in copyright notice of binutils filesAlan Modra150-152/+152
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-12-30MAINTAINERS: Update my email addressJoseph Myers1-1/+1
There will be another update in January.
2023-12-28x86: Add NT_X86_SHSTK noteSchimpe, Christina1-0/+2
Define NT_X86_SHSTK which is the note for x86 Shadow Stack (SHSTK) to support Intel SHSTK in Linux kernel. For now only userspace shadow stack and kernel IBT are supported by the linux kernel. This note should be used instead of NT_X86_CET introduced in the commit "x86: Add NT_X86_CET note", as it is outdated and only used by old binutils versions.
2023-12-27PR31191, objcopy leaves temporary filesAlan Modra1-23/+24
Fix the ENOTDIR rmdir too. PR 31191 * objcopy.c (copy_archive): Localise uses of "l". Remove const from name_list.name. Unlink output element on bfd_close error, and NULL list->name to indicate file is removed. Adjust cleanup to prevent rmdir on non-existent file.
2023-12-25binutils: SECURITY: use https URIMike Frysinger1-2/+2
2023-12-20s390: Optionally print instruction description in disassemblyJens Remus1-0/+5
Print instruction description as comment in disassembly with s390 architecture specific option "insndesc": - For objdump it can be enabled with option "-M insndesc" - In gdb it can be enabled with "set disassembler-options insndesc" Since comments are not column aligned the output can enhanced for readability by postprocessing using a filter such as "expand": ... | expand -t 8,16,24,32,40,80 Or when using in combination with objdump option --visualize-jumps: ... | expand | sed -e 's/ *#/\t#/' | expand -t 1,80 Note that the instruction descriptions add about 128 KB to s390-opc.o: s390-opc.o without instruction descriptions: 216368 bytes s390-opc.o with instruction descriptions : 348432 bytes binutils/ * NEWS: Mention new s390-specific disassembler option "insndesc". include/ * opcode/s390.h (struct s390_opcode): Add field to hold instruction description. opcodes/ * s390-mkopc.c: Copy instruction description from s390-opc.txt into generated operation code table s390-opc.tab. * s390-opc.c (s390_opformats): Provide NULL as description in .insn pseudo-mnemonics opcode table. * s390-dis.c: Add s390-specific disassembler option "insndesc" and optionally print the instruction description as comment in the disassembly when it is specified. gas/ * testsuite/gas/s390/s390.exp: Add new test disassembly test case "zarch-insndesc". * testsuite/gas/s390/zarch-insndesc.s: New test case for s390- specific disassembler option "insndesc". * testsuite/gas/s390/zarch-insndesc.d: Likewise. Signed-off-by: Jens Remus <jremus@linux.ibm.com> Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
2023-12-15Re: readelf..debug-dump=loc displays bogus base addressesAlan Modra1-16/+10
Commit b05efa39b479 removed checks I added in commit f22f27f46c75 to prevent segfaults when debug_info_p is NULL, which can be the case with fuzzed objects. Restore those checks. Also, for dwo look at rnglists_dwo rather than rnglists.
2023-12-06PR31096, nm shows 32bit addresses as 64bit addressesAlan Modra1-35/+44
Prior to commit 0e3c1eebb2 nm output depended on the host unsigned long when printing "negative" symbol values for 32-bit targets. Commit 0e3c1eebb22 made the output match that seen with a 64-bit host unsigned long. The fact that nm output changed depending on host is of course a bug, but it is reasonable to expect 32-bit target output is only 32 bits. So this patch makes 32-bit target output the same as it was on 32-bit hosts prior to 0e3c1eebb2. PR 31096 * nm.c (print_format_string): Make it a static buffer. (get_print_format): Merge into.. (set_print_format): ..this, renamed from set_print_width. When print_width is 32, set up print_format_string for an int32_t value. Don't malloc print_format_string. Adjust calls. (print_value): Correct printing of 32-bit values.
2023-12-05Add basic support for RISC-V 64-bit EFI objectsAndreas Schwab2-0/+47
This adds a new PEI target pei-riscv64-little. Only objdump and objcopy are supported. bfd: * .gitignore: Add pe-riscv64igen.c. * Makefile.am (BFD64_BACKENDS): Add pei-riscv64.lo, pe-riscv64igen.lo. (BFD64_BACKENDS_CFILES): Add pei-riscv64.c. (BUILD_CFILES): Add pe-riscv64igen.c. (pe-riscv64igen.c): New rule. * Makefile.in: Regenerate. * bfd.c (bfd_get_sign_extend_vma): Add pei-riscv64-little. * coff-riscv64.c: New file. * coffcode.h (coff_set_arch_mach_hook, coff_set_flags) (coff_write_object_contents): Add riscv64 (riscv64_pei_vec) support. * config.bfd (targ_selvecs): Add riscv64_pei_vec to all riscv* targets. * configure.ac: Handle riscv64_pei_vec. * configure: Regenerate. * 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_XX_bfd_copy_private_bfd_data_common) (_bfd_XX_bfd_copy_private_section_data) (_bfd_XX_get_symbol_info, _bfd_XX_only_swap_filehdr_out) (_bfd_XX_print_private_bfd_data_common) (_bfd_XXi_final_link_postscript, _bfd_XXi_only_swap_filehdr_out) (_bfd_XXi_swap_aouthdr_in, _bfd_XXi_swap_aouthdr_out) (_bfd_XXi_swap_aux_in, _bfd_XXi_swap_aux_out) (_bfd_XXi_swap_lineno_in, _bfd_XXi_swap_lineno_out) (_bfd_XXi_swap_scnhdr_out, _bfd_XXi_swap_sym_in) (_bfd_XXi_swap_sym_out, _bfd_XXi_swap_debugdir_in) (_bfd_XXi_swap_debugdir_out, _bfd_XXi_write_codeview_record) (_bfd_XXi_slurp_codeview_record) [COFF_WITH_peRiscV64]: Define. (_bfd_peRiscV64_print_ce_compressed_pdata): Declare. * 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_peRiscV64. * pei-riscv64.c: New file. * peicode.h (coff_swap_scnhdr_in, pe_ILF_build_a_bfd) (pe_ILF_object_p): Support COFF_WITH_peRiscV64. (jtab): Add dummy entry that traps. * targets.c (_bfd_target_vector): Add riscv64_pei_vec. binutils: * testsuite/binutils-all/riscv/pei-riscv64.d: New. * testsuite/binutils-all/riscv/pei-riscv64.s: New. include: * coff/riscv64.h: New file. * coff/pe.h (IMAGE_FILE_MACHINE_RISCV32) (IMAGE_FILE_MACHINE_RISCV64): Define.
2023-12-05memory leak in display_debug_addrAlan Modra1-6/+7
* dwarf.c (display_debug_addr): Free dummy debug_addr_info entry. Don't return without freeing debug_addr_info on error paths.
2023-12-05Handle "efi-app-riscv64" and similar targets in objcopy.Peter Jones1-0/+5
This adds the efi target name handling for riscv64 to objcopy. binutils: * binutils/objcopy.c: add riscv64 handling to convert_efi_target() Signed-off-by: Peter Jones <pjones@redhat.com> Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-12-04Fix two buglets in .debug_names dumpingTom Tromey2-3/+13
While working on gdb's .debug_names writer, I found a couple of small bugs in binutils .debug_names dumping. First, the DWARF spec (section 6.1.1.4.6 Name Table) says: These two arrays are indexed starting at 1, [...] I think it is clearer for binutils to follow this, particularly because DW_IDX_parent refers to this number. Second, I think the handling of an empty hash table is slightly wrong. Currently the dumping code assumes there is always an array of hashes. However, section 6.1.1.4.5 Hash Lookup Table says: The optional hash lookup table immediately follows the list of type signatures. and then: The hash lookup table is actually two separate arrays: an array of buckets, followed immediately by an array of hashes. My reading of this is that the hash table as a whole is optional, and so the hashes will not exist in this case. (This also makes sense because the hashes are not useful without the buckets anyway.) This patch fixes both of these problems. FWIW I have some gdb patches in progress that change gdb both to omit the hash table and to use DW_IDX_parent. 2023-12-04 Tom Tromey <tom@tromey.com> * dwarf.c (display_debug_names): Handle empty .debug_names hash table. Name entries start at 1.
2023-12-04s390: Support for jump visualization in disassemblyJens Remus1-0/+2
Add support for jump visualization for the s390 architecture in disassembly: objdump -d --visualize-jumps ... Annotate the (conditional) jump and branch relative instructions with information required for jump visualization: - jump: Unconditional jump / branch relative. - condjump: Conditional jump / branch relative. - jumpsr: Jump / branch relative to subroutine. Unconditional jump and branch relative instructions are annotated as jump. Conditional jump and branch relative instructions, jump / branch relative on count/index, and compare and jump / branch relative instructions are annotated as condjump. Jump and save (jas, jasl) and branch relative and save (bras, brasl) instructions are annotated as jumpsr (jump to subroutine). Provide instruction information required for jump visualization during disassembly. The instruction type is provided after determining the opcode. For non-code it is set to dis_noninsn. Otherwise it defaults to dis_nonbranch. No annotation is done for data reference instructions (i.e. instruction types dis_dref and dis_dref2). Note that the instruction type needs to be provided before printing of the instruction, as it is used in print_address_func() to translate the argument value into an address if it is assumed to be a PC-relative offset. Note that this is never the case on s390, as print_address_func() is only called with addresses and never with offsets. The target of the (conditional) jump and branch relative instructions is provided during print, when the PC relative operand is decoded. include/ * opcode/s390.h: Define opcode flags to annotate instruction class information for jump visualization: S390_INSTR_FLAG_CLASS_BRANCH, S390_INSTR_FLAG_CLASS_RELATIVE, S390_INSTR_FLAG_CLASS_CONDITIONAL, and S390_INSTR_FLAG_CLASS_SUBROUTINE. Define opcode flags mask S390_INSTR_FLAG_CLASS_MASK for above instruction class information. Define helpers for common instruction class flag combinations: S390_INSTR_FLAGS_CLASS_JUMP, S390_INSTR_FLAGS_CLASS_CONDJUMP, and S390_INSTR_FLAGS_CLASS_JUMPSR. opcodes/ * s390-mkopc.c: Add opcode flags to annotate information for jump visualization: jump, condjump, and jumpsr. * s390-opc.txt: Annotate (conditional) jump and branch relative instructions with information for jump visualization. * s390-dis.c (print_insn_s390, s390_print_insn_with_opcode): Provide instruction information for jump visualization. Signed-off-by: Jens Remus <jremus@linux.ibm.com> Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
2023-12-02binutils: Fix documentation typo in the --set-sect-name optionPetr Tesarik1-1/+1
Fix a --set-sect-name typo in the description of objcopy --rename-section.
2023-12-01Fix: nm -U short flag erroneously consumes argumentNick Clifton1-1/+1
PR 31105 * nm.c (main): Remove spurious colon after U in the call to getopt_long
2023-12-01binutils/Dwarf: avoid "shadowing" of glibc function nameJan Beulich1-10/+10
Yet once again: Old enough glibc has an (unguarded) declaration of index() in string.h, which triggers a "shadows a global declaration" warning with at least some gcc versions.
2023-11-20Restore .gdb_index v9 display in readelfTom Tromey1-8/+49
An earlier patch (commit b05efa39 "readelf..debug-dump=loc displays bogus base addresses") inadvertently removed support for displaying .gdb_index v9 sections. This patch corrects the oversight. I tested this by using readelf on an appropriate file. * dwarf.c (display_gdb_index): Restore v9 display code.
2023-11-15Finalized intl-update patchesArsen Arsenovi?6-2899/+4523
* intl: Remove directory. Replaced with out-of-tree GNU gettext. * .gitignore: Add '/gettext*'. * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing. * configure: Regenerate. * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext. * Makefile.in: Regenerate. * src-release.sh: Remove references to the intl/ directory.
2023-11-14Improve objdump's handling of compressed sections.Nick Clifton8-149/+171
PR 31062 * objdump.c (decompressed_dumps): New local variable. (usage): Mention the -z/--decompress option. (long_options): Add --decompress. (dump_section_header): Add "COMPRESSED" to the Flags field of any compressed section. (dump_section): Warn users when dumping a compressed section. (display_any_bfd): Decompress the section if decompressed_dumps is true. (main): Handle the -z/--decompress option. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature. * testsuite/binutils-all/objdump.s: Update expected output. * testsuite/binutils-all/objdump.exp: Add test of -Z -s. * testsuite/binutils-all/objdump.Zs: New file. * readelf.c (maybe_expand_or_relocate_section): New function. Contains common code found in dump functions. Adds a note message if a compressed section is not being decompressed. (dump_section_as_strings): Use new function. (dump_section_as_bytes): Likewise.
2023-11-13MIPS: Fix binutils-all tests for r6 triplesYunQiang Su2-1/+3
2023-11-10bfd, binutils: add gfx11 amdgpu architecturesSimon Marchi2-0/+8
Teach bfd and readelf about some recent gfx11 architectures. This code is taken from the rocgdb 5.7.x branch [1]. [1] https://github.com/rocm-Developer-Tools/rocgdb/tree/rocm-5.7.x bfd/ChangeLog: * archures.c (bfd_mach_amdgcn_gfx1100, bfd_mach_amdgcn_gfx1101, bfd_mach_amdgcn_gfx1102): New. * bfd-in2.h (bfd_mach_amdgcn_gfx1100, bfd_mach_amdgcn_gfx1101, bfd_mach_amdgcn_gfx1102): New. * cpu-amdgcn.c (arch_info_struct): Add entries for bfd_mach_amdgcn_gfx1100, bfd_mach_amdgcn_gfx1101, bfd_mach_amdgcn_gfx1102. binutils/ChangeLog: * readelf.c (decode_AMDGPU_machine_flags): Handle gfx1100, gfx1101, gfx1102. include/ChangeLog: * elf/amdgpu.h (EF_AMDGPU_MACH_AMDGCN_GFX1100, EF_AMDGPU_MACH_AMDGCN_GFX1101, EF_AMDGPU_MACH_AMDGCN_GFX1102): New. Change-Id: I95a8a62942e359781a1c9fa2079950fbcf2a78b8 Co-Authored-By: Laurent Morichetti <laurent.morichetti@amd.com> Cc: Lancelot Six <lancelot.six@amd.com>
2023-11-10readelf..debug-dump=loc displays bogus base addressesVsevolod Alekseyev2-305/+166
PR 30880 * dwarf.c (read_and_display_attr_value): Fix loclist handling. (display_loclists_list): Likewise.
2023-11-10MIPS: Change all E_MIPS_* to EF_MIPS_*Ying Huang1-38/+38
2023-10-24[readelf] Handle unknown name of main in .gdb_index sectionTom de Vries2-7/+16
When compiling hello world and adding a v9 .gdb-index section: ... $ gcc -g hello.c $ gdb-add-index a.out ... readelf shows it as: ... Shortcut table: Language of main: unknown: 0 Name of main: ^A ... The documentation of gdb says about the "Name of main" that: ... This value must be ignored if the value for the language of main is zero. ... Implement this approach in display_gdb_index, such that we have instead: ... Shortcut table: Language of main: unknown: 0 Name of main: <unknown> ... Tested on x86_64-linux. Approved-By: Jan Beulich <jbeulich@suse.com>
2023-10-23objcopy: fix typo in --heap and --stack parserClément Chigot2-4/+4
The help says that <reserve> and <commit> should be separated by a "," but the implementation is checking for ".". Having two numbers being separated by a "." could be confusing, thus adjust the implementation to match the help syntax. binutils/ChangeLog: * objcopy.c (copy_main): Set separator to "," between <reserve> and <commit> for --heap and --stack. * doc/binutils.texi: Add <commit> for --heap and --stack.
2023-10-20bfd: microblaze: Add 32_NONE reloc typeNeal Frager1-0/+4
This patch adds the R_MICROBLAZE_32_NONE relocation type. This is a 32-bit reloc that stores the 32-bit pc relative value in two words (with an imm instruction). Add test case to gas test suite. Signed-off-by: Neal Frager <neal.frager@amd.com> Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-16objcopy: Fix name of the field modified by pe_stack_reserve.Clément Chigot1-1/+1
2023-10-10asan: null dereference in read_and_display_attr_valueAlan Modra1-16/+9
This fixes multiple places in read_and_display_attr_value dealing with range and location lists that can segfault when debug_info_p is NULL. Fuzzed object files can contain arbitrary DW_FORMs. * dwarf.c (read_and_display_attr_value): Don't dereference NULL debug_info_p.
2023-10-10[readelf] Handle .gdb_index section version 9Tom de Vries2-63/+119
Add the abilitity to print a v9 .gdb_index section. The v9 section contains an extra table, which is printed as follows: ... Shortcut table: Language of main: Fortran 95 Name of main: contains_keyword ... [ For the example, I used the exec of gdb test-case gdb.fortran/nested-funcs-2-exp when running the test-case with target board cc-with-gdb-index. ] Tested on x86_64-linux. Approved-By: Nick Clifton <nickc@redhat.com>
2023-10-07Revert "opcodes: microblaze: Add new bit-field instructions"Michael J. Eager1-4/+0
This reverts commit 6bbf249557ba17cfebe01c67370df4da9e6a56f9. Maciej W. Rozycki <macro@orcam.me.uk>: Yet it has caused numerous regressions: microblaze-elf +FAIL: unordered .debug_info references to .debug_ranges microblaze-elf +FAIL: binutils-all/pr26548 microblaze-elf +FAIL: readelf -Wwi pr26548e (reason: unexpected output) microblaze-elf +FAIL: readelf --debug-dump=loc locview-1 (reason: unexpected output) Yet it has caused numerous regressions: microblaze-elf +FAIL: unordered .debug_info references to .debug_ranges microblaze-elf +FAIL: binutils-all/pr26548 microblaze-elf +FAIL: readelf -Wwi pr26548e (reason: unexpected output) ...
2023-10-06opcodes: microblaze: Add new bit-field instructionsNeal Frager1-0/+4
This patches adds new bsefi and bsifi instructions. BSEFI- The instruction shall extract a bit field from a register and place it right-adjusted in the destination register. The other bits in the destination register shall be set to zero. BSIFI- The instruction shall insert a right-adjusted bit field from a register at another position in the destination register. The rest of the bits in the destination register shall be unchanged. Further documentation of these instructions can be found here: https://docs.xilinx.com/v/u/en-US/ug984-vivado-microblaze-ref This patch has been tested for years of AMD Xilinx Yocto releases as part of the following patch set: https://github.com/Xilinx/meta-xilinx/tree/master/meta-microblaze/recipes-devtools/binutils/binutils Signed-off-by: nagaraju <nagaraju.mekala@amd.com> Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@amd.com> Signed-off-by: Neal Frager <neal.frager@amd.com> Signed-off-by: Michael J. Eager <eager@eagercon.com>
2023-10-05Fix: addr2line testsuite fails when targeting PowerPC 64 big-endian with ↵A. Wilcox2-1/+8
ELFv2 ABI PR 30916 * testsuite/binutils-all/addr2line.exp: Do not use PowerPC specific options when working with a MUSL target.
2023-10-03MIPS: Fix `readelf -S bintest' test for n64 targetsYunQiang Su1-0/+31
Add a 64-bit traditional MIPS dump variant for the `readelf -S bintest' test from binutils-all/readelf.exp, using a filename suffix according to the rules set there, removing: FAIL: readelf -S bintest regressions with `mips64-linux-gnuabi64', `mips64el-linux-gnuabi64', `mips64-openbsd', and `mips64el-openbsd' targets, which default to the n64 ABI and consequently produce a section layout that is different from what the generic dump pattern covers. Co-Authored-By: Maciej W. Rozycki <macro@orcam.me.uk> binutils/ * testsuite/binutils-all/readelf.s-64-tmips: New test variant.
2023-10-03Fix: readelf..info misreports DW_FORM_loclistx, DW_FORM_rnglistxVsevolod Alekseyev2-79/+39
PR 29267 * dwarf.c (fetch_indexed_value): Delete. (fetch_indexed_offset): Correct base address calculation. (read_and_display_attr_value): Replace uses of fetch_indexed_value with fetch_indexed_offset.
2023-09-29x86-64: Add -z mark-plt and -z nomark-pltH.J. Lu1-0/+19
The PLT entry in executables and shared libraries contains an indirect branch, like jmp *foo@GOTPCREL(%rip) push $index_foo jmp .PLT0 or endbr64 jmp *foo@GOTPCREL(%rip) NOP padding which is used to branch to the function, foo, defined in another object. Each R_X86_64_JUMP_SLOT relocation has a corresponding PLT entry. The dynamic tags have been added to the x86-64 psABI to mark such PLT entries: https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/6d824a52a42d173eb838b879616c1be5870b593e Add an x86-64 linker option, -z mark-plt, to mark PLT entries with #define DT_X86_64_PLT (DT_LOPROC + 0) #define DT_X86_64_PLTSZ (DT_LOPROC + 1) #define DT_X86_64_PLTENT (DT_LOPROC + 3) 1. DT_X86_64_PLT: The address of the procedure linkage table. 2. DT_X86_64_PLTSZ: The total size, in bytes, of the procedure linkage table. 3. DT_X86_64_PLTENT: The size, in bytes, of a procedure linkage table entry. and set the r_addend field of the R_X86_64_JUMP_SLOT relocation to the memory offset of the indirect branch instruction. The dynamic linker can use these tags to update the PLT section to direct branch. bfd/ * elf-linker-x86.h (elf_linker_x86_params): Add mark_plt. * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Set the r_addend of R_X86_64_JUMP_SLOT to the indirect branch offset in PLT entry for -z mark-plt. * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Add DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT for -z mark-plt. (_bfd_x86_elf_finish_dynamic_sections): Set DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT. (_bfd_x86_elf_get_synthetic_symtab): Ignore addend for JUMP_SLOT relocation. (_bfd_x86_elf_link_setup_gnu_properties): Set plt_indirect_branch_offset. * elfxx-x86.h (elf_x86_plt_layout): Add plt_indirect_branch_offset. binutils/ * readelf.c (get_x86_64_dynamic_type): New function. (get_dynamic_type): Call get_x86_64_dynamic_type. include/ * elf/x86-64.h (DT_X86_64_PLT): New. (DT_X86_64_PLTSZ): Likewise. (DT_X86_64_PLTENT): Likewise. ld/ * ld.texi: Document -z mark-plt and -z nomark-plt. * emulparams/elf32_x86_64.sh: Source x86-64-plt.sh. * emulparams/elf_x86_64.sh: Likewise. * emulparams/x86-64-plt.sh: New file. * testsuite/ld-x86-64/mark-plt-1.s: Likewise. * testsuite/ld-x86-64/mark-plt-1a-x32.d: Likewise. * testsuite/ld-x86-64/mark-plt-1a.d: Likewise. * testsuite/ld-x86-64/mark-plt-1b-x32.d: Likewise. * testsuite/ld-x86-64/mark-plt-1b.d: Likewise. * testsuite/ld-x86-64/mark-plt-1c-x32.d: Likewise. * testsuite/ld-x86-64/mark-plt-1c.d: Likewise. * testsuite/ld-x86-64/mark-plt-1d-x32.d: Likewise. * testsuite/ld-x86-64/mark-plt-1d.d: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run -z mark-plt tests.
2023-09-29Update README file's installation instructionsNick Clifton1-6/+20
2023-09-28Add support to readelf for the PT_OPENBSD_NOBTCFI segment type.Frederic Cambus2-0/+6
2023-09-27config/debuginfod.m4: Add check for libdebuginfod 0.188Aaron Merey2-1/+110
Add check for libdebuginfod 0.188 in AC_DEBUGINFOD and if found define macro HAVE_LIBDEBUGINFOD_FIND_SECTION. This macro indicates support for downloading ELF sections from debuginfod servers.