aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2024-12-01Correct hpux-core.c thread_section_p signatureAlan Modra1-1/+1
Fix fallout from commit 0a1b45a20eaa.
2024-12-01Re: PR32399, buffer overflow printing core_file_failing_commandAlan Modra6-21/+31
Fix more potential buffer overflows, and correct trad-code.c and cisco-core.c where they should be using bfd_{z}alloc rather than bfd_{z}malloc. To stop buffer overflows with fuzzed objects that don't have a terminator on the core_file_failing_command string, this patch allocates an extra byte at the end of the entire header buffer rather than poking a NUL at the end of the name array (u_comm[] or similar) because (a) it's better to not overwrite the file data, and (b) it is possible that some core files make use of fields in struct user beyond the end of u_comm to extend the command name. The patch also changes some unnecessary uses of bfd_zalloc to bfd_alloc. There's not much point in clearing memeory that will shortly be completely overwritten. PR 32399 * aix5ppc-core.c (xcoff64_core_p): Allocate an extra byte to ensure the core_file_failing_command string is terminated. * netbsd-core.c (netbsd_core_file_p): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise, and bfd_alloc tdata rather than bfd_zmalloc. * cisco-core.c (cisco_core_file_validate): bfd_zalloc tdata.
2024-12-01Automatic date update in version.inGDB Administrator1-1/+1
2024-11-30Automatic date update in version.inGDB Administrator1-1/+1
2024-11-29PR32399, buffer overflow printing core_file_failing_commandAlan Modra6-7/+12
Assorted targets do not check, as the ELF targets do, that the program name in a core file is NUL terminated. Fix some of them. I haven't attempted to fix all targets because editing host specific code can easily result in build bugs, which aren't discovered until someone build binutils for that host. (Of the files edited here, I can't easily compile hpux-core.c and osf-core.c on a linux system.) PR 32399 * hppabsd-core.c (hppabsd_core_core_file_p): Ensure core_command string is terminated. * hpux-core.c (hpux_core_core_file_p): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * mach-o.c (bfd_mach_o_core_file_failing_command): Likewise.
2024-11-29Automatic date update in version.inGDB Administrator1-1/+1
2024-11-28Automatic date update in version.inGDB Administrator1-1/+1
2024-11-27PE LD: Merge .CRT .ctors and .dtors into .rdataLiu Hao1-1/+2
PR 32264
2024-11-27Re: nios2: Remove binutils support for Nios II targetAlan Modra2-3/+1
Remove a now unused config file, regenerate POTFILES to remove nios2 refs, and modify config.bfd to report the target is obsolete.
2024-11-27Automatic date update in version.inGDB Administrator1-1/+1
2024-11-26nios2: Remove binutils support for Nios II target.Sandra Loosemore15-6461/+2
The Nios II architecture has been EOL'ed by the vendor. This patch removes all binutils, bfd, gas, binutils, and opcodes support for this target with the exception of the readelf utility. (The ELF EM_* number remains valid and the relocation definitions from the Nios II ABI will never change in future, so retaining the readelf support seems consistent with its purpose as a utility that tries to parse the headers in any ELF file provided as an argument regardless of target.)
2024-11-26PR32387 ppc64 TLS optimization bug with -fno-plt codeAlan Modra1-0/+9
The inline plt code emitted by gcc is incompatible with the linker/ld.so --tls-get-addr-optimize scheme. This is the runtime optimisation where the first call to __tls_get_addr results in __tls_get_addr updating the tls_index pair, then the special linker stub using that to short-circuit second and subsequent calls for a given tls symbol. Enabled by default when the linker sees __tls_get_addr_opt is preseent, and enabled in ld.so when DT_PPC64_OPT has PPC64_OPT_TLS set. Note that this is distinct from link-time tls optimisation. PR 32387 * elf64-ppc.c (ppc64_elf_check_relocs): Disable tls_get_addr_opt on detecting inline plt calls to __tls_get_addr.
2024-11-26Automatic date update in version.inGDB Administrator1-1/+1
2024-11-25Automatic date update in version.inGDB Administrator1-1/+1
2024-11-24Automatic date update in version.inGDB Administrator1-1/+1
2024-11-23Automatic date update in version.inGDB Administrator1-1/+1
2024-11-22RISC-V: Support SiFive extensions: xsfvqmaccdod, xsfvqmaccqoq and ↵Nelson Chu1-0/+14
xsfvfnrclipxfqf Those SiFive extensions have been published on the web for a while, and we plan to implement intrinsics in GCC for those instructions soon. NOTE: The original patch was written by Nelson when he was still working at SiFive, and Kito rebased it to the trunk. Therefore, I kept the author as Nelson with his SiFive email. Document links: xsfvqmaccdod: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification xsfvqmaccqoq: https://www.sifive.com/document-file/sifive-int8-matrix-multiplication-extensions-specification xsfvfnrclipxfqf: https://www.sifive.com/document-file/fp32-to-int8-ranged-clip-instructions Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2024-11-22Automatic date update in version.inGDB Administrator1-1/+1
2024-11-21Automatic date update in version.inGDB Administrator1-1/+1
2024-11-20RISC-V: Add Zcmt instructions and csr.Jiawei1-0/+6
This patch supports Zcmt[1] instruction 'cm.jt' and 'cm.jalt'. Add new CSR jvt for tablejump using. Since 'cm.jt' and 'cm.jalt' have the same instructiong encoding, use 'match_cm_jt' and 'match_cm_jalt' check the 'zcmt_index' field to distinguish them. [1] https://github.com/riscvarchive/riscv-code-size-reduction/releases Co-Authored by: Charlie Keaney <charlie.keaney@embecosm.com> Co-Authored by: Mary Bennett <mary.bennett@embecosm.com> Co-Authored by: Nandni Jamnadas <nandni.jamnadas@embecosm.com> Co-Authored by: Sinan Lin <sinan.lin@linux.alibaba.com> Co-Authored by: Simon Cook <simon.cook@embecosm.com> Co-Authored by: Shihua Liao <shihua@iscas.ac.cn> Co-Authored by: Yulong Shi <yulong@iscas.ac.cn> bfd/ChangeLog: * elfxx-riscv.c (riscv_multi_subset_supports): New extension. (riscv_multi_subset_supports_ext): Ditto. gas/ChangeLog: * config/tc-riscv.c (enum riscv_csr_class): New CSR. (riscv_csr_address): Ditto. (validate_riscv_insn): New operand. (riscv_ip): Ditto. * testsuite/gas/riscv/csr-version-1p10.d: New CSR. * testsuite/gas/riscv/csr-version-1p10.l: Ditto. * testsuite/gas/riscv/csr-version-1p11.d: Ditto. * testsuite/gas/riscv/csr-version-1p11.l: Ditto. * testsuite/gas/riscv/csr-version-1p12.d: Ditto. * testsuite/gas/riscv/csr-version-1p12.l: Ditto. * testsuite/gas/riscv/csr.s: Ditto. * testsuite/gas/riscv/march-help.l: New extension. * testsuite/gas/riscv/zcmt-fail.d: New test. * testsuite/gas/riscv/zcmt-fail.l: New test. * testsuite/gas/riscv/zcmt-fail.s: New test. * testsuite/gas/riscv/zcmt.d: New test. * testsuite/gas/riscv/zcmt.s: New test. include/ChangeLog: * opcode/riscv-opc.h (MATCH_CM_JT): New opcode. (MASK_CM_JT): New mask. (MATCH_CM_JALT): New opcode. (MASK_CM_JALT): New mask. (CSR_JVT): New CSR. (DECLARE_INSN): New declaration. (DECLARE_CSR): Ditto. * opcode/riscv.h (EXTRACT_ZCMT_INDEX): New marco. (ENCODE_ZCMT_INDEX): Ditto. (enum riscv_insn_class): New class. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): New operand. * riscv-opc.c (match_cm_jt): New function. (match_cm_jalt): Ditto.
2024-11-20Automatic date update in version.inGDB Administrator1-1/+1
2024-11-19RISC-V: Don't report warnings when linking different privileged spec objects.Nelson Chu1-14/+3
Since only the abandoned privileged spec v1.9.1 will have conflict csrs, to keep the compatible we still report warnings when linking privileged spec v1.9.1 objects with others. But don't report warnings for other compatible cases because it is actually a bit noisy and useless... bfd/ * elfnn-riscv.c (riscv_merge_attributes): Only report warnings when linking the abandoned privileged spec v1.9.1 object with others. ld/ * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-01.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-02.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-03.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-04.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-05.d: Removed. * testsuite/ld-riscv-elf/attr-merge-priv-spec-failed-06.d: Removed. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2024-11-19LoongArch: Do not relax pcalau12i+ld.d when there is overflowLulu Cai1-5/+27
There is no overflow check for the relaxation of pcalau12i+ld.d => pcalau12i+addi.d. For instruction sequences that can be relaxed, they are directly relaxed to pcalau12i+addi.d. However, when the relative distance between the symbol and the pc exceeds the 32-bit range, the symbol value cannot be obtained correctly. Adds an overflow check for the relaxation of pcalau12i+ld.d. If it is found that the relaxation will overflow, it will not be relaxed.
2024-11-19Automatic date update in version.inGDB Administrator1-1/+1
2024-11-18aarch64: remove annoying white spaces in bfd/elfnn-aarch64.cMatthieu Longo1-2/+2
2024-11-18ELF: SHF_STRINGS isn't really tied to SHF_MERGEJan Beulich1-2/+8
It's not overly useful without it, but the spec doesn't name any dependency between the two. People may want to use it for purely informational purposes, for example. Adjust, in particular, entity size processing to be engaged if either flag is set, as mandated by the spec.
2024-11-18ELF: SHF_MERGE vs SHT_NOBITSJan Beulich1-0/+1
bfd/merge.c puts in quite some effort to track mergable sections. That's all wasted for sections which don't have contents, as for them _bfd_write_merged_section() will never be called. With the combination not having any useful effect, also warn about this in gas.
2024-11-18bfd: fix -std=gnu23 compatibility wrt _BoolSam James5-6/+6
GCC trunk now defaults to -std=gnu23. We return false in a few places which can't work when true/false are a proper type (_Bool). Return NULL where appropriate instead of false. All callers handle this appropriately. ChangeLog: PR ld/32372 * elf32-ppc.c (ppc_elf_tls_setup): Return NULL. * elf32-xtensa.c (translate_reloc_bfd_fix): Ditto. (translate_reloc): Ditto. * elf64-ppc.c (update_local_sym_info): Ditto. * mach-o.c (bfd_mach_o_lookup_uuid_command): Ditto. * xsym.c (bfd_sym_read_name_table): Ditto.
2024-11-18Automatic date update in version.inGDB Administrator1-1/+1
2024-11-17x86-64: Always check IBT PLT before BND PLTH.J. Lu1-48/+48
Since BND PLT has been deprecated and the same IBT PLT is used for both x86-64 and x32, always check IBT PLT before BND PLT when synthesizing PLT symtab. * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Always check elf_x86_64_lazy_ibt_plt and elf_x86_64_non_lazy_ibt_plt first. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-17x86-64: Drop x32 references in PLT entry variablesH.J. Lu1-38/+39
e9c11d58b95 x86-64: Remove BND from 64-bit IBT PLT removed the BND prefix from 64-bit IBT PLT by using x32 IBT PLT. Drop x32 references in PLT entry variables. * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): Renamed to ... (elf_x86_64_lazy_bnd_ibt_plt_entry): This. (elf_x32_lazy_ibt_plt_entry): Renamed to ... (elf_x86_64_lazy_ibt_plt_entry): This. (elf_x86_64_non_lazy_ibt_plt_entry): Renamed to ... (elf_x86_64_non_lazy_bnd_ibt_plt_entry): This. (elf_x32_non_lazy_ibt_plt_entry): Renamed to ... (elf_x86_64_non_lazy_ibt_plt_entry): This. (elf_x86_64_eh_frame_lazy_ibt_plt): Renamed to ... (elf_x86_64_eh_frame_lazy_bnd_ibt_plt): This. (elf_x32_eh_frame_lazy_ibt_plt): Renamed to ... (elf_x86_64_eh_frame_lazy_ibt_plt): This. (elf_x86_64_lazy_ibt_plt): Renamed to ... (elf_x86_64_lazy_bnd_ibt_plt): This. Updated. (elf_x32_lazy_ibt_plt): Renamed to ... (elf_x86_64_lazy_ibt_plt): This. Updated. (elf_x86_64_non_lazy_ibt_plt): Renamed to ... (elf_x86_64_non_lazy_bnd_ibt_plt): This. Updated. (elf_x32_non_lazy_ibt_plt): Renamed to ... (elf_x86_64_non_lazy_ibt_plt): This. Updated. (elf_x86_64_get_synthetic_symtab): Updated. (elf_x86_64_link_setup_gnu_properties): Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-17Automatic date update in version.inGDB Administrator1-1/+1
2024-11-16Automatic date update in version.inGDB Administrator1-1/+1
2024-11-15Automatic date update in version.inGDB Administrator1-1/+1
2024-11-14Automatic date update in version.inGDB Administrator1-1/+1
2024-11-13Automatic date update in version.inGDB Administrator1-1/+1
2024-11-12bfd: Add WARN_CFLAGS_FOR_BUILD to doc/chew.c build, fix warningsMark Wielaard3-25/+25
doc/chew.c was compiled without any warning flags set. Adding the common warnings for build showed various issues with non-static functions missing prototypes and globals with common names (ptr and idx) that shadowed local arguments or variables. * doc/local.mk (doc/chew.stamp): Add WARN_CFLAGS_FOR_BUILD. * Makefile.in: Regenerate. * doc/chew.c (idx): Rename to pos_idx. (ptr): Rename to buf_ptr. (xmalloc): Make static. (xrealloc): Likewise. (xstrdup): Likewise. (nextword): Likewise. (newentry): Likewise. (add_to_definition): Likewise. (add_intrinsic): Likewise. (compile): Likewise. (icopy_past_newline): Rename idx to pos_idx, ptr to buf_ptr. (get_stuff_in_command): Likewise. (skip_past_newline): Likewise. (perform): Likewise. (main): Likewise.
2024-11-12Remove redundant section merge hash table fieldAlan Modra1-61/+64
sec_merge_hash.size duplicates sec_merge_hash.table.count, albeit using bfd_size_type rather than unsigned int. The only reason to have the duplicate field is to catch unsigned int overflows, and that can be done easily enough when and if required. Overflow isn't possible at the moment. See the needs_resize comment. * merge.c (sec_merge_hash): Remove "size" field. (NEEDS_RESIZE): Delete macro, replacing with.. (needs_resize): ..this inline function. (sec_merge_resize): Rename from sec_merge_maybe_resize, removing redundant check. (sec_merge_hash_insert, sec_merge_hash_lookup): Adjust to suit. (sec_merge_init, merge_strings): Likewise.
2024-11-12Re: tekhex object file output fixesAlan Modra1-18/+20
Commit 8b5a212495 supported *ABS* symbols by allowing "section" to be bfd_abs_section, but bfd_abs_section needs to be treated specially. In particular, bfd_get_next_section_by_name (.., bfd_abs_section_ptr) is invalid. PR 32347 * tekhex.c (first_phase): Guard against modification of _bfd_std_section[] entries.
2024-11-12Automatic date update in version.inGDB Administrator1-1/+1
2024-11-11ld, LoongArch: print error about linking without -fPIC or -fPIE flag in more ↵Xin Wang1-10/+26
detail
2024-11-11Automatic date update in version.inGDB Administrator1-1/+1
2024-11-10Automatic date update in version.inGDB Administrator1-1/+1
2024-11-09Automatic date update in version.inGDB Administrator1-1/+1
2024-11-08bfd: Remove unused static find function from doc/chew.cMark Wielaard1-16/+0
After commit 2e60790cf7c27d79f90f2dcb81e1930dc980bc1c "Remove the paramstuff word" there is no caller left of the static find function in doc/chew.c, so it should be removed. * doc/chew.c (find): Remove.
2024-11-08Automatic date update in version.inGDB Administrator1-1/+1
2024-11-07Automatic date update in version.inGDB Administrator1-1/+1
2024-11-06Automatic date update in version.inGDB Administrator1-1/+1
2024-11-05Automatic date update in version.inGDB Administrator1-1/+1
2024-11-04Automatic date update in version.inGDB Administrator1-1/+1