aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
4 hoursAutomatic date update in version.inHEADmasterGDB Administrator1-1/+1
11 hoursld: Skip the LTO archive member only for the earlier DSOH.J. Lu1-3/+5
commit 2707d55e539ef323dd14a1293e762bf3d9739ee7 Author: Michael Matz <matz@suse.de> Date: Mon Mar 31 15:57:08 2025 +0200 skipped the LTO archive member even when the earlier item is also an archive. Instead, skip the LTO archive member only if the earlier item is a shared library. bfd/ PR ld/32846 PR ld/32854 * elflink.c (elf_link_add_archive_symbols): Skip the LTO archive member only if the earlier item is a shared library. ld/ PR ld/32846 PR ld/32854 * testsuite/ld-plugin/lto.exp: Run ld/32846 test. * testsuite/ld-plugin/pr32846a.c: New file. * testsuite/ld-plugin/pr32846b.c: Likewise. * testsuite/ld-plugin/pr32846c.c: Likewise. * testsuite/ld-plugin/pr32846d.c: Likewise. * testsuite/ld-plugin/pr32846e.c: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
18 hoursPR32858 ld segfault on fuzzed objectAlan Modra1-1/+2
We missed one place where it is necessary to check for empty groups. PR 32858 * elflink.c (elf_gc_sweep): Protect against empty group.
28 hoursAutomatic date update in version.inGDB Administrator1-1/+1
2 daysAutomatic date update in version.inGDB Administrator1-1/+1
3 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 days[lto] Fix symlookup in archives vs sharedMichael Matz1-10/+34
when a shared library defines 'foo@@FOO' (default version), a static archive defines 'foo', the shared lib comes in front of the archive and under effect of --as-needed, and the requesting object file uses LTO, then the link editor was wrongly including the definition from the static archive. It must use the one from the shared lib, like in the non-LTO or the --no-as-needed case. See the added testcase that would wrongly print "FAIL" before this patch. The problem stems from several connected problems: (1) only the decorated symbol was entered into first_hash (the hash table designed to handle definition order in the pre-LTO-plugin phase of the symbol table walks) (2) in the archive symbol walk only the undecorated name would be looked up in first_hash (and hence not found due to (1)) (3) in the archive symbol walk first_hash would only be consulted when the linker hash table had a defined symbol. In pre-LTO phase shared lib symbols aren't entered into the linker symbol table. So: add also the undecorated name into first_hash when it stems from a default version and consult first_hash in the archive walker also for currently undefined symbols. If it has an entry which doesn't point to the archive, then it comes from an earlier library (shared or static), and so _this_ archive won't provide the definition.
4 daysxcoff dynamic symbol string sanityAlan Modra1-9/+15
Sanity check symbol string table offsets, and tidy structs. "long" isn't a good choice for _l_zeroes and _l_offset since it can be 64 bits which blows out the size of the symbol struct unnecessarily. Also, all of the sizes in internal_ldsym need only be 32 bits, but I made them size_t because I didn't want to audit all expressions using them for overflow. bfd/ * xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Sanity check symbol _l_offset. (xcoff_link_add_dynamic_symbols), (xcoff_link_check_dynamic_ar_symbols): Likewise. include/ * coff/xcoff.h (struct internal_ldhdr): Tidy types. (struct internal_ldsym): Use uint32_t for _l_zeroes and _l_offset.
4 daysxcoff buffer overflowAlan Modra1-18/+55
Much of the xcoff code is not well protected against fuzzed object file attacks. This sanity checks some values in ".loader". * xcofflink.c (xcoff_get_ldhdr): New function. (_bfd_xcoff_get_dynamic_symtab_upper_bound), (_bfd_xcoff_canonicalize_dynamic_symtab), (_bfd_xcoff_get_dynamic_reloc_upper_bound), (_bfd_xcoff_canonicalize_dynamic_reloc), (xcoff_link_add_dynamic_symbols), (xcoff_link_check_dynamic_ar_symbols): Use xcoff_get_ldhdr.
4 daysbuffer overflow in nds32_elf_do_9_pcrel_relocAlan Modra1-5/+13
* elf32-nds32.c (nds32_elf_do_9_pcrel_reloc): Properly bounds check relocation field. (nds32_elf_hi20_reloc, nds32_elf_generic_reloc): Likewise. (nds32_elf_final_link_relocate): Likewise.
4 daysbfd: add load config size workaround for i386 XP and earlierJeremy Drake1-10/+18
Per the Microsoft PE documentation, XP and earlier on i686 require the Size field to be 64, rather than the actual size as required on other architectures. I have confirmed Windows 11 accepts either 64 or the actual size for i386 images, but only the actual size for x86_64 images. Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
4 daysbfd: fill in PE load config directory entryJeremy Drake1-1/+70
This is filled in with the rva of _load_config_used if defined (much like _tls_used), and the size is the first 32-bit value at that symbol. Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
4 daysbfd: adjust a few error messagesJeremy Drake1-10/+10
Rationalize the error messages in _bfd_XXi_final_link_postscript(). They now all correctly refer to DataDirectory instead of DataDictionary, and use unified format strings, so fewer translations are needed. Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
4 daysbfd: properly use bfd_get_symbol_leading_char() in peXXigenJeremy Drake1-6/+6
This function returns the leading char to use, so we cannot just assume it will always be '_' or '\0'. Signed-off-by: Jeremy Drake <sourceware-bugzilla@jdrake.com>
4 daysbfd/COFF: drop link_add_one_symbol() hookJan Beulich13-53/+45
The need for this has disappeared with dc12032bca08 ("Remove m68k-aout and m68k-coff support"); avoid the unnecessary indirection. Sadly, with ld/pe-dll.c using the wrapper, the removal requires moving the declaration out of libcoff.h, to properly export the underlying BFD function.
4 daysAutomatic date update in version.inGDB Administrator1-1/+1
5 daysAutomatic date update in version.inGDB Administrator1-1/+1
6 daysAutomatic date update in version.inGDB Administrator1-1/+1
7 daysAutomatic date update in version.inGDB Administrator1-1/+1
8 daysAutomatic date update in version.inGDB Administrator1-1/+1
9 daysAutomatic date update in version.inGDB Administrator1-1/+1
10 daysubsan: nds32 undefined shiftAlan Modra1-2/+2
Avoid implementation defined behaviour right shift of negative values, and undefined behaviour left shift of negative values. While this change might give different results in the top bit of a bfd_vma (rightshift is 1), that doesn't matter as only the bottom 8 bits of the relocation are used. * elf32-nds32.c (nds32_elf_do_9_pcrel_reloc): Calculate relocation using a bfd_vma type.
10 daysFormatting fixes for elf-attrs.cAlan Modra1-19/+19
10 daysAutomatic date update in version.inGDB Administrator1-1/+1
11 daysAutomatic date update in version.inGDB Administrator1-1/+1
12 daysAutomatic date update in version.inGDB Administrator1-1/+1
13 daysAutomatic date update in version.inGDB Administrator1-1/+1
2025-03-28Automatic date update in version.inGDB Administrator1-1/+1
2025-03-27Automatic date update in version.inGDB Administrator1-1/+1
2025-03-26RISC-V: add Smrnmi 1.0 instruction supportJerry Zhang Jian1-0/+4
Add instruction `mnret' support Ref: https://github.com/riscv/riscv-isa-manual/blob/bb8b9127f81965eeff2d150c211d1c89376591c4/src/rnmi.adoc https://github.com/riscv/riscv-opcodes/blob/946eb673874b3a0f2474d1424dc28bc7ee53c306/extensions/rv_smrnmi bfd/ChangeLog: * elfxx-riscv.c: Add new Smrnmi instruction class handling gas/ChangeLog: * testsuite/gas/riscv/smrnmi.s: New test for mnret * testsuite/gas/riscv/rmrnmi.d: Likewise include/ChangeLog: * opcode/ricsv-opc.h: Add MATCH_MNRET, MASK_MNRET * opcode/riscv.h: Add new instruction class opcodes/ChangeLog: * riscv-opc.c: Add `mnret' instruction Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-26Automatic date update in version.inGDB Administrator1-1/+1
2025-03-25Automatic date update in version.inGDB Administrator1-1/+1
2025-03-24Automatic date update in version.inGDB Administrator1-1/+1
2025-03-23Automatic date update in version.inGDB Administrator1-1/+1
2025-03-22Automatic date update in version.inGDB Administrator1-1/+1
2025-03-21RISC-V: Ssnpm, smnpm and smmpm imply zicsr.Dongyan Chen1-0/+3
According to the spec[1], imply zicsr for ssnpm, smnpm and smmpm. [1] https://github.com/riscv/riscv-j-extension/blob/master/zjpm/instructions.adoc bfd/ChangeLog: * elfxx-riscv.c: imply zicsr.
2025-03-21Automatic date update in version.inGDB Administrator1-1/+1
2025-03-20Automatic date update in version.inGDB Administrator1-1/+1
2025-03-19Automatic date update in version.inGDB Administrator1-1/+1
2025-03-18Updated translations for BFD and BINUTILS sub-directoriesNick Clifton1-1791/+1941
2025-03-18RISC-V: Support pointer masking extension 1.0Jerry Zhang Jian1-0/+35
- Adding Ssnpm, Smnpm, Smmpm, Sspm, and Supm - No new CSR added - Pointer masking only applies to RV64 - Ref: https://github.com/riscv/riscv-j-extension/releases/download/pointer-masking-ratified/pointer-masking-ratified.pdf Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2025-03-18RISC-V: Add extension XTheadVdot for T-Head VECTOR vendor extension [1]Jin Ma1-0/+5
T-Head has a range of vendor-specific instructions. Therefore it makes sense to group them into smaller chunks in form of vendor extensions. This patch adds the additional extension "XTheadVdot" based on the "V" extension, and it provides four 8-bit multiply and add with 32-bit instructions for the "v" extension. The 'th' prefix and the "XTheadVector" extension are documented in a PR for the RISC-V toolchain conventions ([2]). Co-Authored-By: Lifang Xia <lifang_xia@linux.alibaba.com> [1] https://github.com/XUANTIE-RV/thead-extension-spec/tree/master/xtheadvdot [2] https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/19 bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): Add support for "XTheadVdot" extension. (riscv_multi_subset_supports_ext): Likewise. gas/ChangeLog: * doc/c-riscv.texi: Likewise. * testsuite/gas/riscv/march-help.l: Likewise. * testsuite/gas/riscv/x-thead-vdot.d: New test. * testsuite/gas/riscv/x-thead-vdot.s: New test. include/ChangeLog: * opcode/riscv-opc.h (MATCH_TH_VMAQA_VV): New. * opcode/riscv.h (enum riscv_insn_class): Add insn class for XTheadVdot. opcodes/ChangeLog: * riscv-opc.c: Likewise.
2025-03-18RISC-V: Avoid parsing arch string repeatedly for dis-assemblerNelson Chu3-3/+11
Since we now always generate $x+isa for now, these would increase the dis-assemble time by parsing the same architecture string repeatedly. We already have `arch_str' field into `subset_list' to record the current architecture stirng, but it's only useful for assembler, since dis-assembler and linker don't need it before. Now for dis-assembler, we just need to update the `arch_str' after parsing the architecture stirng, and then avoid parsing repeatedly if the strings are the same.
2025-03-18RISC-V: Free the returned string of riscv_arch_str if we call it multiple timesNelson Chu1-1/+4
The string returned from riscv_arch_str is allocated by xmalloc, so once we called it multiple times, we should keep the newest one for the output elf architecture attribute, but free the remaining unused strings.
2025-03-18RISC-V: Fixed riscv_update_subset1 returning wrong boolean valueNelson Chu1-3/+3
The riscv_update_subset1 returning wrong boolean value if the riscv_parse_check_conflicts isn't called, though the current return value doesn't really useful.
2025-03-18Automatic date update in version.inGDB Administrator1-1/+1
2025-03-17Automatic date update in version.inGDB Administrator1-1/+1
2025-03-16Automatic date update in version.inGDB Administrator1-1/+1
2025-03-15Automatic date update in version.inGDB Administrator1-1/+1
2025-03-14Automatic date update in version.inGDB Administrator1-1/+1