# DP: updates from the binutils-2.45 branch

# git diff 2bc7af1ff7732451b6a7b09462a815c3284f9613 f3723832ffdd77f7b387d2c26d73eecf0321b3bd

diff --git a/bfd/archive.c b/bfd/archive.c
index 8e20554d781..c61d4b12658 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2299,7 +2299,6 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
 {
   char *first_name = NULL;
   bfd *current;
-  file_ptr elt_no = 0;
   struct orl *map = NULL;
   unsigned int orl_max = 1024;		/* Fine initial default.  */
   unsigned int orl_count = 0;
@@ -2334,7 +2333,7 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
   /* Map over each element.  */
   for (current = arch->archive_head;
        current != NULL;
-       current = current->archive_next, elt_no++)
+       current = current->archive_next)
     {
       if (bfd_check_format (current, bfd_object)
 	  && (bfd_get_file_flags (current) & HAS_SYMS) != 0)
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 8c4d4f7bf73..1213a159358 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -801,7 +801,6 @@ mips_relocate_section (bfd *output_bfd,
   bool gp_undefined;
   struct external_reloc *ext_rel;
   struct external_reloc *ext_rel_end;
-  unsigned int i;
   bool got_lo;
   struct internal_reloc lo_int_rel;
   bfd_size_type amt;
@@ -861,7 +860,7 @@ mips_relocate_section (bfd *output_bfd,
 
   ext_rel = (struct external_reloc *) external_relocs;
   ext_rel_end = ext_rel + input_section->reloc_count;
-  for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
+  for (; ext_rel < ext_rel_end; ext_rel++)
     {
       struct internal_reloc int_rel;
       bool use_lo = false;
diff --git a/bfd/configure b/bfd/configure
index ec09f5bc834..86561b30ac4 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for bfd 2.45.
+# Generated by GNU Autoconf 2.69 for bfd 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='bfd'
 PACKAGE_TARNAME='bfd'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='bfd 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='bfd 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1409,7 +1409,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures bfd 2.45 to adapt to many kinds of systems.
+\`configure' configures bfd 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1480,7 +1480,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of bfd 2.45:";;
+     short | recursive ) echo "Configuration of bfd 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1625,7 +1625,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-bfd configure 2.45
+bfd configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2219,7 +2219,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by bfd $as_me 2.45, which was
+It was created by bfd $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3202,7 +3202,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='bfd'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17754,7 +17754,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by bfd $as_me 2.45, which was
+This file was extended by bfd $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17820,7 +17820,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-bfd config.status 2.45
+bfd config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/bfd/development.sh b/bfd/development.sh
index 8b004da7d52..b8014261bfb 100644
--- a/bfd/development.sh
+++ b/bfd/development.sh
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Controls whether to enable development-mode features by default.
-development=false
+development=true
 
 # Indicate whether this is a release branch.
 experimental=false
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index c913f2b4c7d..a8fca76eb09 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -6527,16 +6527,15 @@ elf32_arm_size_stubs (bfd *output_bfd,
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       asection *stub_sec;
       enum elf32_arm_stub_type stub_type;
       bool stub_changed = false;
       unsigned prev_num_a8_fixes = num_a8_fixes;
 
       num_a8_fixes = 0;
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
 	   input_bfd != NULL;
-	   input_bfd = input_bfd->link.next, bfd_indx++)
+	   input_bfd = input_bfd->link.next)
 	{
 	  Elf_Internal_Shdr *symtab_hdr;
 	  asection *section;
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 7ac95a0634e..3cb554a717d 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1376,7 +1376,6 @@ bfin_relocate_section (bfd * output_bfd,
   asection *sgot;
   Elf_Internal_Rela *rel;
   Elf_Internal_Rela *relend;
-  int i = 0;
 
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
@@ -1387,7 +1386,7 @@ bfin_relocate_section (bfd * output_bfd,
 
   rel = relocs;
   relend = relocs + input_section->reloc_count;
-  for (; rel < relend; rel++, i++)
+  for (; rel < relend; rel++)
     {
       int r_type;
       reloc_howto_type *howto;
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 47a63895b55..3f55e7cbbac 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3446,13 +3446,12 @@ elf32_csky_size_stubs (bfd *output_bfd,
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       asection *stub_sec;
       bool stub_changed = false;
 
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
 	   input_bfd != NULL;
-	   input_bfd = input_bfd->link.next, bfd_indx++)
+	   input_bfd = input_bfd->link.next)
 	{
 	  Elf_Internal_Shdr *symtab_hdr;
 	  asection *section;
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 57c37c53074..db7ed465779 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -1765,7 +1765,6 @@ microblaze_elf_relax_section (bfd *abfd,
   Elf_Internal_Rela *irel, *irelend;
   bfd_byte *contents = NULL;
   bfd_byte *free_contents = NULL;
-  int rel_count;
   unsigned int shndx;
   size_t i, sym_index;
   asection *o;
@@ -1818,8 +1817,7 @@ microblaze_elf_relax_section (bfd *abfd,
     goto error_return;
 
   irelend = internal_relocs + sec->reloc_count;
-  rel_count = 0;
-  for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+  for (irel = internal_relocs; irel < irelend; irel++)
     {
       bfd_vma symval;
       if ((ELF32_R_TYPE (irel->r_info) != (int) R_MICROBLAZE_64_PCREL)
@@ -1935,10 +1933,9 @@ microblaze_elf_relax_section (bfd *abfd,
   if (sdata->relax_count > 0)
     {
       shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
-      rel_count = 0;
       sdata->relax[sdata->relax_count].addr = sec->size;
 
-      for (irel = internal_relocs; irel < irelend; irel++, rel_count++)
+      for (irel = internal_relocs; irel < irelend; irel++)
 	{
 	  bfd_vma nraddr;
 
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 3627b30af9c..bcd7c42e300 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4344,7 +4344,6 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       Elf_Internal_Shdr *symtab_hdr;
       asection *sgot;
       char *local_tls_type;
-      unsigned long symndx;
       bfd_vma *local_tlsdesc_gotent;
 
       if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
@@ -4386,8 +4385,8 @@ nds32_elf_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       sgot = elf_hash_table (info)->sgot;
       local_tls_type = elf32_nds32_local_got_tls_type (ibfd);
       local_tlsdesc_gotent = elf32_nds32_local_tlsdesc_gotent (ibfd);
-      for (symndx = 0; local_got < end_local_got;
-	   ++local_got, ++local_tls_type, ++local_tlsdesc_gotent, ++symndx)
+      for (; local_got < end_local_got;
+	   ++local_got, ++local_tls_type, ++local_tlsdesc_gotent)
 	{
 	  if (*local_got > 0)
 	    {
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 3e768dca8d6..00c1c32ffd2 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -13819,15 +13819,14 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
   while (1)
     {
       bfd *input_bfd;
-      unsigned int bfd_indx;
       struct map_stub *group;
 
       htab->stub_iteration += 1;
       htab->relr_count = 0;
 
-      for (input_bfd = info->input_bfds, bfd_indx = 0;
+      for (input_bfd = info->input_bfds;
 	   input_bfd != NULL;
-	   input_bfd = input_bfd->link.next, bfd_indx++)
+	   input_bfd = input_bfd->link.next)
 	{
 	  Elf_Internal_Shdr *symtab_hdr;
 	  asection *section;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 9e98215d638..e86f0280c2a 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -8464,10 +8464,9 @@ elfNN_aarch64_modify_headers (bfd *abfd,
 			      struct bfd_link_info *info)
 {
   struct elf_segment_map *m;
-  unsigned int segment_count = 0;
   Elf_Internal_Phdr *p;
 
-  for (m = elf_seg_map (abfd); m != NULL; m = m->next, segment_count++)
+  for (m = elf_seg_map (abfd); m != NULL; m = m->next)
     {
       /* We are only interested in the memory tag segment that will be dumped
 	 to a core file.  If we have no memory tags or this isn't a core file we
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 46fafb332de..505f1196987 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -4902,6 +4902,60 @@ loongarch_relax_delete_or_nop (bfd *abfd,
     bfd_put (32, abfd, LARCH_NOP, contents + addr);
 }
 
+/* If some bytes in a symbol is deleted, we need to adjust its size.  */
+static void
+loongarch_relax_resize_symbol (bfd_size_type *size, bfd_vma orig_value,
+			       splay_tree pdops)
+{
+  splay_tree_key key = (splay_tree_key)orig_value;
+  bfd_vma orig_end = orig_value + *size;
+  splay_tree_node node = splay_tree_predecessor (pdops, key);
+
+  if (node)
+    {
+      bfd_vma addr = (bfd_vma)node->key;
+      struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+      /* This shouldn't happen unless people write something really insane like
+	     .reloc ., R_LARCH_ALIGN, 60
+	     .rept 15
+	     1: nop
+	     .endr
+	     .set x, 1b
+	     .size x, . - 1b
+	 But let's just try to make it "work" anyway.  */
+      if (orig_value < addr + op->size)
+	{
+	  bfd_size_type n_deleted = op->size - (orig_value - addr);
+	  if (n_deleted >= *size)
+	    {
+	      *size = 0;
+	      return;
+	    }
+
+	  *size -= n_deleted;
+	}
+    }
+
+  node = splay_tree_lookup (pdops, key);
+  if (!node)
+    node = splay_tree_successor (pdops, key);
+
+  for (; node; node = splay_tree_successor (pdops, node->key))
+    {
+      bfd_vma addr = (bfd_vma)node->key;
+      struct pending_delete_op *op = (struct pending_delete_op *)node->value;
+
+      if (addr >= orig_end)
+	return;
+
+      if (orig_end < addr + op->size)
+	*size -= orig_end - addr;
+      else
+	*size -= op->size;
+    }
+}
+
 static void
 loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
 				 struct bfd_link_info *link_info)
@@ -5000,30 +5054,8 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
 	    sym->st_value
 		= loongarch_calc_relaxed_addr (link_info, orig_value);
 
-	  /* If the symbol *spans* some deleted bytes, that is its *end* is in
-	     the moved bytes but its *start* isn't, then we must adjust its
-	     size.
-
-	     This test needs to use the original value of st_value, otherwise
-	     we might accidentally decrease size when deleting bytes right
-	     before the symbol.  */
-	  bfd_vma sym_end = orig_value + sym->st_size;
-	  if (sym_end <= toaddr)
-	    {
-	      splay_tree_node node = splay_tree_predecessor (
-		  pdops, (splay_tree_key)orig_value);
-	      for (; node; node = splay_tree_successor (pdops, node->key))
-		{
-		  bfd_vma addr = (bfd_vma)node->key;
-		  struct pending_delete_op *op
-		      = (struct pending_delete_op *)node->value;
-
-		  if (addr >= sym_end)
-		    break;
-		  if (orig_value <= addr && sym_end > addr)
-		    sym->st_size -= op->size;
-		}
-	    }
+	  if (orig_value + sym->st_size <= toaddr)
+	    loongarch_relax_resize_symbol (&sym->st_size, orig_value, pdops);
 	}
     }
 
@@ -5070,29 +5102,13 @@ loongarch_relax_perform_deletes (bfd *abfd, asection *sec,
 	{
 	  bfd_vma orig_value = sym_hash->root.u.def.value;
 
-	  /* As above, adjust the value.  */
+	  /* As above, adjust the value and size.  */
 	  if (orig_value <= toaddr)
 	    sym_hash->root.u.def.value
 		= loongarch_calc_relaxed_addr (link_info, orig_value);
 
-	  /* As above, adjust the size if needed.  */
-	  bfd_vma sym_end = orig_value + sym_hash->size;
-	  if (sym_end <= toaddr)
-	    {
-	      splay_tree_node node = splay_tree_predecessor (
-		  pdops, (splay_tree_key)orig_value);
-	      for (; node; node = splay_tree_successor (pdops, node->key))
-		{
-		  bfd_vma addr = (bfd_vma)node->key;
-		  struct pending_delete_op *op
-		      = (struct pending_delete_op *)node->value;
-
-		  if (addr >= sym_end)
-		    break;
-		  if (orig_value <= addr && sym_end > addr)
-		    sym_hash->size -= op->size;
-		}
-	    }
+	  if (orig_value + sym_hash->size <= toaddr)
+	    loongarch_relax_resize_symbol (&sym_hash->size, orig_value, pdops);
 	}
     }
 }
diff --git a/bfd/version.h b/bfd/version.h
index beed058a6be..87fce6dafb3 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
 
    In releases, the date is not included in either version strings or
    sonames.  */
-#define BFD_VERSION_DATE 20250727
+#define BFD_VERSION_DATE 20250816
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
diff --git a/bfd/version.m4 b/bfd/version.m4
index 00d03934d68..848470098f5 100644
--- a/bfd/version.m4
+++ b/bfd/version.m4
@@ -1 +1 @@
-m4_define([BFD_VERSION], [2.45])
+m4_define([BFD_VERSION], [2.45.0])
diff --git a/binutils/configure b/binutils/configure
index 94be22505d4..0ff4539f458 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for binutils 2.45.
+# Generated by GNU Autoconf 2.69 for binutils 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='binutils'
 PACKAGE_TARNAME='binutils'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='binutils 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='binutils 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1407,7 +1407,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures binutils 2.45 to adapt to many kinds of systems.
+\`configure' configures binutils 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1478,7 +1478,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of binutils 2.45:";;
+     short | recursive ) echo "Configuration of binutils 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1640,7 +1640,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-binutils configure 2.45
+binutils configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2108,7 +2108,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by binutils $as_me 2.45, which was
+It was created by binutils $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3091,7 +3091,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='binutils'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16879,7 +16879,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by binutils $as_me 2.45, which was
+This file was extended by binutils $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16945,7 +16945,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-binutils config.status 2.45
+binutils config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 038f6555c0b..905ce917708 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2529,7 +2529,6 @@ merge_gnu_build_notes (bfd *          abfd,
 
   /* Reconstruct the ELF notes.  */
   bfd_byte *     new_contents;
-  bfd_byte *     old;
   bfd_byte *     new;
   bfd_vma        prev_start = 0;
   bfd_vma        prev_end = 0;
@@ -2537,12 +2536,8 @@ merge_gnu_build_notes (bfd *          abfd,
   /* Not sure how, but the notes might grow in size.
      (eg see PR 1774507).  Allow for this here.  */
   new = new_contents = xmalloc (size * 2);
-  for (pnote = pnotes, old = contents;
-       pnote < pnotes_end;
-       pnote ++)
+  for (pnote = pnotes; pnote < pnotes_end; pnote ++)
     {
-      bfd_size_type note_size = 12 + pnote->padded_namesz + pnote->note.descsz;
-
       if (! is_deleted_note (pnote))
 	{
 	  /* Create the note, potentially using the
@@ -2585,8 +2580,6 @@ merge_gnu_build_notes (bfd *          abfd,
 	      prev_end = pnote->end;
 	    }
 	}
-
-      old += note_size;
     }
 
 #if DEBUG_MERGE
diff --git a/binutils/resbin.c b/binutils/resbin.c
index 889126e9e32..fa77cd43d23 100644
--- a/binutils/resbin.c
+++ b/binutils/resbin.c
@@ -1052,7 +1052,7 @@ get_version_header (windres_bfd *wrbfd, const bfd_byte *data,
 {
   if (length < 8)
     {
-      toosmall (key);
+      toosmall (key ? key : _("version header"));
       return false;
     }
 
@@ -1250,7 +1250,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
 
 	      vst = res_alloc (sizeof (rc_ver_stringtable));
 
-	      if (!get_version_header (wrbfd, data, length, "version stringtable",
+	      if (!get_version_header (wrbfd, data, length, NULL,
 				       &vst->language, &stverlen, &vallen,
 				       &type, &off))
 		return NULL;
@@ -1284,7 +1284,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
 
 		  vs = res_alloc (sizeof (rc_ver_stringinfo));
 
-		  if (!get_version_header (wrbfd, data, length, "version string",
+		  if (!get_version_header (wrbfd, data, length, NULL,
 					   &vs->key, &sverlen, &vallen,
 					   &type, &off))
 		    return NULL;
@@ -1348,7 +1348,7 @@ bin_to_res_version (windres_bfd *wrbfd, const bfd_byte *data,
 	  data += off;
 	  length -= off;
 
-	  if (!get_version_header (wrbfd, data, length, "version varfileinfo",
+	  if (!get_version_header (wrbfd, data, length, NULL,
 				   &vi->u.var.key, &verlen, &vallen,
 				   &type, &off))
 	    return NULL;
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index 99bc1bdd506..f2d110868f8 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -119,7 +119,6 @@ const size_t md_longopts_size = sizeof (md_longopts);
 static void
 l_cons (int nbytes)
 {
-  int c;
   expressionS exp;
 
 #ifdef md_flush_pending_output
@@ -141,7 +140,6 @@ l_cons (int nbytes)
   md_cons_align (nbytes);
 #endif
 
-  c = 0;
   do
     {
       unsigned int bits_available = BITS_PER_CHAR * nbytes;
@@ -236,7 +234,6 @@ l_cons (int nbytes)
       if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
 	code_label = 1;
       emit_expr (&exp, nbytes);
-      ++c;
       if ((*(input_line_pointer) == '@') && (*(input_line_pointer +1) == 'c'))
 	{
 	  input_line_pointer +=3;
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 1eb470295a4..fe54d2161eb 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -896,7 +896,6 @@ md_assemble (char *str)
   for (;;)
     {
       const char *errmsg = NULL;
-      int op_idx;
       char *hold;
       int extra_shift = 0;
 
@@ -906,9 +905,9 @@ md_assemble (char *str)
       next_opindex = 0;
       insn = opcode->opcode;
       extension = 0;
-      for (op_idx = 1, opindex_ptr = opcode->operands;
+      for (opindex_ptr = opcode->operands;
 	   *opindex_ptr != 0;
-	   opindex_ptr++, op_idx++)
+	   opindex_ptr++)
 	{
 	  const struct mn10200_operand *operand;
 	  expressionS ex;
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 647744fd6d1..d107555e373 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -3452,8 +3452,9 @@ nds32_lookup_pseudo_opcode (const char *str)
 
   for (i = 0; i < maxlen; i++)
     {
-      if (is_whitespace (op[i] = str[i]))
+      if (is_end_of_stmt (str[i]) || is_whitespace (str[i]))
 	break;
+      op[i] = str[i];
     }
   op[i] = '\0';
 
@@ -4093,7 +4094,8 @@ nds32_relax_relocs (int relax)
     {"", "",};
 
   name = input_line_pointer;
-  while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+  while (!is_end_of_stmt (*input_line_pointer)
+	 && !is_whitespace (*input_line_pointer))
     input_line_pointer++;
   saved_char = *input_line_pointer;
   *input_line_pointer = 0;
@@ -4228,7 +4230,8 @@ nds32_relax_hint (int mode ATTRIBUTE_UNUSED)
   struct relax_hint_id *record_id;
 
   name = input_line_pointer;
-  while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+  while (!is_end_of_stmt (*input_line_pointer)
+	 && !is_whitespace (*input_line_pointer))
     input_line_pointer++;
   saved_char = *input_line_pointer;
   *input_line_pointer = 0;
@@ -4361,7 +4364,8 @@ nds32_flag (int ignore ATTRIBUTE_UNUSED)
 
   /* Skip whitespaces.  */
   name = input_line_pointer;
-  while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+  while (!is_end_of_stmt (*input_line_pointer)
+	 && !is_whitespace (*input_line_pointer))
     input_line_pointer++;
   saved_char = *input_line_pointer;
   *input_line_pointer = 0;
@@ -4398,7 +4402,8 @@ ict_model (int ignore ATTRIBUTE_UNUSED)
 
   /* Skip whitespaces.  */
   name = input_line_pointer;
-  while (*input_line_pointer && !is_whitespace (*input_line_pointer))
+  while (!is_end_of_stmt (*input_line_pointer)
+	 && !is_whitespace (*input_line_pointer))
     input_line_pointer++;
   saved_char = *input_line_pointer;
   *input_line_pointer = 0;
@@ -5944,7 +5949,7 @@ nds32_elf_append_relax_relocs (const char *key, const void *value)
   char *where;
   int pcrel;
 
-  if (!relocs_pattern)
+  if (!relocs_pattern || !relocs_pattern->opcode)
     return;
 
   if (!nds32_find_reloc_table (relocs_pattern, &hint_info))
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index f73c3bfbab3..176910dfaff 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -344,15 +344,10 @@ v850_comm (int area)
 	  int old_subsec;
 	  char *pfrag;
 	  int align;
-	  flagword applicable;
 
 	  old_sec = now_seg;
 	  old_subsec = now_subseg;
 
-	  applicable = bfd_applicable_section_flags (stdoutput);
-
-	  applicable &= SEC_ALLOC;
-
 	  switch (area)
 	    {
 	    case SCOMMON_SECTION:
diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c
index 0823ecd93a4..4a7829f4e60 100644
--- a/gas/config/tc-xgate.c
+++ b/gas/config/tc-xgate.c
@@ -1123,7 +1123,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
   unsigned short oper_mask = 0;
   int operand_bit_length = 0;
   unsigned int operand = 0;
-  char n_operand_bits = 0;
   char first_operand_equals_second = 0;
   int i = 0;
   char c = 0;
@@ -1139,7 +1138,6 @@ xgate_scan_operands (struct xgate_opcode *opcode, s_operand oprs[])
 	{
 	  oper_mask <<= 1;
 	  oper_mask += 1;
-	  n_operand_bits++;
 	}
     }
 
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 2980cffd59a..83a732f1335 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1032,7 +1032,6 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
 {
   unsigned char *output_ptr = buffer;
   int c;
-  int nibble;
   unsigned int *class_ptr;
 
   frag_wane (frag_now);
@@ -1044,7 +1043,7 @@ build_bytes (opcode_entry_type *this_try, struct z8k_op *operand ATTRIBUTE_UNUSE
   memset (buffer, 0, sizeof (buffer));
   class_ptr = this_try->byte_info;
 
-  for (nibble = 0; (c = *class_ptr++); nibble++)
+  while ((c = *class_ptr++) != 0)
     {
 
       switch (c & CLASS_MASK)
diff --git a/gas/configure b/gas/configure
index 9c640c870cd..ca149e79195 100755
--- a/gas/configure
+++ b/gas/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gas 2.45.
+# Generated by GNU Autoconf 2.69 for gas 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='gas'
 PACKAGE_TARNAME='gas'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gas 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gas 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1393,7 +1393,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gas 2.45 to adapt to many kinds of systems.
+\`configure' configures gas 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1464,7 +1464,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gas 2.45:";;
+     short | recursive ) echo "Configuration of gas 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1621,7 +1621,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-gas configure 2.45
+gas configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2032,7 +2032,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by gas $as_me 2.45, which was
+It was created by gas $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3012,7 +3012,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gas'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -16548,7 +16548,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by gas $as_me 2.45, which was
+This file was extended by gas $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16614,7 +16614,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-gas config.status 2.45
+gas config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 74115959f94..97b909364a9 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -3606,7 +3606,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
   efdr_t *file;
   proc_t *proc;
   unsigned long c;
-  long iline;
   long totcount;
   lineno_list_t first;
   lineno_list_t *local_first_lineno = first_lineno;
@@ -3620,7 +3619,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
   proc = NULL;
   last = NULL;
   c = offset;
-  iline = 0;
   totcount = 0;
 
   /* FIXME?  Now that MIPS embedded-PIC is gone, it may be safe to
@@ -3800,7 +3798,6 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend,
 	  ++c;
 	}
 
-      ++iline;
       last = l;
     }
 
diff --git a/gas/testsuite/gas/nds32/nds32.exp b/gas/testsuite/gas/nds32/nds32.exp
index 82934cee605..216fcf185bf 100644
--- a/gas/testsuite/gas/nds32/nds32.exp
+++ b/gas/testsuite/gas/nds32/nds32.exp
@@ -16,17 +16,13 @@
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
 # MA 02110-1301, USA.
 
-if { [istarget nds32*] } {
-    run_dump_test "alu-1"
-    run_dump_test "alu-2"
-    run_dump_test "lsi"
-    run_dump_test "ls"
-    run_dump_test "br-1"
-    run_dump_test "br-2"
-    run_dump_test "ji-jr"
-    run_dump_test "to-16bit-v1"
-    run_dump_test "to-16bit-v2"
-    run_dump_test "to-16bit-v3"
-    run_dump_test "usr-spe-reg"
-    run_dump_test "sys-reg"
+if { ![istarget nds32*] } {
+    return
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+    # We need to strip the ".d", but can leave the dirname.
+    verbose [file rootname $t]
+    run_dump_test [file rootname $t]
 }
diff --git a/gas/testsuite/gas/nds32/pr33229.d b/gas/testsuite/gas/nds32/pr33229.d
new file mode 100644
index 00000000000..e65ca413d55
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.d
@@ -0,0 +1,2 @@
+#as: --fatal-warnings
+#error: .*relax hint.*
diff --git a/gas/testsuite/gas/nds32/pr33229.s b/gas/testsuite/gas/nds32/pr33229.s
new file mode 100644
index 00000000000..3127d6da65b
--- /dev/null
+++ b/gas/testsuite/gas/nds32/pr33229.s
@@ -0,0 +1,3 @@
+ .relax_hint 0
+ ret5
+ .relax_hint 1
diff --git a/gas/write.c b/gas/write.c
index 455dc446a01..c56ad28ea51 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2242,7 +2242,7 @@ write_object_file (void)
 	char *table_ptr;
 	addressT table_addr;
 	addressT from_addr, to_addr;
-	int n, m;
+	int n;
 
 	subseg_change (lie->seg, lie->subseg);
 	fragP = lie->dispfrag;
@@ -2267,9 +2267,9 @@ write_object_file (void)
 	table_ptr += md_short_jump_size;
 	table_addr += md_short_jump_size;
 
-	for (m = 0;
+	for (;
 	     lie && lie->dispfrag == fragP;
-	     m++, lie = lie->next_broken_word)
+	     lie = lie->next_broken_word)
 	  {
 	    if (lie->added == 2)
 	      continue;
diff --git a/gprof/configure b/gprof/configure
index 36ac75e49b3..e40de173a1e 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gprof 2.45.
+# Generated by GNU Autoconf 2.69 for gprof 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='gprof'
 PACKAGE_TARNAME='gprof'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='gprof 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='gprof 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1351,7 +1351,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gprof 2.45 to adapt to many kinds of systems.
+\`configure' configures gprof 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1422,7 +1422,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gprof 2.45:";;
+     short | recursive ) echo "Configuration of gprof 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1541,7 +1541,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-gprof configure 2.45
+gprof configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1906,7 +1906,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by gprof $as_me 2.45, which was
+It was created by gprof $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2886,7 +2886,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gprof'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14255,7 +14255,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by gprof $as_me 2.45, which was
+This file was extended by gprof $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14321,7 +14321,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-gprof config.status 2.45
+gprof config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/ld/configure b/ld/configure
index 78b54b39eb2..4afc58566fc 100755
--- a/ld/configure
+++ b/ld/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ld 2.45.
+# Generated by GNU Autoconf 2.69 for ld 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ld'
 PACKAGE_TARNAME='ld'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='ld 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='ld 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1436,7 +1436,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ld 2.45 to adapt to many kinds of systems.
+\`configure' configures ld 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1507,7 +1507,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ld 2.45:";;
+     short | recursive ) echo "Configuration of ld 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1690,7 +1690,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ld configure 2.45
+ld configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2222,7 +2222,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ld $as_me 2.45, which was
+It was created by ld $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3206,7 +3206,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ld'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19661,7 +19661,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ld $as_me 2.45, which was
+This file was extended by ld $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19727,7 +19727,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ld config.status 2.45
+ld config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
index e23cdc87161..a33727f2efd 100644
--- a/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
+++ b/ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp
@@ -48,6 +48,8 @@ if [istarget "loongarch64-*-*"] {
     run_dump_test "relax-after-alignment"
     run_dump_test "relax-medium-call"
     run_dump_test "relax-medium-call-1"
+    run_dump_test "relax-sym-size-1"
+    run_dump_test "relax-sym-size-2"
     run_dump_test "check_got_relax"
 }
 
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
new file mode 100644
index 00000000000..eec989f68be
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-1.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +8 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
new file mode 100644
index 00000000000..c70ac7176bd
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-1.s
@@ -0,0 +1,8 @@
+.p2align 2
+bar:
+  nop
+.globl _start
+_start:
+  la.pcrel $a0, bar
+  ret
+.size _start, . - _start
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
new file mode 100644
index 00000000000..1388099d37f
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.d
@@ -0,0 +1,7 @@
+#source: relax-sym-size-2.s
+#ld:
+#readelf: -s
+
+#...
+ *[0-9]+: [0-9a-z]+ +64 .* _start
+#...
diff --git a/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
new file mode 100644
index 00000000000..e02e16b7d26
--- /dev/null
+++ b/ld/testsuite/ld-loongarch-elf/relax-sym-size-2.s
@@ -0,0 +1,19 @@
+bar:
+  nop
+.p2align 6
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+  1: nop
+.endr
+  la.pcrel $a0, bar
+  ret
+
+.reloc ., R_LARCH_ALIGN, 60
+.rept 15
+  2: nop
+.endr
+
+.globl _start
+.set _start, 1b
+.size _start, 2b - 1b
diff --git a/libctf/configure b/libctf/configure
index 7466d56a18b..89c99c2ddbf 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -15966,6 +15966,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+case "${host}" in
+  # PR libctf/29292
+  # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+  *-*-solaris2.11*)
+    ac_cv_func_mmap_fixed_mapped=no
+  ;;
+esac
+
 
 
 
@@ -17015,7 +17023,7 @@ if test -n "$decommented_version_script"; then
    # used by GNU ld.  Use cpp to strip the comments out.  (cpp exists under this
    # name on all platforms that support ld -z gnu-version-script.)
    /lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
-   /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+   /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
    VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
    VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
 elif test -z "$no_version_script"; then
diff --git a/libctf/configure.ac b/libctf/configure.ac
index fbd8ec12a14..40d00e8eb18 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -65,6 +65,14 @@ AM_MAINTAINER_MODE
 AM_INSTALL_LIBBFD
 ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
 
+case "${host}" in
+  # PR libctf/29292
+  # libctf's use of mmap doesn't work on Solaris 11.4, so disable it.
+  *-*-solaris2.11*)
+    ac_cv_func_mmap_fixed_mapped=no
+  ;;
+esac
+
 GCC_AC_FUNC_MMAP
 # Needed for BFD capability checks.
 AC_SEARCH_LIBS(dlsym, dl)
@@ -293,7 +301,7 @@ if test -n "$decommented_version_script"; then
    # used by GNU ld.  Use cpp to strip the comments out.  (cpp exists under this
    # name on all platforms that support ld -z gnu-version-script.)
    /lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
-   /lib/cpp < $srcdir/libctf-nobfd.ver > libctf-nobfd-decommented.ver
+   /lib/cpp < libctf-nobfd.ver > libctf-nobfd-decommented.ver
    VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
    VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
 elif test -z "$no_version_script"; then
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 2d4401d2210..524ed7e2466 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -20,10 +20,6 @@
 #include <ctf-impl.h>
 #include <string.h>
 
-#if defined (PIC)
-#pragma weak ctf_open
-#endif
-
 /* CTF linking consists of adding CTF archives full of content to be merged into
    this one to the current file (which must be writable) by calling
    ctf_link_add_ctf.  Once this is done, a call to ctf_link will merge the type
@@ -145,56 +141,33 @@ ctf_link_add_ctf_internal (ctf_dict_t *fp, ctf_archive_t *ctf,
   return ctf_set_errno (fp, ENOMEM);
 }
 
-/* Add a file, memory buffer, or unopened file (by name) to a link.
-
-   You can call this with:
-
-    CTF and NAME: link the passed ctf_archive_t, with the given NAME.
-    NAME alone: open NAME as a CTF file when needed.
-    BUF and NAME: open the BUF (of length N) as CTF, with the given NAME.  (Not
-    yet implemented.)
+/* Add an opened CTF archive or unopened file (by name) to a link.
+   If CTF is NULL and NAME is non-null, an unopened file is meant:
+   otherwise, the specified archive is assumed to have the given NAME.
 
-    Passed in CTF args are owned by the dictionary and will be freed by it.
-    The BUF arg is *not* owned by the dictionary, and the user should not free
-    its referent until the link is done.
+   If CTF is NULL, the NAME is only opened when needed, and is closed when no
+   longer needed, so that large cu-mapped links will only use memory for their
+   cu-mapped inputs briefly (compensating for the memory usage of the
+   smushed-together cu-mapped verion).
 
-    The order of calls to this function influences the order of types in the
-    final link output, but otherwise is not important.
+   Passed in CTF args are owned by the dictionary and will be freed by it.
 
-    Repeated additions of the same NAME have no effect; repeated additions of
-    different dicts with the same NAME add all the dicts with unique NAMEs
-    derived from NAME.
+   The order of calls to this function influences the order of types in the
+   final link output, but otherwise is not important.
 
-    Private for now, but may in time become public once support for BUF is
-    implemented.  */
+   Repeated additions of the same NAME have no effect; repeated additions of
+   different dicts with the same NAME add all the dicts with unique NAMEs
+   derived from NAME.  */
 
-static int
-ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
-	      void *buf _libctf_unused_, size_t n _libctf_unused_)
+int
+ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
 {
-  if (buf)
-    return (ctf_set_errno (fp, ECTF_NOTYET));
-
-  if (!((ctf && name && !buf)
-	|| (name && !buf && !ctf)
-	|| (buf && name && !ctf)))
+  if (!name)
     return (ctf_set_errno (fp, EINVAL));
 
-  /* We can only lazily open files if libctf.so is in use rather than
-     libctf-nobfd.so.  This is a little tricky: in shared libraries, we can use
-     a weak symbol so that -lctf -lctf-nobfd works, but in static libraries we
-     must distinguish between the two libraries explicitly.  */
-
-#if defined (PIC)
-  if (!buf && !ctf && name && !ctf_open)
-    return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#elif NOBFD
-  if (!buf && !ctf && name)
-    return (ctf_set_errno (fp, ECTF_NEEDSBFD));
-#endif
-
   if (fp->ctf_link_outputs)
     return (ctf_set_errno (fp, ECTF_LINKADDEDLATE));
+
   if (fp->ctf_link_inputs == NULL)
     fp->ctf_link_inputs = ctf_dynhash_create (ctf_hash_string,
 					      ctf_hash_eq_string, free,
@@ -203,22 +176,15 @@ ctf_link_add (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name,
   if (fp->ctf_link_inputs == NULL)
     return (ctf_set_errno (fp, ENOMEM));
 
-  return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
-}
-
-/* Add an opened CTF archive or unopened file (by name) to a link.
-   If CTF is NULL and NAME is non-null, an unopened file is meant:
-   otherwise, the specified archive is assumed to have the given NAME.
-
-    Passed in CTF args are owned by the dictionary and will be freed by it.
+  /* We can only lazily open files if libctf.so is in use rather than
+     libctf-nobfd.so.  */
 
-    The order of calls to this function influences the order of types in the
-    final link output, but otherwise is not important.  */
+#if NOBFD
+  if (!ctf)
+    return (ctf_set_errno (fp, ECTF_NEEDSBFD));
+#endif
 
-int
-ctf_link_add_ctf (ctf_dict_t *fp, ctf_archive_t *ctf, const char *name)
-{
-  return ctf_link_add (fp, ctf, name, NULL, 0);
+  return ctf_link_add_ctf_internal (fp, ctf, NULL, name);
 }
 
 /* Lazily open a CTF archive for linking, if not already open.
@@ -238,12 +204,12 @@ ctf_link_lazy_open (ctf_dict_t *fp, ctf_link_input_t *input)
     return 1;
 
   /* See ctf_link_add_ctf.  */
-#if defined (PIC) || !NOBFD
-  input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
-#else
+#if NOBFD
   ctf_err_warn (fp, 0, ECTF_NEEDSBFD, _("cannot open %s lazily"),
 		input->clin_filename);
   return ctf_set_errno (fp, ECTF_NEEDSBFD);
+#else
+  input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
 #endif
 
   /* Having no CTF sections is not an error.  We just don't need to do
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c
index 8c35a2b2489..f04c278344c 100644
--- a/libctf/ctf-serialize.c
+++ b/libctf/ctf-serialize.c
@@ -74,6 +74,12 @@ ctf_symtab_skippable (ctf_link_sym_t *sym)
 	  || sym->st_shndx == SHN_UNDEF
 	  || strcmp (sym->st_name, "_START_") == 0
 	  || strcmp (sym->st_name, "_END_") == 0
+	  || strcmp (sym->st_name, "_DYNAMIC") == 0
+	  || strcmp (sym->st_name, "_GLOBAL_OFFSET_TABLE_") == 0
+	  || strcmp (sym->st_name, "_PROCEDURE_LINKAGE_TABLE_") == 0
+	  || strcmp (sym->st_name, "_edata") == 0
+	  || strcmp (sym->st_name, "_end") == 0
+	  || strcmp (sym->st_name, "_etext") == 0
 	  || (sym->st_type == STT_OBJECT && sym->st_shndx == SHN_EXTABS
 	      && sym->st_value == 0));
 }
diff --git a/libctf/testsuite/config/default.exp b/libctf/testsuite/config/default.exp
index f24482620b6..d5e51f418ca 100644
--- a/libctf/testsuite/config/default.exp
+++ b/libctf/testsuite/config/default.exp
@@ -34,6 +34,10 @@ if ![info exists as] then {
     set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
 }
 
+if ![info exists objdump] then {
+    set objdump [findfile $base_dir/../binutils/objdump]
+}
+
 remote_exec host "mkdir -p tmpdir"
 
 # Make symlinks from tmpdir/libctf to the linker and assembler in the
@@ -63,10 +67,12 @@ if {![info exists CFLAGS_FOR_TARGET]} {
 if ![info exists AR] then {
     set AR [findfile $base_dir/../binutils/ar]
 }
-
 if {![info exists OBJDUMP]} {
     set OBJDUMP [findfile $base_dir/../binutils/objdump]
 }
+if ![info exists OBJDUMPFLAGS] then {
+    set OBJDUMPFLAGS {}
+}
 
 # load the utility procedures
 load_lib ctf-lib.exp
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index 64d2a40ad9f..4df6619606b 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -20,6 +20,51 @@
 
 load_file $srcdir/../../ld/testsuite/lib/ld-lib.exp
 
+# Returns true if the target linker deduplicates CTF.
+proc check_ctf_linker_dedup { } {
+    global ctf_linker_dedup_saved
+
+    if {![info exists ctf_linker_dedup_saved]} {
+	set ctf_linker_dedup_saved 0
+
+	if ([check_ctf_available]) {
+	    global objdump srcdir
+
+	    set basename "tmpdir/ctf_linker_dedups[pid]"
+	    compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-A.c ${basename}-A.o "-gctf -fPIC -c"
+	    compile_one_cc $srcdir/libctf-lookup/ambiguous-struct-B.c ${basename}-B.o "-gctf -fPIC -c"
+	    compile_one_cc "${basename}-A.o ${basename}-B.o" $basename.so "-gctf -fPIC -shared"
+	    if {! [remote_file host exists $basename.so] } {
+		return 0
+	    }
+
+	    # Don't use run_host_cmd: it dumps the entire output into the log,
+	    # even on success.
+	    set cmdret [remote_exec host [concat sh -c [list "$objdump --ctf $basename.so >dump.out 2>dump.err"]] "" "/dev/null"]
+	    set cmdret [lindex $cmdret 0]
+	    remote_upload host "dump.out"
+	    remote_upload host "dump.err"
+	    set dump_out [prune_warnings [file_contents "dump.out"]]
+	    set dump_err [prune_warnings [file_contents "dump.err"]]
+	    remote_file host delete "dump.out" "dump.err"
+	    remote_file build delete "dump.out" "dump.err"
+
+	    if {$cmdret != 0} {
+		verbose -log "failed with $cmdret: stderr: $dump_err"
+		verbose -log "output: $dump_out"
+		return 0;
+	    }
+
+	    remote_file host delete $basename.so ${basename}-A.o ${basename}-B.o
+	    if [regexp {CTF archive member: } $dump_out] {
+		set ctf_linker_dedup_saved 1
+	    }
+	}
+    }
+    return $ctf_linker_dedup_saved
+}
+
+
 proc run_native_host_cmd { command } {
     global link_output
     global ld
diff --git a/libctf/testsuite/libctf-lookup/lookup.exp b/libctf/testsuite/libctf-lookup/lookup.exp
index a8b09c2df78..d15c315729d 100644
--- a/libctf/testsuite/libctf-lookup/lookup.exp
+++ b/libctf/testsuite/libctf-lookup/lookup.exp
@@ -28,6 +28,11 @@ if {![check_ctf_available]} {
     return 0
 }
 
+if {![check_ctf_linker_dedup]} {
+    unsupported "no CTF deduplication support in the linker"
+    return 0
+}
+
 if {[info exists env(LC_ALL)]} {
     set old_lc_all $env(LC_ALL)
 }
diff --git a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
index e29cf63fce9..7c19fe8f6a7 100644
--- a/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
+++ b/libctf/testsuite/libctf-regression/libctf-repeat-cu.exp
@@ -37,6 +37,11 @@ if {![check_ctf_available]} {
     return 0
 }
 
+if {![check_ctf_linker_dedup]} {
+    unsupported "no CTF deduplication support in the linker"
+    return 0
+}
+
 if {[info exists env(LC_ALL)]} {
     set old_lc_all $env(LC_ALL)
 }
diff --git a/libctf/testsuite/libctf-regression/regression.exp b/libctf/testsuite/libctf-regression/regression.exp
index e4b63473691..0270cca0cba 100644
--- a/libctf/testsuite/libctf-regression/regression.exp
+++ b/libctf/testsuite/libctf-regression/regression.exp
@@ -23,6 +23,11 @@ if {![check_ctf_available]} {
     return 0
 }
 
+if {![check_ctf_linker_dedup]} {
+    unsupported "no CTF deduplication support in the linker"
+    return 0
+}
+
 if ![is_elf_format] {
     unsupported "CTF needs bfd changes to be emitted on non-ELF"
     return 0
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2ae5626ed2e..b072d0bed52 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,14 @@
+2025-08-06  Matthieu Longo  <matthieu.longo@arm.com>
+
+	* testsuite/test-doubly-linked-list.c: disable debug logging on
+	stdout.
+
+2025-07-09  Matthieu Longo  <matthieu.longo@arm.com>
+
+	* Makefile.in: Add new header.
+	* testsuite/Makefile.in: Add new test.
+	* testsuite/test-doubly-linked-list.c: New test.
+
 2025-05-13  Andreas Schwab  <schwab@suse.de>
 
 	* regex.c (regex_compile): Don't write beyond array bounds when
diff --git a/libiberty/testsuite/test-doubly-linked-list.c b/libiberty/testsuite/test-doubly-linked-list.c
index 1e1fc637653..93fe19a27ae 100644
--- a/libiberty/testsuite/test-doubly-linked-list.c
+++ b/libiberty/testsuite/test-doubly-linked-list.c
@@ -155,19 +155,26 @@ bool check(const char *op,
   bool success = true;
   bool res;
 
-  l_print (wrapper->first);
+#define DUMP_LIST 0
+
+  if (DUMP_LIST)
+    l_print (wrapper->first);
+
   res = run_test (expect, wrapper, false);
   printf ("%s: test-linked-list::%s: check forward conformity\n",
 	  res ? "PASS": "FAIL", op);
   success &= res;
 
-  l_reverse_print (wrapper->last);
+  if (DUMP_LIST)
+    l_reverse_print (wrapper->last);
+
   res = run_test (expect, wrapper, true);
   printf ("%s: test-linked-list::%s: check backward conformity\n",
 	  res ? "PASS": "FAIL", op);
   success &= res;
 
-  printf("\n");
+  if (DUMP_LIST)
+    printf("\n");
 
   return success;
 }
diff --git a/opcodes/configure b/opcodes/configure
index d878234c88f..3dd6b692f89 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for opcodes 2.45.
+# Generated by GNU Autoconf 2.69 for opcodes 2.45.0.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='opcodes'
 PACKAGE_TARNAME='opcodes'
-PACKAGE_VERSION='2.45'
-PACKAGE_STRING='opcodes 2.45'
+PACKAGE_VERSION='2.45.0'
+PACKAGE_STRING='opcodes 2.45.0'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1368,7 +1368,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures opcodes 2.45 to adapt to many kinds of systems.
+\`configure' configures opcodes 2.45.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1439,7 +1439,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of opcodes 2.45:";;
+     short | recursive ) echo "Configuration of opcodes 2.45.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1560,7 +1560,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-opcodes configure 2.45
+opcodes configure 2.45.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1971,7 +1971,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by opcodes $as_me 2.45, which was
+It was created by opcodes $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2951,7 +2951,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='opcodes'
- VERSION='2.45'
+ VERSION='2.45.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -14623,7 +14623,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by opcodes $as_me 2.45, which was
+This file was extended by opcodes $as_me 2.45.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14689,7 +14689,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-opcodes config.status 2.45
+opcodes config.status 2.45.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
