diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 464d6dd692f..8b0761db582 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -117,12 +117,12 @@ ALL_MACHINES = \
 	cpu-h8300.lo \
 	cpu-hppa.lo \
 	cpu-i386.lo \
-	cpu-iamcu.lo \
 	cpu-ia64.lo \
+	cpu-iamcu.lo \
 	cpu-ip2k.lo \
 	cpu-iq2000.lo \
-	cpu-lm32.lo \
 	cpu-kvx.lo \
+	cpu-lm32.lo \
 	cpu-loongarch.lo \
 	cpu-m10200.lo \
 	cpu-m10300.lo \
@@ -130,10 +130,9 @@ ALL_MACHINES = \
 	cpu-m32r.lo \
 	cpu-m68hc11.lo \
 	cpu-m68hc12.lo \
+	cpu-m68k.lo \
 	cpu-m9s12x.lo \
-	cpu-s12z.lo \
 	cpu-m9s12xg.lo \
-	cpu-m68k.lo \
 	cpu-mcore.lo \
 	cpu-mep.lo \
 	cpu-metag.lo \
@@ -152,10 +151,11 @@ ALL_MACHINES = \
 	cpu-pj.lo \
 	cpu-powerpc.lo \
 	cpu-pru.lo \
-	cpu-rs6000.lo \
 	cpu-riscv.lo \
 	cpu-rl78.lo \
+	cpu-rs6000.lo \
 	cpu-rx.lo \
+	cpu-s12z.lo \
 	cpu-s390.lo \
 	cpu-score.lo \
 	cpu-sh.lo \
@@ -201,11 +201,11 @@ ALL_MACHINES_CFILES = \
 	cpu-h8300.c \
 	cpu-hppa.c \
 	cpu-i386.c \
-	cpu-iamcu.c \
-	cpu-kvx.c \
 	cpu-ia64.c \
+	cpu-iamcu.c \
 	cpu-ip2k.c \
 	cpu-iq2000.c \
+	cpu-kvx.c \
 	cpu-lm32.c \
 	cpu-loongarch.c \
 	cpu-m10200.c \
@@ -214,10 +214,9 @@ ALL_MACHINES_CFILES = \
 	cpu-m32r.c \
 	cpu-m68hc11.c \
 	cpu-m68hc12.c \
+	cpu-m68k.c \
 	cpu-m9s12x.c \
-	cpu-s12z.c \
 	cpu-m9s12xg.c \
-	cpu-m68k.c \
 	cpu-mcore.c \
 	cpu-mep.c \
 	cpu-metag.c \
@@ -229,17 +228,18 @@ ALL_MACHINES_CFILES = \
 	cpu-mt.c \
 	cpu-nds32.c \
 	cpu-nfp.c \
-	cpu-ns32k.c \
 	cpu-nios2.c \
+	cpu-ns32k.c \
 	cpu-or1k.c \
 	cpu-pdp11.c \
 	cpu-pj.c \
 	cpu-powerpc.c \
 	cpu-pru.c \
-	cpu-rs6000.c \
 	cpu-riscv.c \
 	cpu-rl78.c \
+	cpu-rs6000.c \
 	cpu-rx.c \
+	cpu-s12z.c \
 	cpu-s390.c \
 	cpu-score.c \
 	cpu-sh.c \
@@ -288,11 +288,11 @@ BFD32_BACKENDS = \
 	ecofflink.lo \
 	elf-attrs.lo \
 	elf-eh-frame.lo \
-	elf-sframe.lo \
 	elf-ifunc.lo \
 	elf-m10200.lo \
 	elf-m10300.lo \
 	elf-nacl.lo \
+	elf-sframe.lo \
 	elf-strtab.lo \
 	elf-vxworks.lo \
 	elf.lo \
@@ -316,11 +316,9 @@ BFD32_BACKENDS = \
 	elf32-h8300.lo \
 	elf32-hppa.lo \
 	elf32-i386.lo \
-	elfxx-x86.lo \
 	elf32-ip2k.lo \
 	elf32-iq2000.lo \
 	elf32-kvx.lo \
-	elfxx-kvx.lo \
 	elf32-lm32.lo \
 	elf32-m32c.lo \
 	elf32-m32r.lo \
@@ -328,7 +326,6 @@ BFD32_BACKENDS = \
 	elf32-m68hc12.lo \
 	elf32-m68hc1x.lo \
 	elf32-m68k.lo \
-	elf32-s12z.lo \
 	elf32-mcore.lo \
 	elf32-mep.lo \
 	elf32-metag.lo \
@@ -344,6 +341,7 @@ BFD32_BACKENDS = \
 	elf32-pru.lo \
 	elf32-rl78.lo \
 	elf32-rx.lo \
+	elf32-s12z.lo \
 	elf32-s390.lo \
 	elf32-sh.lo \
 	elf32-sparc.lo \
@@ -361,15 +359,17 @@ BFD32_BACKENDS = \
 	elf32-z80.lo \
 	elf32.lo \
 	elflink.lo \
+	elfxx-kvx.lo \
 	elfxx-sparc.lo \
 	elfxx-tilegx.lo \
+	elfxx-x86.lo \
 	i386aout.lo \
 	i386bsd.lo \
 	i386lynx.lo \
 	i386msdos.lo \
-	mach-o.lo \
-	mach-o-i386.lo \
 	mach-o-arm.lo \
+	mach-o-i386.lo \
+	mach-o.lo \
 	ns32knetbsd.lo \
 	pc532-mach.lo \
 	pdb.lo \
@@ -425,11 +425,11 @@ BFD32_BACKENDS_CFILES = \
 	ecofflink.c \
 	elf-attrs.c \
 	elf-eh-frame.c \
-	elf-sframe.c \
 	elf-ifunc.c \
 	elf-m10200.c \
 	elf-m10300.c \
 	elf-nacl.c \
+	elf-sframe.c \
 	elf-strtab.c \
 	elf-vxworks.c \
 	elf.c \
@@ -453,10 +453,8 @@ BFD32_BACKENDS_CFILES = \
 	elf32-h8300.c \
 	elf32-hppa.c \
 	elf32-i386.c \
-	elfxx-x86.c \
 	elf32-ip2k.c \
 	elf32-iq2000.c \
-	elfxx-kvx.c \
 	elf32-lm32.c \
 	elf32-m32c.c \
 	elf32-m32r.c \
@@ -464,7 +462,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-m68hc12.c \
 	elf32-m68hc1x.c \
 	elf32-m68k.c \
-	elf32-s12z.c \
 	elf32-mcore.c \
 	elf32-mep.c \
 	elf32-metag.c \
@@ -480,6 +477,7 @@ BFD32_BACKENDS_CFILES = \
 	elf32-pru.c \
 	elf32-rl78.c \
 	elf32-rx.c \
+	elf32-s12z.c \
 	elf32-s390.c \
 	elf32-sh.c \
 	elf32-sparc.c \
@@ -497,15 +495,17 @@ BFD32_BACKENDS_CFILES = \
 	elf32-z80.c \
 	elf32.c \
 	elflink.c \
+	elfxx-kvx.c \
 	elfxx-sparc.c \
 	elfxx-tilegx.c \
+	elfxx-x86.c \
 	i386aout.c \
 	i386bsd.c \
 	i386lynx.c \
 	i386msdos.c \
-	mach-o.c \
-	mach-o-i386.c \
 	mach-o-arm.c \
+	mach-o-i386.c \
+	mach-o.c \
 	ns32knetbsd.c \
 	pc532-mach.c \
 	pdb.c \
@@ -542,54 +542,54 @@ BFD32_BACKENDS_CFILES = \
 # elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
 # BFD32_BACKENDS.
 BFD64_BACKENDS = \
-	elf32-aarch64.lo \
-	elf64-aarch64.lo \
-	elfxx-aarch64.lo \
 	aix5ppc-core.lo \
 	aout64.lo \
 	coff-alpha.lo \
 	coff-x86_64.lo \
 	coff64-rs6000.lo \
+	elf32-aarch64.lo \
 	elf32-ia64.lo \
+	elf32-loongarch.lo \
 	elf32-mips.lo \
+	elf32-riscv.lo \
 	elf32-score.lo \
 	elf32-score7.lo \
+	elf64-aarch64.lo \
 	elf64-alpha.lo \
 	elf64-amdgcn.lo \
+	elf64-bpf.lo \
 	elf64-gen.lo \
 	elf64-hppa.lo \
-	elf64-ia64.lo \
 	elf64-ia64-vms.lo \
-	elfxx-ia64.lo \
-	elfxx-kvx.lo \
+	elf64-ia64.lo \
 	elf64-kvx.lo \
-	elf32-loongarch.lo \
 	elf64-loongarch.lo \
-	elfxx-loongarch.lo \
-	elfn32-mips.lo \
 	elf64-mips.lo \
-	elfxx-mips.lo \
 	elf64-mmix.lo \
 	elf64-nfp.lo \
 	elf64-ppc.lo \
-	elf32-riscv.lo \
 	elf64-riscv.lo \
-	elfxx-riscv.lo \
 	elf64-s390.lo \
 	elf64-sparc.lo \
 	elf64-tilegx.lo \
 	elf64-x86-64.lo \
-	elfxx-x86.lo \
-	elf64-bpf.lo \
 	elf64.lo \
+	elfn32-mips.lo \
+	elfxx-aarch64.lo \
+	elfxx-ia64.lo \
+	elfxx-kvx.lo \
+	elfxx-loongarch.lo \
+	elfxx-mips.lo \
+	elfxx-riscv.lo \
+	elfxx-x86.lo \
 	mach-o-aarch64.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
+	pe-aarch64.lo \
 	pe-aarch64igen.lo \
 	pe-loongarch64igen.lo \
 	pe-x86_64.lo \
 	pei-aarch64.lo \
-	pe-aarch64.lo \
 	pei-ia64.lo \
 	pei-loongarch64.lo \
 	pei-x86_64.lo \
@@ -608,6 +608,7 @@ BFD64_BACKENDS_CFILES = \
 	elf32-score7.c \
 	elf64-alpha.c \
 	elf64-amdgcn.c \
+	elf64-bpf.c \
 	elf64-gen.c \
 	elf64-hppa.c \
 	elf64-ia64-vms.c \
@@ -619,8 +620,6 @@ BFD64_BACKENDS_CFILES = \
 	elf64-sparc.c \
 	elf64-tilegx.c \
 	elf64-x86-64.c \
-	elfxx-x86.c \
-	elf64-bpf.c \
 	elf64.c \
 	elfn32-mips.c \
 	elfxx-aarch64.c \
@@ -629,6 +628,7 @@ BFD64_BACKENDS_CFILES = \
 	elfxx-loongarch.c \
 	elfxx-mips.c \
 	elfxx-riscv.c \
+	elfxx-x86.c \
 	mach-o-aarch64.c \
 	mach-o-x86-64.c \
 	mmo.c \
@@ -748,12 +748,12 @@ BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
 
 po/SRC-POTFILES.in: @MAINT@ Makefile
 	for file in $(SRC_POTFILES); do echo $$file; done \
-	  | LC_ALL=C sort > tmp.src \
+	  | LC_ALL=C sort | uniq > tmp.src \
 	  && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
 
 po/BLD-POTFILES.in: @MAINT@ Makefile
 	for file in $(BLD_POTFILES); do echo $$file; done \
-	  | LC_ALL=C sort > tmp.bld \
+	  | LC_ALL=C sort | uniq > tmp.bld \
 	  && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
 
 all diststuff: info
@@ -844,67 +844,63 @@ elf64-target.h : elfxx-target.h
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< > $@
 
 elf32-aarch64.c : elfnn-aarch64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-aarch64.c : elfnn-aarch64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-ia64.c : elfnn-ia64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-ia64.c : elfnn-ia64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-kvx.c : elfnn-kvx.c
-	rm -f elf32-kvx.c
-	echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf32-kvx.new
-	sed -e s/NN/32/g < $(srcdir)/elfnn-kvx.c >> elf32-kvx.new
-	mv -f elf32-kvx.new elf32-kvx.c
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
+	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-kvx.c : elfnn-kvx.c
-	rm -f elf64-kvx.c
-	echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf64-kvx.new
-	sed -e s/NN/64/g < $(srcdir)/elfnn-kvx.c >> elf64-kvx.new
-	mv -f elf64-kvx.new elf64-kvx.c
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
+	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-loongarch.c : elfnn-loongarch.c
-	$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-loongarch.c : elfnn-loongarch.c
-	$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-riscv.c : elfnn-riscv.c
-	$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-riscv.c : elfnn-riscv.c
-	$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 peigen.c : peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pe/g < $< >> $@
 
 pepigen.c : peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pep/g < $< >> $@
 
 pex64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pex64/g < $< >> $@
 
 pe-aarch64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@
 
 pe-loongarch64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/peLoongArch64/g < $< >> $@
 
 host-aout.lo: Makefile
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 76c7e184dcd..cca093e1fef 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -468,7 +468,6 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
-runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -573,11 +572,11 @@ ALL_MACHINES = \
 	cpu-h8300.lo \
 	cpu-hppa.lo \
 	cpu-i386.lo \
-	cpu-iamcu.lo \
-	cpu-kvx.lo \
 	cpu-ia64.lo \
+	cpu-iamcu.lo \
 	cpu-ip2k.lo \
 	cpu-iq2000.lo \
+	cpu-kvx.lo \
 	cpu-lm32.lo \
 	cpu-loongarch.lo \
 	cpu-m10200.lo \
@@ -586,10 +585,9 @@ ALL_MACHINES = \
 	cpu-m32r.lo \
 	cpu-m68hc11.lo \
 	cpu-m68hc12.lo \
+	cpu-m68k.lo \
 	cpu-m9s12x.lo \
-	cpu-s12z.lo \
 	cpu-m9s12xg.lo \
-	cpu-m68k.lo \
 	cpu-mcore.lo \
 	cpu-mep.lo \
 	cpu-metag.lo \
@@ -608,10 +606,11 @@ ALL_MACHINES = \
 	cpu-pj.lo \
 	cpu-powerpc.lo \
 	cpu-pru.lo \
-	cpu-rs6000.lo \
 	cpu-riscv.lo \
 	cpu-rl78.lo \
+	cpu-rs6000.lo \
 	cpu-rx.lo \
+	cpu-s12z.lo \
 	cpu-s390.lo \
 	cpu-score.lo \
 	cpu-sh.lo \
@@ -657,11 +656,11 @@ ALL_MACHINES_CFILES = \
 	cpu-h8300.c \
 	cpu-hppa.c \
 	cpu-i386.c \
-	cpu-iamcu.c \
-	cpu-kvx.c \
 	cpu-ia64.c \
+	cpu-iamcu.c \
 	cpu-ip2k.c \
 	cpu-iq2000.c \
+	cpu-kvx.c \
 	cpu-lm32.c \
 	cpu-loongarch.c \
 	cpu-m10200.c \
@@ -670,10 +669,9 @@ ALL_MACHINES_CFILES = \
 	cpu-m32r.c \
 	cpu-m68hc11.c \
 	cpu-m68hc12.c \
+	cpu-m68k.c \
 	cpu-m9s12x.c \
-	cpu-s12z.c \
 	cpu-m9s12xg.c \
-	cpu-m68k.c \
 	cpu-mcore.c \
 	cpu-mep.c \
 	cpu-metag.c \
@@ -685,17 +683,18 @@ ALL_MACHINES_CFILES = \
 	cpu-mt.c \
 	cpu-nds32.c \
 	cpu-nfp.c \
-	cpu-ns32k.c \
 	cpu-nios2.c \
+	cpu-ns32k.c \
 	cpu-or1k.c \
 	cpu-pdp11.c \
 	cpu-pj.c \
 	cpu-powerpc.c \
 	cpu-pru.c \
-	cpu-rs6000.c \
 	cpu-riscv.c \
 	cpu-rl78.c \
+	cpu-rs6000.c \
 	cpu-rx.c \
+	cpu-s12z.c \
 	cpu-s390.c \
 	cpu-score.c \
 	cpu-sh.c \
@@ -745,11 +744,11 @@ BFD32_BACKENDS = \
 	ecofflink.lo \
 	elf-attrs.lo \
 	elf-eh-frame.lo \
-	elf-sframe.lo \
 	elf-ifunc.lo \
 	elf-m10200.lo \
 	elf-m10300.lo \
 	elf-nacl.lo \
+	elf-sframe.lo \
 	elf-strtab.lo \
 	elf-vxworks.lo \
 	elf.lo \
@@ -773,11 +772,9 @@ BFD32_BACKENDS = \
 	elf32-h8300.lo \
 	elf32-hppa.lo \
 	elf32-i386.lo \
-	elfxx-x86.lo \
 	elf32-ip2k.lo \
 	elf32-iq2000.lo \
 	elf32-kvx.lo \
-	elfxx-kvx.lo \
 	elf32-lm32.lo \
 	elf32-m32c.lo \
 	elf32-m32r.lo \
@@ -785,7 +782,6 @@ BFD32_BACKENDS = \
 	elf32-m68hc12.lo \
 	elf32-m68hc1x.lo \
 	elf32-m68k.lo \
-	elf32-s12z.lo \
 	elf32-mcore.lo \
 	elf32-mep.lo \
 	elf32-metag.lo \
@@ -801,6 +797,7 @@ BFD32_BACKENDS = \
 	elf32-pru.lo \
 	elf32-rl78.lo \
 	elf32-rx.lo \
+	elf32-s12z.lo \
 	elf32-s390.lo \
 	elf32-sh.lo \
 	elf32-sparc.lo \
@@ -818,15 +815,17 @@ BFD32_BACKENDS = \
 	elf32-z80.lo \
 	elf32.lo \
 	elflink.lo \
+	elfxx-kvx.lo \
 	elfxx-sparc.lo \
 	elfxx-tilegx.lo \
+	elfxx-x86.lo \
 	i386aout.lo \
 	i386bsd.lo \
 	i386lynx.lo \
 	i386msdos.lo \
-	mach-o.lo \
-	mach-o-i386.lo \
 	mach-o-arm.lo \
+	mach-o-i386.lo \
+	mach-o.lo \
 	ns32knetbsd.lo \
 	pc532-mach.lo \
 	pdb.lo \
@@ -882,11 +881,11 @@ BFD32_BACKENDS_CFILES = \
 	ecofflink.c \
 	elf-attrs.c \
 	elf-eh-frame.c \
-	elf-sframe.c \
 	elf-ifunc.c \
 	elf-m10200.c \
 	elf-m10300.c \
 	elf-nacl.c \
+	elf-sframe.c \
 	elf-strtab.c \
 	elf-vxworks.c \
 	elf.c \
@@ -910,10 +909,8 @@ BFD32_BACKENDS_CFILES = \
 	elf32-h8300.c \
 	elf32-hppa.c \
 	elf32-i386.c \
-	elfxx-x86.c \
 	elf32-ip2k.c \
 	elf32-iq2000.c \
-	elfxx-kvx.c \
 	elf32-lm32.c \
 	elf32-m32c.c \
 	elf32-m32r.c \
@@ -921,7 +918,6 @@ BFD32_BACKENDS_CFILES = \
 	elf32-m68hc12.c \
 	elf32-m68hc1x.c \
 	elf32-m68k.c \
-	elf32-s12z.c \
 	elf32-mcore.c \
 	elf32-mep.c \
 	elf32-metag.c \
@@ -937,6 +933,7 @@ BFD32_BACKENDS_CFILES = \
 	elf32-pru.c \
 	elf32-rl78.c \
 	elf32-rx.c \
+	elf32-s12z.c \
 	elf32-s390.c \
 	elf32-sh.c \
 	elf32-sparc.c \
@@ -954,15 +951,17 @@ BFD32_BACKENDS_CFILES = \
 	elf32-z80.c \
 	elf32.c \
 	elflink.c \
+	elfxx-kvx.c \
 	elfxx-sparc.c \
 	elfxx-tilegx.c \
+	elfxx-x86.c \
 	i386aout.c \
 	i386bsd.c \
 	i386lynx.c \
 	i386msdos.c \
-	mach-o.c \
-	mach-o-i386.c \
 	mach-o-arm.c \
+	mach-o-i386.c \
+	mach-o.c \
 	ns32knetbsd.c \
 	pc532-mach.c \
 	pdb.c \
@@ -1000,54 +999,54 @@ BFD32_BACKENDS_CFILES = \
 # elf32-ia64.c requires a 64-bit bfd_vma, and hence can not be put in
 # BFD32_BACKENDS.
 BFD64_BACKENDS = \
-	elf32-aarch64.lo \
-	elf64-aarch64.lo \
-	elfxx-aarch64.lo \
 	aix5ppc-core.lo \
 	aout64.lo \
 	coff-alpha.lo \
 	coff-x86_64.lo \
 	coff64-rs6000.lo \
+	elf32-aarch64.lo \
 	elf32-ia64.lo \
+	elf32-loongarch.lo \
 	elf32-mips.lo \
+	elf32-riscv.lo \
 	elf32-score.lo \
 	elf32-score7.lo \
+	elf64-aarch64.lo \
 	elf64-alpha.lo \
 	elf64-amdgcn.lo \
+	elf64-bpf.lo \
 	elf64-gen.lo \
 	elf64-hppa.lo \
-	elf64-ia64.lo \
 	elf64-ia64-vms.lo \
-	elfxx-ia64.lo \
-	elfxx-kvx.lo \
+	elf64-ia64.lo \
 	elf64-kvx.lo \
-	elf32-loongarch.lo \
 	elf64-loongarch.lo \
-	elfxx-loongarch.lo \
-	elfn32-mips.lo \
 	elf64-mips.lo \
-	elfxx-mips.lo \
 	elf64-mmix.lo \
 	elf64-nfp.lo \
 	elf64-ppc.lo \
-	elf32-riscv.lo \
 	elf64-riscv.lo \
-	elfxx-riscv.lo \
 	elf64-s390.lo \
 	elf64-sparc.lo \
 	elf64-tilegx.lo \
 	elf64-x86-64.lo \
-	elfxx-x86.lo \
-	elf64-bpf.lo \
 	elf64.lo \
+	elfn32-mips.lo \
+	elfxx-aarch64.lo \
+	elfxx-ia64.lo \
+	elfxx-kvx.lo \
+	elfxx-loongarch.lo \
+	elfxx-mips.lo \
+	elfxx-riscv.lo \
+	elfxx-x86.lo \
 	mach-o-aarch64.lo \
 	mach-o-x86-64.lo \
 	mmo.lo \
+	pe-aarch64.lo \
 	pe-aarch64igen.lo \
 	pe-loongarch64igen.lo \
 	pe-x86_64.lo \
 	pei-aarch64.lo \
-	pe-aarch64.lo \
 	pei-ia64.lo \
 	pei-loongarch64.lo \
 	pei-x86_64.lo \
@@ -1066,6 +1065,7 @@ BFD64_BACKENDS_CFILES = \
 	elf32-score7.c \
 	elf64-alpha.c \
 	elf64-amdgcn.c \
+	elf64-bpf.c \
 	elf64-gen.c \
 	elf64-hppa.c \
 	elf64-ia64-vms.c \
@@ -1077,8 +1077,6 @@ BFD64_BACKENDS_CFILES = \
 	elf64-sparc.c \
 	elf64-tilegx.c \
 	elf64-x86-64.c \
-	elfxx-x86.c \
-	elf64-bpf.c \
 	elf64.c \
 	elfn32-mips.c \
 	elfxx-aarch64.c \
@@ -1087,6 +1085,7 @@ BFD64_BACKENDS_CFILES = \
 	elfxx-loongarch.c \
 	elfxx-mips.c \
 	elfxx-riscv.c \
+	elfxx-x86.c \
 	mach-o-aarch64.c \
 	mach-o-x86-64.c \
 	mmo.c \
@@ -2283,12 +2282,12 @@ $(BFD32_LIBS) \
 
 po/SRC-POTFILES.in: @MAINT@ Makefile
 	for file in $(SRC_POTFILES); do echo $$file; done \
-	  | LC_ALL=C sort > tmp.src \
+	  | LC_ALL=C sort | uniq > tmp.src \
 	  && mv tmp.src $(srcdir)/po/SRC-POTFILES.in
 
 po/BLD-POTFILES.in: @MAINT@ Makefile
 	for file in $(BLD_POTFILES); do echo $$file; done \
-	  | LC_ALL=C sort > tmp.bld \
+	  | LC_ALL=C sort | uniq > tmp.bld \
 	  && mv tmp.bld $(srcdir)/po/BLD-POTFILES.in
 
 all diststuff: info
@@ -2347,67 +2346,63 @@ elf64-target.h : elfxx-target.h
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< > $@
 
 elf32-aarch64.c : elfnn-aarch64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-aarch64.c : elfnn-aarch64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-ia64.c : elfnn-ia64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-ia64.c : elfnn-ia64.c
-	$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-kvx.c : elfnn-kvx.c
-	rm -f elf32-kvx.c
-	echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf32-kvx.new
-	sed -e s/NN/32/g < $(srcdir)/elfnn-kvx.c >> elf32-kvx.new
-	mv -f elf32-kvx.new elf32-kvx.c
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
+	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-kvx.c : elfnn-kvx.c
-	rm -f elf64-kvx.c
-	echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf64-kvx.new
-	sed -e s/NN/64/g < $(srcdir)/elfnn-kvx.c >> elf64-kvx.new
-	mv -f elf64-kvx.new elf64-kvx.c
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
+	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-loongarch.c : elfnn-loongarch.c
-	$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-loongarch.c : elfnn-loongarch.c
-	$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 elf32-riscv.c : elfnn-riscv.c
-	$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
 
 elf64-riscv.c : elfnn-riscv.c
-	$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
 
 peigen.c : peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pe/g < $< >> $@
 
 pepigen.c : peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pep/g < $< >> $@
 
 pex64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/pex64/g < $< >> $@
 
 pe-aarch64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@
 
 pe-loongarch64igen.c: peXXigen.c
-	$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
+	$(AM_V_at)echo "#line 1 \"$<\"" > $@
 	$(AM_V_GEN)$(SED) -e s/XX/peLoongArch64/g < $< >> $@
 
 host-aout.lo: Makefile
diff --git a/bfd/po/Make-in b/bfd/po/Make-in
index 3229be6eb18..30bcd5576e9 100644
--- a/bfd/po/Make-in
+++ b/bfd/po/Make-in
@@ -105,8 +105,8 @@ $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
 	  --join-existing \
 	  --msgid-bugs-address=https://sourceware.org/bugzilla/ \
 	  --files-from=$(srcdir)/BLD-POTFILES.in
-	rm -f $(srcdir)/$(PACKAGE).pot
-	mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
+	sed -e '/^#:/s,$(top_srcdir)/,,g' < $(PACKAGE).po > $@-t
+	mv -f $@-t $@
 
 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in
index c259931dc5b..ab9cf27adaf 100644
--- a/bfd/po/SRC-POTFILES.in
+++ b/bfd/po/SRC-POTFILES.in
@@ -274,7 +274,6 @@ elfxx-sparc.h
 elfxx-tilegx.c
 elfxx-tilegx.h
 elfxx-x86.c
-elfxx-x86.c
 elfxx-x86.h
 format.c
 genlink.h
diff --git a/configure b/configure
index b0434aa99d4..dd743c58663 100755
--- a/configure
+++ b/configure
@@ -3968,7 +3968,7 @@ case "${target}" in
     noconfigdirs="$noconfigdirs gdb"
     ;;
   kvx-*-*)
-    noconfigdirs="$noconfigdirs gdb sim"
+    noconfigdirs="$noconfigdirs gdb gdbserver sim"
     ;;
   mmix-*-*)
     noconfigdirs="$noconfigdirs gdb"
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 2afd1fc69ef..fae3a47c144 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -176,8 +176,8 @@ am__objects_1 = app.$(OBJEXT) as.$(OBJEXT) atof-generic.$(OBJEXT) \
 am_as_new_OBJECTS = $(am__objects_1)
 am__dirstamp = $(am__leading_dot)dirstamp
 as_new_OBJECTS = $(am_as_new_OBJECTS)
-am__DEPENDENCIES_1 = ../bfd/libbfd.la ../libiberty/libiberty.a
-am__DEPENDENCIES_2 =
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = ../bfd/libbfd.la ../libiberty/libiberty.a
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -185,7 +185,7 @@ am__v_lt_1 =
 am_itbl_test_OBJECTS = itbl-parse.$(OBJEXT) itbl-lex.$(OBJEXT)
 itbl_test_OBJECTS = $(am_itbl_test_OBJECTS)
 itbl_test_DEPENDENCIES = itbl-tops.@OBJEXT@ itbl-test.@OBJEXT@ \
-	$(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_2)
 SCRIPTS = $(noinst_SCRIPTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -966,6 +966,7 @@ CPU_DOCS = \
 	doc/c-hppa.texi \
 	doc/c-i386.texi \
 	doc/c-ip2k.texi \
+	doc/c-kvx.texi \
 	doc/c-lm32.texi \
 	doc/c-m32c.texi \
 	doc/c-m32r.texi \
diff --git a/gas/configure b/gas/configure
index 8875fe61ad4..3c80fe5741a 100755
--- a/gas/configure
+++ b/gas/configure
@@ -3123,9 +3123,6 @@ fi
 AM_BACKSLASH='\'
 
 
-
-
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/gas/po/POTFILES.in b/gas/po/POTFILES.in
index fda3de0bb4d..651a22bf273 100644
--- a/gas/po/POTFILES.in
+++ b/gas/po/POTFILES.in
@@ -21,6 +21,8 @@ config/e-i386aout.c
 config/e-i386coff.c
 config/e-i386elf.c
 config/e-mipself.c
+config/kvx-parse.c
+config/kvx-parse.h
 config/obj-aout.c
 config/obj-aout.h
 config/obj-coff.c
@@ -87,6 +89,8 @@ config/tc-ip2k.c
 config/tc-ip2k.h
 config/tc-iq2000.c
 config/tc-iq2000.h
+config/tc-kvx.c
+config/tc-kvx.h
 config/tc-lm32.c
 config/tc-lm32.h
 config/tc-loongarch.c
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 618e0bc5ca7..07fac968bb7 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -441,6 +441,8 @@ ALL_64_EMULATION_SOURCES = \
 	eelf64btsmip.c \
 	eelf64btsmip_fbsd.c \
 	eelf64hppa.c \
+	eelf64kvx.c \
+	eelf64kvx_linux.c \
 	eelf64loongarch.c \
 	eelf64lppc.c \
 	eelf64lppc_fbsd.c \
@@ -449,8 +451,6 @@ ALL_64_EMULATION_SOURCES = \
 	eelf64lriscv_lp64f.c \
 	eelf64ltsmip.c \
 	eelf64ltsmip_fbsd.c \
-	eelf64kvx.c \
-	eelf64kvx_linux.c \
 	eelf64mmix.c \
 	eelf64ppc.c \
 	eelf64ppc_fbsd.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index b08de3569cc..a2aa54b69d8 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -941,6 +941,8 @@ ALL_64_EMULATION_SOURCES = \
 	eelf64btsmip.c \
 	eelf64btsmip_fbsd.c \
 	eelf64hppa.c \
+	eelf64kvx.c \
+	eelf64kvx_linux.c \
 	eelf64loongarch.c \
 	eelf64lppc.c \
 	eelf64lppc_fbsd.c \
@@ -949,8 +951,6 @@ ALL_64_EMULATION_SOURCES = \
 	eelf64lriscv_lp64f.c \
 	eelf64ltsmip.c \
 	eelf64ltsmip_fbsd.c \
-	eelf64kvx.c \
-	eelf64kvx_linux.c \
 	eelf64mmix.c \
 	eelf64ppc.c \
 	eelf64ppc_fbsd.c \
@@ -2460,6 +2460,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ip2k.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq10.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq2000.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32kvx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32fd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppc.Pc@am__quote@
@@ -2627,7 +2628,6 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ebmipvxworks.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmip.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmipvxworks.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32kvx.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32l4300.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32loongarch.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lmip.Pc@am__quote@
@@ -2661,10 +2661,10 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx_linux.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx_linux.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@
