aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
22 hoursAutomatic date update in version.inGDB Administrator1-1/+1
46 hoursAutomatic date update in version.inGDB Administrator1-1/+1
3 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 daysAutomatic date update in version.inGDB Administrator1-1/+1
4 daysppc _bfd_clear_contentsAlan Modra1-29/+15
ppc32 isn't susceptible to the PR33223 segfault, but could hit a _bfd_clear_contents segfault with a carefully crafted invalid object. * elf32-ppc.c (ARRAY_SIZE): Define. (ppc_elf_howto_init): Use ARRAY_SIZE. (ppc_elf_reloc_name_lookup): Likewise. (ppc_elf_info_to_howto): Likewise, and consolidate error handling. (ppc_elf_check_relocs): Guard against segfaults caused by a NULL howto passed to _bfd_clear_contents. Use ARRAY_SIZE.
4 daysPR 33223 ppc64: segfault on unknown relocationAlan Modra1-19/+21
Bounds check accesses to ppc64_elf_howto_table and don't dereference a NULL howto. I think this catches all cases where that might happen. PR 33223 bfd/ * elf64-ppc.c (ppc64_elf_info_to_howto): Consolidate error handling. (ppc64_elf_check_relocs): Tidy error messages. (ppc64_elf_relocate_section): Don't segfault when attempting to report an unsupported relocation. Don't pass a NULL howto to _bfd_clear_contents. ld/ * testsuite/ld-powerpc/elfv2-2so.d: Adjust to suit error message change.
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 daysPR 33210 NULL pointer arithmetic in coffcode.hAlan Modra1-1/+3
Fix ubsan "runtime error: applying zero offset to null pointer".
9 daysAutomatic date update in version.inGDB Administrator1-1/+1
9 daysstrip: Properly handle LLVM IR bitcodeH.J. Lu2-11/+80
commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d Author: H.J. Lu <hjl.tools@gmail.com> Date: Sun May 4 05:12:46 2025 +0800 strip: Add GCC LTO IR support added "-R .gnu.lto_.*" to strip to remove all GCC LTO sections. When "-R .gnu.lto_.*" is used, the plugin target is ignored so that all LTO sections are stripped as the regular sections. It works for the slim GCC LTO IR since the GCC LTO IR is stored in the regular sections. When the plugin target is ignored, the GCC LTO IR can be recognized as the normal object files. But it doesn't work for the slim LLVM IR which is stored in a standalone file. 1. Add bfd_check_format_matches_lto and bfd_check_format_lto to take an argument, lto_sections_removed, to indicate if all LTO sections should be removed. 2. Update strip to always enable the plugin target so that the plugin target is enabled when checking for bfd_archive. 3. Update strip to ignore the plugin target for bfd_object when all LTO sections should be removed. If the object is unknown, copy it as an unknown file without any messages. 4. Treat the "-R .llvm.lto" strip option as removing all LTO sections. bfd/ PR binutils/33198 * format.c (bfd_check_format_lto): New function. (bfd_check_format): Call bfd_check_format_matches_lto. (bfd_check_format_matches): Renamed to ... (bfd_check_format_matches_lto): This. Add an argument, lto_sections_removed, to indicate if all LTO sections should be removed and don't match the plugin target if lto_sections_removed is true. (bfd_check_format_matches): Call bfd_check_format_matches_lto. * bfd-in2.h: Regenerated. binutils/ PR binutils/33198 * objcopy.c (copy_archive): Call bfd_check_format_lto, instead of bfd_check_format, and pass lto_sections_removed. Remove the non-fatal message on unknown element since it will be copied as an unknown file. (copy_file): Don't check lto_sections_removed when enabling LTO plugin in strip. (copy_file): Ignore the plugin target first if all LTO sections should be removed. Try with the plugin target next if ignoring the plugin target failed to match the format. (strip_main): Also set lto_sections_removed for -R .llvm.lto. * testsuite/binutils-all/x86-64/pr33198.c: New file. * testsuite/binutils-all/x86-64/x86-64.exp (run_pr33198_test): New. Run binutils/33198 tests. * testsuite/lib/binutils-common.exp (llvm_plug_opt): New. (CLANG_FOR_TARGET): New. Set to "clang" for native build if "clang -v" reports "clang version". Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
10 daysAutomatic date update in version.inGDB Administrator1-1/+1
11 daysAutomatic date update in version.inGDB Administrator1-1/+1
11 daysUpdated translations for various sub-directoriesNick Clifton2-3424/+3892
12 daysRISC-V: Don't allocate dynamic relocation if it's section was discardedNelson Chu1-0/+2
12 daysRISC-V: Fix the assert fail when linking discarded sections under -pie for gotNelson Chu1-40/+48
Considering the following case, % cat tmp.s .option pic .text .global _start _start: nop .section .discard.s, "ax" la x1, _start % cat tmp.ld OUTPUT_ARCH(riscv) ENTRY(_start) SECTIONS { /DISCARD/ : { *(.discard.*) } . = 0x10000; .text : { *(.text) } . = 0x20000; .got : { *(.got) *(.got.plt)} . = 0x30000; .data : { *(.data) *(.data.*) } } % riscv64-unknown-linux-gnu-as tmp.s -o tmp.o % riscv64-unknown-linux-gnu-ld -pie -Ttmp.ld tmp.o riscv64-unknown-linux-gnu-ld: BFD (GNU Binutils) 2.44.50.20250624 assertion fail binutils-gdb/bfd/elfnn-riscv.c:3638 This happens when pie and the input sections, which refers to the global symbol by got, are all discarded. Since referenced sections are all discarded, we won't go into relocate_section for those sections, the got entry also won't be initialized. Therefore, we will get assert fail when adding the RELATIVE reloc in the finish_dynamic_symbol. After seeing other target codes, there are two root causes as follows, 1. risc-v may call bfd_elf_link_record_dynamic_symbol in the allocate_dynrelocs for not only undefweak symbols. 2. risc-v is missing the code to add RELATIVE to R_RISCV_GOT entries in the relocate_section if a symbol is not dynamic and is not undefined weak under pic and pie. If we call bfd_elf_link_record_dynamic_symbol, then the global symbol will be forced to dynamic, so the h->dynindx will forced to be a number rather than -1, even it should be -1. Once h->dynindx != -1 and pic/pie, it will go into finish_dynamic_symbol and insert RELATIVE/64 relocs for the got entry; For the above case there are two issues, 1. The global symbol _start is forced to be dynamic in the allocate_dynrelocs. when pie and all the referenced section are discarded, it won't go into relocate_section to initialize the got entry, so it will cause assert fail when adding RELATIVE reloc in the finish_dynamic_symbol. The assert fail represents another problem - if we don't initialize the got entry in the relocate_section under pie, which means we don't need to go into the finish_dynamic_symbol and don't need a RELATIVE reloc for the got entry, it should be NONE reloc. 2. Without linking any discarded section, it originally forces every RELATIVE relocs added for every got by the finish_dynamic_symbol. Even The final result looks correct under pie (genearte a RELATIVE reloc for got entry), not sure if it may cause other problems for some special cases, excpet the above one. Therefore, this patch try to fix the above assert fail, and also clarify the behavior of the allocate_dynrelocs which should only call bfd_elf_link_record_dynamic_symbol for undefweak symbols, and add the missing code to generate RELATIVE reloc to R_RISCV_GOT entries in the relocate_section if a symbol is not dynamic and is not undefined weak under pic and pie. Passed the gcc/binutils regressions of riscv-gnu-toolchain at least.
12 daysRISC-V: Indent and reorder backend define functions for bfd/elfnn-riscv.cNelson Chu1-17/+24
12 daysAutomatic date update in version.inGDB Administrator1-1/+1
12 daysRemove NaCl/arm target supportH.J. Lu11-700/+19
NaCl has been deprecated: https://developer.chrome.com/docs/native-client/migration/ It is now in the process of being removed from llvm: https://github.com/llvm/llvm-project/pull/133661 Remove NaCl/arm target support from bfd, binutils, gas and ld. bfd/ * Makefile.am (BFD32_BACKENDS): Remove elf-nacl.lo. (BFD32_BACKENDS_CFILES): Remove elf-nacl.c. (SOURCE_HFILES): Remove elf-nacl.h. * Makefile.in: Regenerated. * config.bfd: Add *-*-nacl* to obsolete targets. Remove *-*-nacl* targets. * configure.ac: Remove nacl target vectors. * elf-bfd.h (elf_target_os): Remove is_nacl. * elf-nacl.c: Removed. * elf-nacl.h: Likewise. * elf32-arm.c: Don't include "elf-nacl.h". (elf32_arm_nacl_plt0_entry): Removed. (elf32_arm_nacl_plt_entry): Likewise. (elf32_arm_stub_long_branch_arm_nacl): Likewise. (elf32_arm_stub_long_branch_arm_nacl_pic): Likewise. (arm_movw_immediate): Likewise. (arm_movt_immediate): Likewise. (arm_nacl_put_plt0): Likewise. (elf32_arm_nacl_link_hash_table_create): Likewise. (elf32_arm_nacl_modify_segment_map): Likewise. (elf32_arm_nacl_final_write_processing): Likewise. (elf32_arm_nacl_plt_sym_val): Likewise. (elf32_arm_stub_cmse_branch_thumb_only): Remove long_branch_arm_nacl and long_branch_arm_nacl_pic entries. (arm_type_of_stub): Updated. (elf32_arm_create_or_find_stub_sec): Likewise. (arm_stub_required_alignment): Likewise. (elf32_arm_allocate_plt_entry): Likewise. (elf32_arm_populate_plt_entry): Likewise. (elf32_arm_finish_dynamic_sections): Likewise. (elf32_arm_output_plt_map_1): Likewise. (elf32_arm_output_arch_local_syms): Likewise. Remove elf32_arm_nacl_bed. * targets.c: Remove NaCl target vectors. * bfd-in2.h: Regenerated. * configure: Likewise. * po/SRC-POTFILES.in: Likewise. binutils/ * NEWS: Mention NaCl target support removal. * testsuite/lib/binutils-common.exp: Remove NaCl target support. gas/ * NEWS: Mention NaCl target support removal. * configure.tgt: Likewise. * config/tc-arm.c: Remove NaCl target support. * testsuite/gas/arm/any-armv8m.d: Likewise. * testsuite/gas/arm/any-cmse-main.d: Likewise. * testsuite/gas/arm/any-cmse.d: Likewise. * testsuite/gas/arm/any-idiv.d: Likewise. * testsuite/gas/arm/arch4t-eabi.d: Likewise. * testsuite/gas/arm/arch4t.d: Likewise. * testsuite/gas/arm/armv8m.base-idiv.d: Likewise. * testsuite/gas/arm/armv9-a_arch.d: Likewise. * testsuite/gas/arm/attr-abi-hardfp-use-0.d: Likewise. * testsuite/gas/arm/attr-abi-hardfp-use-1.d: Likewise. * testsuite/gas/arm/attr-abi-hardfp-use-2.d: Likewise. * testsuite/gas/arm/attr-abi-hardfp-use-3.d: Likewise. * testsuite/gas/arm/attr-any-armv4t.d: Likewise. * testsuite/gas/arm/attr-any-thumbv6.d: Likewise. * testsuite/gas/arm/attr-arch-assumption.d: Likewise. * testsuite/gas/arm/attr-cpu-directive.d: Likewise. * testsuite/gas/arm/attr-default.d: Likewise. * testsuite/gas/arm/attr-empty-string.d: Likewise. * testsuite/gas/arm/attr-ext-fpv5-d16.d: Likewise. * testsuite/gas/arm/attr-ext-fpv5.d: Likewise. * testsuite/gas/arm/attr-ext-idiv.d: Likewise. * testsuite/gas/arm/attr-ext-mp.d: Likewise. * testsuite/gas/arm/attr-ext-neon-fp16.d: Likewise. * testsuite/gas/arm/attr-ext-neon-vfpv3.d: Likewise. * testsuite/gas/arm/attr-ext-neon-vfpv4.d: Likewise. * testsuite/gas/arm/attr-ext-sec.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3-d16-fp16.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3-d16.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3-fp16.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3xd-fp.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv3xd.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv4-d16.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv4-sp-d16.d: Likewise. * testsuite/gas/arm/attr-ext-vfpv4.d: Likewise. * testsuite/gas/arm/attr-march-all.d: Likewise. * testsuite/gas/arm/attr-march-armv1.d: Likewise. * testsuite/gas/arm/attr-march-armv2.d: Likewise. * testsuite/gas/arm/attr-march-armv2a.d: Likewise. * testsuite/gas/arm/attr-march-armv2s.d: Likewise. * testsuite/gas/arm/attr-march-armv3.d: Likewise. * testsuite/gas/arm/attr-march-armv3m.d: Likewise. * testsuite/gas/arm/attr-march-armv4.d: Likewise. * testsuite/gas/arm/attr-march-armv4t.d: Likewise. * testsuite/gas/arm/attr-march-armv4txm.d: Likewise. * testsuite/gas/arm/attr-march-armv4xm.d: Likewise. * testsuite/gas/arm/attr-march-armv5.d: Likewise. * testsuite/gas/arm/attr-march-armv5t.d: Likewise. * testsuite/gas/arm/attr-march-armv5te.d: Likewise. * testsuite/gas/arm/attr-march-armv5tej.d: Likewise. * testsuite/gas/arm/attr-march-armv5texp.d: Likewise. * testsuite/gas/arm/attr-march-armv5txm.d: Likewise. * testsuite/gas/arm/attr-march-armv6-m+os.d: Likewise. * testsuite/gas/arm/attr-march-armv6-m.d: Likewise. * testsuite/gas/arm/attr-march-armv6.d: Likewise. * testsuite/gas/arm/attr-march-armv6j.d: Likewise. * testsuite/gas/arm/attr-march-armv6k+sec.d: Likewise. * testsuite/gas/arm/attr-march-armv6k.d: Likewise. * testsuite/gas/arm/attr-march-armv6kt2.d: Likewise. * testsuite/gas/arm/attr-march-armv6kz.d: Likewise. * testsuite/gas/arm/attr-march-armv6kzt2.d: Likewise. * testsuite/gas/arm/attr-march-armv6s-m.d: Likewise. * testsuite/gas/arm/attr-march-armv6t2.d: Likewise. * testsuite/gas/arm/attr-march-armv6z.d: Likewise. * testsuite/gas/arm/attr-march-armv6zk.d: Likewise. * testsuite/gas/arm/attr-march-armv6zkt2.d: Likewise. * testsuite/gas/arm/attr-march-armv6zt2.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a+idiv.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a+mp.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a+sec+virt.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a+sec.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a+virt.d: Likewise. * testsuite/gas/arm/attr-march-armv7-a.d: Likewise. * testsuite/gas/arm/attr-march-armv7-m.d: Likewise. * testsuite/gas/arm/attr-march-armv7-r+mp.d: Likewise. * testsuite/gas/arm/attr-march-armv7-r.d: Likewise. * testsuite/gas/arm/attr-march-armv7.d: Likewise. * testsuite/gas/arm/attr-march-armv7a.d: Likewise. * testsuite/gas/arm/attr-march-armv7em.d: Likewise. * testsuite/gas/arm/attr-march-armv7m.d: Likewise. * testsuite/gas/arm/attr-march-armv7r.d: Likewise. * testsuite/gas/arm/attr-march-armv7ve.d: Likewise. * testsuite/gas/arm/attr-march-armv8-a+crypto.d: Likewise. * testsuite/gas/arm/attr-march-armv8-a+fp.d: Likewise. * testsuite/gas/arm/attr-march-armv8-a+rdma.d: Likewise. * testsuite/gas/arm/attr-march-armv8-a+simd.d: Likewise. * testsuite/gas/arm/attr-march-armv8-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8-r+crypto.d: Likewise. * testsuite/gas/arm/attr-march-armv8-r+fp.d: Likewise. * testsuite/gas/arm/attr-march-armv8-r+simd.d: Likewise. * testsuite/gas/arm/attr-march-armv8-r.d: Likewise. * testsuite/gas/arm/attr-march-armv8_1-a+simd.d: Likewise. * testsuite/gas/arm/attr-march-armv8_1-m.main.d: Likewise. * testsuite/gas/arm/attr-march-armv8_4-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8_5-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8_6-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8_7-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8_8-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8_9-a.d: Likewise. * testsuite/gas/arm/attr-march-armv9_1-a.d: Likewise. * testsuite/gas/arm/attr-march-armv9_2-a.d: Likewise. * testsuite/gas/arm/attr-march-armv9_3-a.d: Likewise. * testsuite/gas/arm/attr-march-armv9_4-a.d: Likewise. * testsuite/gas/arm/attr-march-armv9_5-a.d: Likewise. * testsuite/gas/arm/attr-march-armv8m.base.d: Likewise. * testsuite/gas/arm/attr-march-armv8m.main.d: Likewise. * testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise. * testsuite/gas/arm/attr-march-iwmmxt.d: Likewise. * testsuite/gas/arm/attr-march-iwmmxt2.d: Likewise. * testsuite/gas/arm/attr-march-xscale.d: Likewise. * testsuite/gas/arm/attr-mcpu.d: Likewise. * testsuite/gas/arm/attr-mfpu-arm1020e.d: Likewise. * testsuite/gas/arm/attr-mfpu-arm1020t.d: Likewise. * testsuite/gas/arm/attr-mfpu-arm1136jf-s.d: Likewise. * testsuite/gas/arm/attr-mfpu-arm1136jfs.d: Likewise. * testsuite/gas/arm/attr-mfpu-neon-fp16.d: Likewise. * testsuite/gas/arm/attr-mfpu-neon.d: Likewise. * testsuite/gas/arm/attr-mfpu-softvfp+vfp.d: Likewise. * testsuite/gas/arm/attr-mfpu-softvfp.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfp.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfp10-r0.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfp10.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfp3.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfp9.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpv2.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpv3-d16.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpv3.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpv4-d16.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpv4.d: Likewise. * testsuite/gas/arm/attr-mfpu-vfpxd.d: Likewise. * testsuite/gas/arm/attr-names.d: Likewise. * testsuite/gas/arm/attr-non-null-terminated-string.d: Likewise. * testsuite/gas/arm/attr-order.d: Likewise. * testsuite/gas/arm/attr-override-cpu-directive.d: Likewise. * testsuite/gas/arm/attr-override-mcpu.d: Likewise. * testsuite/gas/arm/bl-local-2.d: Likewise. * testsuite/gas/arm/bl-local-v4t.d: Likewise. * testsuite/gas/arm/blx-local.d: Likewise. * testsuite/gas/arm/branch-reloc.d: Likewise. * testsuite/gas/arm/directives.d: Likewise. * testsuite/gas/arm/got_prel.d: Likewise. * testsuite/gas/arm/mapdir.d: Likewise. * testsuite/gas/arm/mapmisc.d: Likewise. * testsuite/gas/arm/mapsecs.d: Likewise. * testsuite/gas/arm/mapshort-eabi.d: Likewise. * testsuite/gas/arm/mov-highregs-any.d: Likewise. * testsuite/gas/arm/mov-lowregs-any.d: Likewise. * testsuite/gas/arm/note-march-armv2.d: Likewise. * testsuite/gas/arm/note-march-armv2a.d: Likewise. * testsuite/gas/arm/note-march-armv3.d: Likewise. * testsuite/gas/arm/note-march-armv3m.d: Likewise. * testsuite/gas/arm/note-march-armv4.d: Likewise. * testsuite/gas/arm/note-march-armv4t.d: Likewise. * testsuite/gas/arm/note-march-armv5.d: Likewise. * testsuite/gas/arm/note-march-armv5t.d: Likewise. * testsuite/gas/arm/note-march-armv5te.d: Likewise. * testsuite/gas/arm/note-march-iwmmxt.d: Likewise. * testsuite/gas/arm/note-march-iwmmxt2.d: Likewise. * testsuite/gas/arm/note-march-xscale.d: Likewise. * testsuite/gas/arm/pr12198-1.d: Likewise. * testsuite/gas/arm/pr12198-2.d: Likewise. * testsuite/gas/arm/thumb-eabi.d: Likewise. * testsuite/gas/arm/thumb.d: Likewise. * testsuite/gas/arm/thumbrel.d: Likewise. * config/te-nacl.h: Removed. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Remove earmelf_nacl.c and and earmelfb_nacl.c. Remove NaCl dep files. * NEWS: Mention NaCl target support removal. * configure.tgt: Remove NaCl target support. * Makefile.in: Regenerated. * configure: Likewise. * po/BLD-POTFILES.in: Likewise. * emulparams/armelf_nacl.sh: Removed. * emulparams/armelfb_nacl.sh: Likewise. * emulparams/elf_nacl.sh: Likewise. * testsuite/ld-arm/farcall-arm-nacl-pic.d: Likewise. * testsuite/ld-arm/farcall-arm-nacl.d: Likewise. * testsuite/ld-arm/farcall-data-nacl.d: Likewise. * testsuite/ld-arm/farcall-thumb2-purecode-consecutive-veneer.d: Adjusted. * testsuite/ld-arm/arm-elf.exp: Remove NaCl target support. * testsuite/ld-arm/cortex-a8-far.d: Likewise. * testsuite/ld-arm/non-contiguous-arm3.d: Likewise. * testsuite/ld-arm/non-contiguous-arm6.d: Likewise. * testsuite/ld-elf/binutils.exp: Likewise. * testsuite/ld-elf/build-id.exp: Likewise. * testsuite/ld-elf/ehdr_start-missing.d: Likewise. * testsuite/ld-elf/ehdr_start-shared.d: Likewise. * testsuite/ld-elf/ehdr_start-userdef.d: Likewise. * testsuite/ld-elf/ehdr_start-weak.d: Likewise. * testsuite/ld-elf/ehdr_start.d: Likewise. * testsuite/ld-elf/elf.exp: Likewise. * testsuite/ld-elf/export-class.exp: Likewise. * testsuite/ld-elf/fatal-warnings-1a.d: Likewise. * testsuite/ld-elf/fatal-warnings-1b.d: Likewise. * testsuite/ld-elf/orphan-region.d: Likewise. * testsuite/ld-elf/package-note.exp: Likewise. * testsuite/ld-elf/pr16322.d: Likewise. * testsuite/ld-elf/pr16498a.d: Likewise. * testsuite/ld-elf/pr16498b.d: Likewise. * testsuite/ld-elf/pr19162.d: Likewise. * testsuite/ld-elf/pr22269a.d: Likewise. * testsuite/ld-elf/pr22269b.d: Likewise. * testsuite/ld-elf/pr22393-1a.d: Likewise. * testsuite/ld-elf/pr22393-1b.d: Likewise. * testsuite/ld-elf/pr22393-1c.d: Likewise. * testsuite/ld-elf/pr22393-1d.d: Likewise. * testsuite/ld-elf/pr22393-1e.d: Likewise. * testsuite/ld-elf/pr22393-1f.d: Likewise. * testsuite/ld-elf/pr22393-2a.rd: Likewise. * testsuite/ld-elf/pr22393-2b.rd: Likewise. * testsuite/ld-elf/pr23900-1-32.rd: Likewise. * testsuite/ld-elf/pr23900-1-64.rd: Likewise. * testsuite/ld-elf/pr23900-1.d: Likewise. * testsuite/ld-elf/pr23900-2a.d: Likewise. * testsuite/ld-elf/pr23900-2b.d: Likewise. * testsuite/ld-elf/pr30508.d: Likewise. * testsuite/ld-elf/pr30907-1.d: Likewise. * testsuite/ld-elf/pr30907-2.d: Likewise. * testsuite/ld-elf/pr32341.d: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elf/tls.exp: Likewise. * testsuite/ld-elf/tls_common.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-ifunc/binutils.exp: Likewise. * testsuite/ld-pie/pie.exp: Likewise. * testsuite/ld-plugin/lto-binutils.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-scripts/rgn-at3.d: Likewise. * testsuite/ld-shared/shared.exp: Likewise. * testsuite/ld-size/size.exp: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
13 daysAutomatic date update in version.inGDB Administrator1-1/+1
14 daysAutomatic date update in version.inGDB Administrator1-1/+1
2025-07-19Automatic date update in version.inGDB Administrator1-1/+1
2025-07-19RELOC_AGAINST_DISCARDED_SECTION zero size reloc sectionsAlan Modra6-49/+23
For some reason the initial implementation (commit 0672748ac053) of this macro didn't allow discarding of all relocs in a section, perhaps because doing so would require a testsuite change. This patch allows zero size relocation sections to result, and adjusts the testsuite. i386, x86_64, ppc and ppc64 code that avoids a memmove is also changed to allow zero size reloc sections, and arc fixed to actually adjust the reloc section header.
2025-07-18Fix unused variable warningsAlan Modra8-23/+13
2025-07-18visium: use RELOC_AGAINST_DISCARDED_SECTIONAlan Modra1-11/+3
The initial visium support added in commit d924db559be9 didn't make use of RELOC_AGAINST_DISCARDED_SECTION, and so lacked code to remove relocations in debug sections.
2025-07-18METAG_RELOC_AGAINST_DISCARDED_SECTIONAlan Modra60-106/+124
Delete this macro which duplicates RELOC_AGAINST_DISCARDED_SECTION, and instead add an rnone parameter to the standard version.
2025-07-18Automatic date update in version.inGDB Administrator1-1/+1
2025-07-17bfd: drop unused elt_noSam James1-2/+1
GCC trunk recently had improvements to its -Wunused-but-set-variable which picked up that elt_no isn't used at all in the end. * archive.c (_bfd_compute_and_write_armap): Drop unused elt_no.
2025-07-17Remove sframe relocs against discarded sectionsAlan Modra1-3/+6
Commit d7f343eaad3f testsuite change resulted in a regression for s390x-linux. This extends the x86_64 fix to other targets. PR ld/33156 * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Remove .sframe relocs too.
2025-07-17Automatic date update in version.inGDB Administrator1-1/+1
2025-07-15x86-64: Remove sframe relocs against discarded sectionsH.J. Lu1-3/+7
Since unlike eh_frame editing code, sframe editing code keeps R_X86_64_NONE reloc as is, its r_offset is wrong, we must not generate R_X86_64_NONE reloc in sframe section against discarded sections for "ld -r". bfd/ PR ld/33156 * elf64-x86-64.c (elf_x86_64_relocate_section): Also remove sframe relocations against discarded sections for "ld -r". ld/ PR ld/33156 * testsuite/ld-elf/eh-group.exp (as_gsframe): New. Assemble eh-group.o with $as_gsframe. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-16Automatic date update in version.inGDB Administrator1-1/+1
2025-07-15Updated translations for various sub-directoriesNick Clifton3-5162/+6469
2025-07-15Only parse attributes in ELF sections with the SHT_GNU_ATTRIBUTES type if ↵Rainer Orth3-5/+13
the OS is not Solaris. Set the is_solaris flag for Sparc solaris PR 33153
2025-07-15Automatic date update in version.inGDB Administrator1-1/+1
2025-07-15sframe: Allow input R_*_NONE relocationsH.J. Lu1-1/+8
"ld -r" generates R_*_NONE relocations in sframe section if input relocations in sframe section are against discarded section. Allow input R_*_NONE relocations if there are more relocation entries than SFrame entries, instead of assuming number of SFrame entries == number of relocation entries. bfd/ PR ld/33127 * elf-sframe.c (sframe_decoder_init_func_bfdinfo): Allow input R_*_NONE relocations if there are more relocation entries than SFrame entries. ld/ PR ld/33127 * testsuite/ld-x86-64/sframe-reloc-2a.s: New file. * testsuite/ld-x86-64/sframe-reloc-2b.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run PR ld/33127 tests. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-07-14s390x sframe regressionsAlan Modra1-0/+2
Commit 6ab3f09a682a resulted in regressions. s390x-linux-gnu FAIL: SFrame simple link s390x-linux-gnu FAIL: SFrame for plt0 and pltN Commit 939eb467b21d exposed the problem further. s390x-linux-gnu FAIL: LTO 4a s390x-linux-gnu FAIL: LTO 4c s390x-linux-gnu FAIL: LTO 4d * elf64-s390.c (elf_s390_create_dynamic_sections): Set plt_sframe ELF section type. Reviewed-by: Jens Remus <jremus@linux.ibm.com>
2025-07-14Delete AM_PO_SUBDIRS invocationAlan Modra1-3/+1
These aren't needed since commit 862776f26a59.
2025-07-14Automatic date update in version.inGDB Administrator1-1/+1
2025-07-13Update version number on mainlineNick Clifton3-1398/+1498
2025-07-13Add markers for 2.45 branchNick Clifton1-0/+4
2025-07-13Automatic date update in version.inGDB Administrator1-1/+1
2025-07-12ld/aarch64elf: add support for DT_AARCH64_MEMTAG_STACK dynamic tagIndu Bhagat2-0/+9
Add new command line option -z memtag-stack for aarch64 elf. This option instructs the linker to generate the necessary dynamic tag DT_AARCH64_MEMTAG_STACK, which the dynamic loader can then use to protect the stack memory with PROT_MTE. Linker issues an 'unrecognized option' error when -z memtag-stack is specified for non-aarch64 based emulations. readelf displays the dynamic tag when present: $ readelf -d <exectutable> Dynamic section at offset 0xfdd8 contains XX entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x400520 0x000000000000000d (FINI) 0x400b64 0x0000000000000019 (INIT_ARRAY) 0x41fdc8 ... ... ... 0x000000007000000c (AARCH64_MEMTAG_STACK) 0x1 ... ... ... ChangeLog: * bfd/elfnn-aarch64.c (elfNN_aarch64_late_size_sections): Emit DT_AARCH64_MEMTAG_STACK dynamic tag. * bfd/elfxx-aarch64.h (struct aarch64_memtag_opts): Add new member for tracking whether stack access uses MTE insns. * binutils/readelf.c (get_aarch64_dynamic_type): Handle DT_AARCH64_MEMTAG_STACK. * ld/emultempl/aarch64elf.em: Add new command line option. * ld/ld.texi: Add documentation for -z memtag-stack. * ld/testsuite/ld-aarch64/aarch64-elf.exp: Add new test. * ld/testsuite/ld-aarch64/dt-memtag-stack.d: New test. include/ChangeLog: * elf/aarch64.h (DT_AARCH64_MEMTAG_STACK): New definition.
2025-07-12ld/aarch64elf: add support for DT_AARCH64_MEMTAG_MODE dynamic tagIndu Bhagat2-3/+37
Add new command line option -z memtag-mode=<mode> to aarch64 elf, where <mode> can be one of none, sync, or async. For mode of sync or async, a DT_AARCH64_MEMTAG_MODE dynamic tag with a value of 0 or 1 respectively is emitted. readelf displays the dynamic tag when present: $ readelf -d <exectutable> Dynamic section at offset 0xfdd8 contains XX entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000c (INIT) 0x400520 0x000000000000000d (FINI) 0x400b64 0x0000000000000019 (INIT_ARRAY) 0x41fdc8 ... ... ... 0x0000000070000009 (AARCH64_MEMTAG_MODE) 0x1 ... ... ... Note that this patch doesn't add support for the "asymm" MTE mode, which is an Armv8.7 extension. ChangeLog: * bfd/elfnn-aarch64.c (struct elf_aarch64_link_hash_table): Add new member for memtag properties. (bfd_elfNN_aarch64_set_options): New argument to pass memtag properties. (elfNN_aarch64_late_size_sections): Emit DT_AARCH64_MEMTAG_MODE dynamic tag. * bfd/elfxx-aarch64.h: New definition for the various memtag properties. * binutils/readelf.c (get_aarch64_dynamic_type): Handle DT_AARCH64_MEMTAG_MODE. * ld/emultempl/aarch64elf.em: Likewise. * ld/ld.texi: Add documentation for the new option -z memtag-mode. * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test. * ld/testsuite/ld-aarch64/dt-memtag.d: New test. * ld/testsuite/ld-aarch64/dt-memtag-mode.s: New test. include/ChangeLog: * elf/aarch64.h (DT_AARCH64_MEMTAG_MODE): New definition.
2025-07-12ld: aarch64: make EH Frame parsing aware of augmentation char 'G'Indu Bhagat1-0/+1
As per the DWARF for the Arm 64-bit Architecture (AArch64) specification, the augmentation char 'G' indicates that associated frames may modify MTE tags on the stack space they use. Add knowledge of the 'G' augmentation char to the EH Frame parsing code. ChangeLog: * bfd/elf-eh-frame.c (_bfd_elf_parse_eh_frame): Accommodate augmentation char 'G'. * ld/testsuite/ld-aarch64/aarch64-elf.exp: New test. * ld/testsuite/ld-aarch64/mte-tagged-frame-bar.s: New test. * ld/testsuite/ld-aarch64/mte-tagged-frame-foo.s: New test. * ld/testsuite/ld-aarch64/mte-tagged-frame.d: New test.
2025-07-12bfd: fix recognition of arch-specific augmentationsJose E. Marchesi1-0/+3
This patch fixes _bfd_elf_parse_eh_frame so it will not recognize machine/architecture specific augmentation characters in EH Frame CFIs. Regtested in x86_64-linux-gnu and aarch64-linux-gnu. bfd/ChangeLog: * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Recognize augmentation 'B' only if targetting aarch64.
2025-07-11gas: elf: binutils: add new section type SHT_GNU_SFRAMEIndu Bhagat4-6/+20
So far, SFrame sections were of type SHT_PROGBITS. As per ELF specification, SHT_PROGBITS indicates that the section holds information defined by the program, whose format and meaning are determined solely by the program. On the linker side, SHT_PROGBITS should be reserved for the simple "cat contents after applying relocs" semantics. Currently, the only way to know that a section contains SFrame stack trace data is if consumer checks for section name. Such a check for section name is not quite conformant to ELF principles. Some of this was discussed here https://sourceware.org/pipermail/binutils/2025-March/140181.html With this change, the SFrame sections generated by gas, ld will have section type set to SHT_GNU_SFRAME. The new section type is defined in the SHT_LOOS/SHT_HIOS space. The SFrame parsing routine _bfd_elf_parse_sframe () now admits sections only when the the section type is SHT_GNU_SFRAME. No special handling / validation is done at the moment for the case of manual creation of SFrame sections via obj_elf_section (). Add function level comments for now to add a note about this. Although the default handling for (sh_type >= SHT_LOOS && sh_type <= SHT_HIOS) is sufficient when SHT_GNU_SFRAME is in that range, it makes sense to add it as a case of its own. bfd/ * elf-sframe.c (_bfd_elf_parse_sframe): Check if section type is SHT_GNU_SFRAME. (_bfd_elf_set_section_sframe): Set SHT_GNU_SFRAME for output SFrame section. * elflink.c (obj_elf_section): Use section type for check instead of section name. * elfxx-x86.c: Set SHT_GNU_SFRAME for SFrame sections for .plt* sections. * elf.c (bfd_section_from_shdr): Add case for SHT_GNU_SFRAME. binutils/ * readelf.c (get_os_specific_section_type_name): Add SHT_GNU_SFRAME. gas/ * NEWS: Announce emitted SFrame sections have SHT_GNU_SFRAME set. * config/obj-elf.c (obj_elf_attach_to_group): Add comments to indicate no special handling for SFrame yet. * dw2gencfi.c (cfi_finish): Set SHT_GNU_SFRAME for emitted SFrame section. ld/ * NEWS: Announce emitted SFrame sections have SHT_GNU_SFRAME set. gas/testsuite/ * gas/cfi-sframe/cfi-sframe.exp: Add new test. * gas/cfi-sframe/cfi-sframe-common-1b.d: New test. * gas/cfi-sframe/cfi-sframe-common-1b.s: New test. include/ * elf/common.h (SHT_GNU_SFRAME): Add new section type for SFrame stack trace information. libsframe/doc/ * sframe-spec.texi: Add expected ELF section type.
2025-07-12LoongArch: Un-skip cross-segment alignment compensation during relax pass 2WANG Xuerui1-64/+44
It turned out wrong to skip compensating for segment alignment if the current section is closed for deletion, as my recent system update with binutils trunk revealed link failures of many high-profile packages such as ffmpeg, numpy and wxGTK -- the dreaded "relocation truncated to fit" errors regarding improperly produced R_LARCH_PCREL20_S2. As it's near 2.45 branching time, revert the problematic change and XFAIL the original test case for now. Suggested-by: Xi Ruoyao <xry111@xry111.site> Signed-off-by: WANG Xuerui <git@xen0n.name>