aboutsummaryrefslogtreecommitdiff
path: root/binutils
AgeCommit message (Collapse)AuthorFilesLines
2024-01-26elf: Rename is_standard_elf to uses_elf_emH.J. Lu1-2/+2
Rename is_standard_elf to uses_elf_em for targets which use elf.em. binutils/ PR ld/31289 * testsuite/lib/binutils-common.exp (is_standard_elf): Renamed to ... (uses_elf_em): This. ld/ PR ld/31289 * testsuite/ld-elf/fatal-warnings-2a.d: Replace is_standard_elf with uses_elf_em. * testsuite/ld-elf/fatal-warnings-2b.d: Likewise. * testsuite/ld-elf/fatal-warnings-3a.d: Likewise. * testsuite/ld-elf/fatal-warnings-3b.d: Likewise. * testsuite/ld-elf/fatal-warnings-4a.d: Likewise. * testsuite/ld-elf/fatal-warnings-4b.d: Likewise.
2024-01-26Fix: Stripping Rust static libraries fails because of overly zealous illegal ↵Nick Clifton2-12/+20
path check PR 31250 * objcopy.c (copy_archive): Improve the handling of archives that contain elements with invalid pathnames.
2024-01-26Assertion failure dumping .eh_frame_hdrAlan Modra1-6/+6
dwarf.c can hit "Assertion '(start) <= (end)' failed" on truncated sections, due to get_encoded_eh_value wrongly returning a full count for truncated words. * dwarf.c (get_encoded_eh_value): Return zero for truncated words.
2024-01-25elf: Add is_standard_elfH.J. Lu1-0/+21
PR ld/31289 tests failed for fr30-elf, frv-elf, ft32-elf, iq2000-elf, mn10200-elf, ms1-elf and msp430-elf targets: FAIL: ld-elf/fatal-warnings-2a FAIL: ld-elf/fatal-warnings-2b FAIL: ld-elf/fatal-warnings-3a FAIL: ld-elf/fatal-warnings-3b FAIL: ld-elf/fatal-warnings-4a FAIL: ld-elf/fatal-warnings-4b even though PR ld/31289 targets xfail for [is_generic] targets. These targets not only don't use the generic_link_hash_table linker, but also don't use the standard ELF emulation. Add is_standard_elf for ELF targets which use the standard ELF emulation and replace [is_generic] with ![is_standard_elf] in PR ld/31289 tests. binutils/ PR ld/31289 * testsuite/lib/binutils-common.exp (is_standard_elf): New. ld/ PR ld/31289 * testsuite/lib/binutils-common.exp (is_generic): Return 1 for fr30-*-*, frv-*-elf, ft32-*-*, iq2000-*-*, mn10200-*-*, moxie-*-moxiebox*, msp430-*-* and mt-*-*. * testsuite/ld-elf/fatal-warnings-2a.d: Replace [is_generic] with ![is_standard_elf]. * testsuite/ld-elf/fatal-warnings-2b.d: Likewise. * testsuite/ld-elf/fatal-warnings-3a.d: Likewise. * testsuite/ld-elf/fatal-warnings-3b.d: Likewise. * testsuite/ld-elf/fatal-warnings-4a.d: Likewise. * testsuite/ld-elf/fatal-warnings-4b.d: Likewise.
2024-01-24Add myself as the KVX port maintainerPaul Iannetta1-0/+1
binutils/ChangeLog: * MAINTAINERS: Add myself as the KVX port maintainer.
2024-01-22binutils: Fix calloc argument order in srconv.cMark Wielaard1-3/+3
GCC 14 will warn about calling calloc with swapped size and count arguments. binutils/srconv.c: In function ‘nints’: binutils/srconv.c:598:36: error: ‘xcalloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 598 | return (int *) (xcalloc (sizeof (int), x)); | ^~~ binutils/srconv.c:598:36: note: earlier argument should specify number of elements, later size of each element binutils/ * srconv.c (nints): Swap xcalloc arguments. (wr_du): Likewise. (wr_dus): Likewise.
2024-01-22binutils: Fix calloc argument order in coffgrok.cMark Wielaard1-7/+8
GCC 14 will warn about calling calloc with swapped size and count arguments. binutils-gdb/binutils/coffgrok.c: In function ‘do_sections_p1’: binutils-gdb/binutils/coffgrok.c:116:72: error: ‘xcalloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args] 116 | struct coff_section *all = (struct coff_section *) (xcalloc (sizeof (struct coff_section), | ^~~~~~ binutils-gdb/binutils/coffgrok.c:116:72: note: earlier argument should specify number of elements, later size of each element binutils/ * coffgrok.c (empty_scope): Swap xcalloc arguments. (empty_symbol): Likewise. (do_lines): Likewise. (doit): Likewise. (coff_grok): Likewise.
2024-01-19Update readelf's and objdump's debug frame displaying feature to include the ↵Nick Clifton4-0/+267
contents of the .eh_frame_hdr section, if present.
2024-01-18Updated translations for various sub-directoriesNick Clifton4-8930/+9265
2024-01-15Update HOWTO document after creating the 2.42 branchNick Clifton1-22/+24
2024-01-15Change version to 2.42.50 and regenerate filesNick Clifton2-761/+803
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.