[v2] Make *-netbsd mean ELF rather than a.out for all CPU archs, deprecate ns32k-netbsd

Message ID 20210803185917.929706-2-git@JohnEricson.me
State New
Headers show
Series
  • [v2] Make *-netbsd mean ELF rather than a.out for all CPU archs, deprecate ns32k-netbsd
Related show

Commit Message

John Ericson Aug. 3, 2021, 6:59 p.m.
As discussed previously, a.out support is now quite deprecated, and in
some cases removed, in both Binutils itself and NetBSD, so this legacy
default makes little sense. `netbsdelf*` and `netbsdaout*` still work
allowing the user to be explicit about there choice. Additionally, the
configure script warns about the change as Nick Clifton requested.

One possible concern was the status of NetBSD on NS32K, where only a.out
was supported. But per [1] NetBSD has removed support, and if it were to
come back, it would be with ELF. The binutils implementation is
therefore marked obsolete, per the instructions in the last message.

With that patch and this one applied, I have confirmed the following:

--target=i686-unknown-netbsd
--target=i686-unknown-netbsdelf
  builds completely

--target=i686-unknown-netbsdaout
  properly fails because target is deprecated.

--target=vax-unknown-netbsdaout builds completely except for gas, where
the target is deprecated.

[1]: https://mail-index.netbsd.org/tech-toolchain/2021/07/19/msg004025.html
---
 bfd/config.bfd                             | 43 +++++++++++++--------
 bfd/configure.ac                           |  5 +--
 binutils/testsuite/binutils-all/nm.exp     |  2 +-
 binutils/testsuite/lib/binutils-common.exp |  7 +---
 config/picflag.m4                          |  4 +-
 gas/configure.tgt                          |  9 +++--
 gas/testsuite/gas/arm/blx-bl-convert.d     |  2 +-
 gas/testsuite/gas/arm/blx-local-thumb.d    |  2 +-
 gas/testsuite/gas/sh/basic.exp             |  2 +-
 gdb/configure.host                         | 34 +++++++----------
 gdb/configure.tgt                          |  2 +-
 gdb/testsuite/gdb.asm/asm-source.exp       |  6 +--
 intl/configure                             |  2 +-
 ld/configure.tgt                           | 44 +++++++++++-----------
 ld/testsuite/ld-arm/arm-elf.exp            |  4 +-
 ld/testsuite/ld-elf/elf.exp                |  2 +-
 ld/testsuite/ld-elf/shared.exp             |  4 +-
 libiberty/configure                        |  4 +-
 18 files changed, 86 insertions(+), 92 deletions(-)

-- 
2.31.1

Comments

Richard Sandiford via Binutils Aug. 11, 2021, 12:19 p.m. | #1
Hi John,

> As discussed previously, a.out support is now quite deprecated, and in

> some cases removed, in both Binutils itself and NetBSD, so this legacy

> default makes little sense. `netbsdelf*` and `netbsdaout*` still work

> allowing the user to be explicit about there choice. Additionally, the

> configure script warns about the change as Nick Clifton requested.


Patch approved and applied.  (Sorry for the delay - I was on holiday).

Cheers
   Nick
Jan-Benedict Glaw Sept. 3, 2021, 8:11 p.m. | #2
On Tue, 2021-08-03 14:59:17 -0400, John Ericson <git@JohnEricson.me> wrote:
> As discussed previously, a.out support is now quite deprecated, and in

> some cases removed, in both Binutils itself and NetBSD, so this legacy

> default makes little sense. `netbsdelf*` and `netbsdaout*` still work

> allowing the user to be explicit about there choice. Additionally, the

> configure script warns about the change as Nick Clifton requested.

> 

> One possible concern was the status of NetBSD on NS32K, where only a.out

> was supported. But per [1] NetBSD has removed support, and if it were to

> come back, it would be with ELF. The binutils implementation is

> therefore marked obsolete, per the instructions in the last message.

> 

> With that patch and this one applied, I have confirmed the following:

> 

> --target=i686-unknown-netbsd

> --target=i686-unknown-netbsdelf

>   builds completely

> 

> --target=i686-unknown-netbsdaout

>   properly fails because target is deprecated.

> 

> --target=vax-unknown-netbsdaout builds completely except for gas, where

> the target is deprecated.


For my test builds, it seems that with --target=m68k-netbsdelf, a
"make all-gas" fails:


[all 2021-08-15 17:11:44] checking for sigsetjmp... 
[all 2021-08-15 17:11:44] checking linker --as-needed support... no
[all 2021-08-15 17:11:44] checking for cos in -lm... yes
[all 2021-08-15 17:11:44] *** Configuration m68k-unknown-netbsdelf is obsolete.
[all 2021-08-15 17:11:44] *** Support has been REMOVED.
[all 2021-08-15 17:11:44] make: *** [Makefile:3210: configure-opcodes] Error 1

I guess that was not intended? (Still working at
fd986183343387b019080d81838ad9371593b219, but broken at
ec1e5afa895ea5f19f4b47d0e04fafe0a18f33ff.)

MfG, JBG

--
Jan-Benedict Glaw Sept. 10, 2021, 2:52 p.m. | #3
Hi John,

On Fri, 2021-09-03 22:11:16 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> On Tue, 2021-08-03 14:59:17 -0400, John Ericson <git@JohnEricson.me> wrote:

> > One possible concern was the status of NetBSD on NS32K, where only a.out

> > was supported. But per [1] NetBSD has removed support, and if it were to

> > come back, it would be with ELF. The binutils implementation is

> > therefore marked obsolete, per the instructions in the last message.

> > 

> > With that patch and this one applied, I have confirmed the following:

> > 

> > --target=i686-unknown-netbsd

> > --target=i686-unknown-netbsdelf

> >   builds completely

> > 

> > --target=i686-unknown-netbsdaout

> >   properly fails because target is deprecated.

> > 

> > --target=vax-unknown-netbsdaout builds completely except for gas, where

> > the target is deprecated.

> 

> For my test builds, it seems that with --target=m68k-netbsdelf, a

> "make all-gas" fails:

> 

> [all 2021-08-15 17:11:44] checking for sigsetjmp... 

> [all 2021-08-15 17:11:44] checking linker --as-needed support... no

> [all 2021-08-15 17:11:44] checking for cos in -lm... yes

> [all 2021-08-15 17:11:44] *** Configuration m68k-unknown-netbsdelf is obsolete.

> [all 2021-08-15 17:11:44] *** Support has been REMOVED.

> [all 2021-08-15 17:11:44] make: *** [Makefile:3210: configure-opcodes] Error 1

> 

> I guess that was not intended? (Still working at

> fd986183343387b019080d81838ad9371593b219, but broken at

> ec1e5afa895ea5f19f4b47d0e04fafe0a18f33ff.)



I wanted to give this a *ping*.

Thanks,
  Jan-Benedict

--
Richard Sandiford via Binutils Sept. 13, 2021, 7:34 a.m. | #4
On Fri, Sep 10, 2021 at 04:52:05PM +0200, Jan-Benedict Glaw wrote:
> I wanted to give this a *ping*.


This should fix it.  Applied.

	* config.bfd: Correct m68-*-*bsd* obsolete target match.

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 7f7c12d4b2d..ab5125796f7 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -121,12 +121,13 @@ case $targ in
  i370-* | \
  i860-*-* | \
  i960-*-* | \
- m68*-*-*bsd* | \
+ m68*-*-bsd* | \
  m68*-*-aout* | \
  m68*-*-coff* | \
  m68*-*-hpux* | \
  m68*-*-linux*aout* | \
  m68*-*-lynxos* | \
+ m68*-*-openbsd* | \
  m68*-*-os68k* | \
  m68*-*-psos* | \
  m68*-*-sunos* | \


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/config.bfd b/bfd/config.bfd
index ebda78f60a7..606c9cea982 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -48,6 +48,7 @@  targ_underscore=no
 
 # Catch obsolete configurations.
 case $targ in
+ ns32k-*-netbsd* | \
  null)
     if test "x$enable_obsolete" != xyes; then
       echo "*** Configuration $targ is obsolete." >&2
@@ -58,8 +59,19 @@  case $targ in
     fi;;
 esac
 
+# Warn on changed defaulting
+case $targ in
+ *-*-netbsdelf* | *-*-netbsdaout* | *-*-netbsdpe*)
+    # Explicit, no defaulting
+    ;;
+ *-*-netbsd* )
+    targ_migrated=`echo "$targ" | sed 's/netbsd/netbsdaout/'`
+    echo "*** WARNING: $targ is now defaults to meaning ELF not a.out." >&2
+    echo "*** Use $targ_migrated instead to explicitly specify a.out." >&2
+    ;;
+esac
+
 case $targ in
- *-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu | \
  mips*-*-irix5* | mips*-*-irix6*)
     # Not obsolete
     ;;
@@ -75,7 +87,7 @@  case $targ in
  a29k-* | \
  arm*-*-aout | \
  arm-*-coff | \
- arm-*-netbsd* | \
+ arm*-*-netbsdaout* | \
  arm-*-openbsd* | \
  arm-*-oabi | \
  arm-*-riscix* | \
@@ -96,7 +108,7 @@  case $targ in
  i[3-7]86-*-aix* | \
  i[3-7]86-sequent-bsd* | \
  i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12] | \
- i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \
+ i[3-7]86-*-netbsdaout* | \
  i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3] | \
  i[3-7]86-*-linux*aout* | \
  i[3-7]86-*-mach* | i[3-7]86-*-osf1mk* | \
@@ -141,6 +153,7 @@  case $targ in
  or32-*-* | \
  powerpc-*-lynxos* | powerpc-*-windiss* | \
  powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin* | \
+ sh*-*-netbsdaout* | \
  sh*-*-symbianelf* | sh5*-*-* | sh64*-*-* | \
  sparc*-*-*aout* | \
  sparc*-*-chorus* | \
@@ -345,11 +358,11 @@  case "${targ}" in
     targ_defvec=arm_elf32_nacl_be_vec
     targ_selvecs="arm_elf32_nacl_le_vec"
     ;;
-  armeb-*-netbsdelf*)
+  armeb-*-netbsd*)
     targ_defvec=arm_elf32_be_vec
     targ_selvecs="arm_elf32_le_vec"
     ;;
-  arm-*-netbsdelf*)
+  arm-*-netbsd*)
     targ_defvec=arm_elf32_le_vec
     targ_selvecs="arm_elf32_be_vec"
     ;;
@@ -609,7 +622,7 @@  case "${targ}" in
 	targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
     esac
     ;;
-  i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu)
+  i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu)
     targ_defvec=i386_elf32_vec
     targ_selvecs="iamcu_elf32_vec"
     targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
@@ -983,7 +996,7 @@  case "${targ}" in
     targ_defvec=ns32k_aout_pc532mach_vec
     targ_underscore=yes
     ;;
-  ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
+  ns32k-*-lites* | ns32k-*-openbsd*)
     targ_defvec=ns32k_aout_pc532nbsd_vec
     targ_underscore=yes
     ;;
@@ -1222,11 +1235,11 @@  case "${targ}" in
     targ_selvecs="sh_elf32_le_vec sh_elf32_linux_be_vec sh_elf32_linux_vec sh_elf32_fdpic_le_vec sh_elf32_fdpic_be_vec"
     ;;
 
-  sh*l*-*-netbsdelf*)
+  sh*l*-*-netbsd*)
     targ_defvec=sh_elf32_nbsd_le_vec
     targ_selvecs="sh_elf32_nbsd_vec sh_coff_vec sh_coff_le_vec"
     ;;
-  sh*-*-netbsdelf*)
+  sh*-*-netbsd*)
     targ_defvec=sh_elf32_nbsd_vec
     targ_selvecs="sh_elf32_nbsd_le_vec sh_coff_vec sh_coff_le_vec"
     ;;
@@ -1345,17 +1358,17 @@  case "${targ}" in
     targ_underscore=yes
     ;;
 
-  vax-*-netbsdelf*)
-    targ_defvec=vax_elf32_vec
-    targ_selvecs="vax_aout_nbsd_vec vax_aout_1knbsd_vec"
-    ;;
-
-  vax-*-netbsdaout* | vax-*-netbsd*)
+  vax-*-netbsdaout*)
     targ_defvec=vax_aout_nbsd_vec
     targ_selvecs="vax_elf32_vec vax_aout_1knbsd_vec"
     targ_underscore=yes
     ;;
 
+  vax-*-netbsd*)
+    targ_defvec=vax_elf32_vec
+    targ_selvecs="vax_aout_nbsd_vec vax_aout_1knbsd_vec"
+    ;;
+
   vax-*-openbsd*)
     targ_defvec=vax_aout_nbsd_vec
     targ_underscore=yes
diff --git a/bfd/configure.ac b/bfd/configure.ac
index fec067b2135..9ff303ab6e1 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -45,9 +45,8 @@  ACX_LARGEFILE
 
 changequote(,)dnl
 case "${target}" in
-    hppa*64*-*-* | vax-*-netbsdelf*) ;;
-    *-*-*aout* | i[3-7]86-*-bsd* | i[3-7]86-*-msdos* | ns32k-*-* | \
-    pdp11-*-* | vax-*-*bsd*)
+    hppa*64*-*-*) ;;
+    *-*-*aout*| i[3-7]86-*-msdos* | ns32k-*-* | pdp11-*-*)
 changequote([,])dnl
 	if test "$plugins" = "yes"; then
 	    if test "${enable_plugins+set}" = set; then
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index 937531992f1..b5784eacddc 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -304,7 +304,7 @@  if [is_elf_format] {
     
     # The following targets are known to not support ifuncs.
     setup_xfail "alpha*-*-*"
-    setup_xfail "arm*-elf" "arm*-*-nto*" "arm*-*-netbsdelf*"
+    setup_xfail "arm*-elf" "arm*-*-nto*" "arm*-*-netbsd*"
     setup_xfail "*-*-hpux*"
     setup_xfail "mips*-*-*" "tx39*-*-*"
     setup_xfail "msp430*-*-*"
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 0fb506cfd89..b6f5286caac 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -63,9 +63,7 @@  proc is_elf_format {} {
 	return 0
     }
 
-    if { ![istarget *-*-netbsdelf*]
-	 && (   [istarget vax-*-netbsd*]
-	     || [istarget ns32k-*-netbsd*]) } {
+    if { [istarget *-*-netbsdaout*] } {
 	return 0
     }
 
@@ -85,8 +83,7 @@  proc is_aout_format {} {
 	 || [istarget *-*-bsd*]
 	 || [istarget *-*-msdos*]
 	 || [istarget ns32k-*-*]
-	 || [istarget pdp11-*-*]
-	 || [istarget vax-*-netbsd] } {
+	 || [istarget pdp11-*-*] } {
 	return 1
     }
     return 0
diff --git a/config/picflag.m4 b/config/picflag.m4
index 8b106f9af88..3bd49af00e5 100644
--- a/config/picflag.m4
+++ b/config/picflag.m4
@@ -60,9 +60,7 @@  case "${$2}" in
     sh-*-linux* | sh[[2346lbe]]*-*-linux*)
 	$1=-fpic
 	;;
-    # FIXME: Simplify to sh*-*-netbsd*?
-    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-      sh64-*-netbsd* | sh64l*-*-netbsd*)
+    sh*-*-netbsd*)
 	$1=-fpic
 	;;
     # Default to -fPIC unless specified otherwise.
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 0be695bc61c..68ee0468e8d 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -155,7 +155,7 @@  case ${generic_target} in
   arm-*-uclinux*eabi*)			fmt=elf  em=armlinuxeabi ;;
   arm-*-uclinux*)			fmt=elf  em=linux ;;
   arm-*-nacl*)				fmt=elf  em=nacl ;;
-  arm-*-netbsdelf*)			fmt=elf  em=nbsd ;;
+  arm-*-netbsd*)			fmt=elf  em=nbsd ;;
   arm-*-nto*)				fmt=elf ;;
   arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*)
 					fmt=coff em=wince-pe ;;
@@ -287,7 +287,7 @@  case ${generic_target} in
   m68k-*-linux-*)			fmt=elf em=linux ;;
   m68k-*-uclinux*)			fmt=elf em=uclinux ;;
   m68k-*-gnu*)				fmt=elf ;;
-  m68k-*-netbsdelf*)			fmt=elf em=nbsd ;;
+  m68k-*-netbsd*)			fmt=elf em=nbsd ;;
 
   s12z-*-*)				fmt=elf ;;
 
@@ -373,7 +373,7 @@  case ${generic_target} in
       sh*eb)	endian=big ;;
       *)	endian=little ;;
     esac ;;
-  sh*-*-netbsdelf*)			fmt=elf em=nbsd
+  sh*-*-netbsd*)			fmt=elf em=nbsd
     case ${cpu} in
       sh*l*)	endian=little ;;
       *)	endian=big ;;
@@ -402,7 +402,8 @@  case ${generic_target} in
 
   v850*-*-*)				fmt=elf ;;
 
-  vax-*-netbsdelf*)			fmt=elf em=nbsd ;;
+  vax-*-netbsdaout)			fmt=aout em=nbsd ;;
+  vax-*-netbsd*)			fmt=elf em=nbsd ;;
   vax-*-linux-*)			fmt=elf em=linux ;;
 
   visium-*-elf)				fmt=elf ;;
diff --git a/gas/testsuite/gas/arm/blx-bl-convert.d b/gas/testsuite/gas/arm/blx-bl-convert.d
index c3e00557b91..d7a51f0a17f 100644
--- a/gas/testsuite/gas/arm/blx-bl-convert.d
+++ b/gas/testsuite/gas/arm/blx-bl-convert.d
@@ -1,7 +1,7 @@ 
 #name: blx->bl convert under no -march/cpu
 #warning_output: blx-bl-convert.l
 #objdump: -d
-#skip: *-*-pe *-wince-* *-*-vxworks *-*-netbsdelf *-*-nto*
+#skip: *-*-pe *-wince-* *-*-vxworks *-*-netbsd* *-*-nto*
 
 .*:     file format .*
 
diff --git a/gas/testsuite/gas/arm/blx-local-thumb.d b/gas/testsuite/gas/arm/blx-local-thumb.d
index 18af8e6d5db..61b1fbdf886 100644
--- a/gas/testsuite/gas/arm/blx-local-thumb.d
+++ b/gas/testsuite/gas/arm/blx-local-thumb.d
@@ -1,6 +1,6 @@ 
 #name: Local BLX instructions in Thumb mode.
 #objdump: -drw --prefix-addresses --show-raw-insn
-#skip: *-*-pe *-*-wince *-*nto* *-*netbsdelf*
+#skip: *-*-pe *-*-wince *-*nto* *-*netbsd*
 #as:
 #warning_output: blx-local-thumb.l
 
diff --git a/gas/testsuite/gas/sh/basic.exp b/gas/testsuite/gas/sh/basic.exp
index bd31bc27794..18b2e386d12 100644
--- a/gas/testsuite/gas/sh/basic.exp
+++ b/gas/testsuite/gas/sh/basic.exp
@@ -19,7 +19,7 @@ 
 
 # Written by Cygnus Support.
 
-if {[istarget "sh*-*-linux-*"] || [istarget "sh*l*-*-netbsdelf*"]} then {
+if {[istarget "sh*-*-linux-*"] || [istarget "sh*l*-*-netbsd*"]} then {
     global ASFLAGS
     set ASFLAGS "$ASFLAGS -big"
 }
diff --git a/gdb/configure.host b/gdb/configure.host
index e94a19b0332..1fc83601e0e 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -13,23 +13,17 @@ 
 # The default is $host_cpu.
 
 case $host in
- arm*-*-netbsdelf* | \
- i[34567]86-*-netbsdelf* | \
- m68*-*-netbsdelf* | \
- sparc-*-netbsdelf* | \
- vax-*-netbsdelf*)
-    ;;
  *-*-irix* | \
  *-*-solaris2.[01] | *-*-solaris2.[2-9]* | *-*-solaris2.10* | \
  alpha*-*-osf* | \
  alpha*-*-freebsd* | \
  alpha*-*-kfreebsd*-gnu | \
- arm*-*-netbsd* | \
+ arm*-*-netbsdaout* | \
  hppa*-*-hiux* | \
  i[34567]86-ncr-* | \
  i[34567]86-*-dgux* | \
  i[34567]86-*-lynxos* | \
- i[34567]86-*-netbsd* | \
+ i[34567]86-*-netbsdaout* | \
  i[34567]86-*-openbsd[0-2].* | i[34567]86-*-openbsd3.[0-3] | \
  i[34567]86-*-sco3.2v5* | \
  i[34567]86-*-sco3.2v4* | \
@@ -41,11 +35,11 @@  case $host in
  i[34567]86-*-unixware* | \
  i[34567]86-*-sysv* | \
  i[34567]86-*-isc* | \
- m68*-*-netbsd* | \
- sparc-*-netbsd* | \
+ m68*-*-netbsdaout* | \
+ sparc-*-netbsdaout* | \
  rs6000-*-lynxos* | \
  vax-*-bsd* | \
- vax-*-netbsd* | \
+ vax-*-netbsdaout* | \
  vax-*-ultrix* | \
  hppa*-*-hpux* | \
  ia64-*-hpux* | \
@@ -88,7 +82,7 @@  aarch64*-*-linux*)	gdb_host=linux ;;
 aarch64*-*-freebsd*)	gdb_host=fbsd ;;
 
 alpha*-*-linux*)	gdb_host=alpha-linux ;;
-alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
+alpha*-*-netbsdaout* | alpha*-*-knetbsdaout*-gnu)
 			gdb_host=nbsd ;;
 alpha*-*-openbsd*)	gdb_host=nbsd ;;
 
@@ -96,7 +90,7 @@  arc*-*-linux*)		gdb_host=linux ;;
 
 arm*-*-freebsd*)	gdb_host=fbsd ;;
 arm*-*-linux*)		gdb_host=linux ;;
-arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu)
+arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
 arm*-*-openbsd*)	gdb_host=nbsdelf ;;
 
@@ -106,7 +100,7 @@  hppa*-*-openbsd*)	gdb_host=obsd ;;
 
 i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
 			gdb_host=fbsd ;;
-i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)
+i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
 i[34567]86-*-go32*)	gdb_host=go32 ;;
 i[34567]86-*-mingw32*)	gdb_host=mingw
@@ -124,14 +118,14 @@  i[34567]86-*-cygwin*)	gdb_host=cygwin ;;
 ia64-*-linux*)		gdb_host=linux ;;
 
 m68*-*-linux*)		gdb_host=linux ;;
-m68*-*-netbsdelf* | m68*-*-knetbsd*-gnu)
+m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
 m68*-*-openbsd*)	gdb_host=obsd ;;
 
 m88*-*-openbsd*)	gdb_host=obsd ;;
 
 mips*-*-linux*)		gdb_host=linux ;;
-mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+mips*-*-netbsdaout* | mips*-*-knetbsd*-gnu)
 			gdb_host=nbsd ;;
 mips*-*-freebsd*)	gdb_host=fbsd ;;
 mips64*-*-openbsd*)	gdb_host=obsd64 ;;
@@ -139,7 +133,7 @@  mips64*-*-openbsd*)	gdb_host=obsd64 ;;
 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
 			gdb_host=aix ;;
 powerpc*-*-freebsd*)	gdb_host=fbsd ;;
-powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+powerpc-*-netbsdaout* | powerpc-*-knetbsd*-gnu)
 			gdb_host=nbsd ;;
 powerpc-*-openbsd*)	gdb_host=obsd ;;
 
@@ -151,7 +145,7 @@  riscv*-*-linux*)	gdb_host=linux ;;
 
 s390*-*-linux*)		gdb_host=linux ;;
 
-sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+sh*-*-netbsd* | sh*-*-knetbsd*-gnu)
 			gdb_host=nbsd ;;
 sh*-*-openbsd*)		gdb_host=nbsd ;;
 
@@ -159,7 +153,7 @@  sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
 			gdb_host=fbsd ;;
 sparc-*-linux*)		gdb_host=linux ;;
 sparc64-*-linux*)	gdb_host=linux64 ;;
-sparc-*-netbsdelf* | sparc-*-knetbsd*-gnu)
+sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
 sparc64-*-netbsd* | sparc64-*-knetbsd*-gnu)
 			gdb_host=nbsd64 ;;
@@ -171,7 +165,7 @@  sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
 
 tilegx-*-linux*)	gdb_host=linux ;;
 
-vax-*-netbsdelf* | vax-*-knetbsd*-gnu)
+vax-*-netbsd* | vax-*-knetbsd*-gnu)
 			gdb_host=nbsdelf ;;
 vax-*-openbsd*)		gdb_host=obsd ;;
 
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 5f66cda6b78..cac76f4106c 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -580,7 +580,7 @@  sh*-*-linux*)
 			glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/sh/libsim.a
 	;;
-sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
+sh*-*-netbsd* | sh*-*-knetbsd*-gnu)
 	# Target: NetBSD/sh
 	gdb_target_obs="sh-tdep.o sh-netbsd-tdep.o"
 	gdb_sim=../sim/sh/libsim.a
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index dedcd92f2df..d188c711b83 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -166,11 +166,7 @@  if { "${asm-arch}" == "" } {
 }
 
 # On NetBSD/ELF we need a special NetBSD-identifying note section.
-if { [istarget "*-*-netbsdelf*"]
-     || [istarget "alpha-*-netbsd*"]
-     || [istarget "mips*-*-netbsd*"]
-     || [istarget "powerpc-*-netbsd*"]
-     || [istarget "x86_64-*-netbsd*"] } then {
+if { [istarget "*-*-netbsd*"] && ![istarget "*-*-netbsdaout*"] } then {
     set asm-note "netbsd"
 }
 
diff --git a/intl/configure b/intl/configure
index 2d0b2abec05..78a1691ffce 100755
--- a/intl/configure
+++ b/intl/configure
@@ -6874,7 +6874,7 @@  case "${host}" in
 	PICFLAG=-fpic
 	;;
     # FIXME: Simplify to sh*-*-netbsd*?
-    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
+    sh-*-netbsd* | shl*-*-netbsd* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
       sh64-*-netbsd* | sh64l*-*-netbsd*)
 	PICFLAG=-fpic
 	;;
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 6c535392183..075febff13e 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -135,10 +135,10 @@  arm*-*-freebsd* | arm-*-kfreebsd*-gnu)
 			targ_emul=armelf_fbsd
 			targ_extra_emuls="armelfb_fbsd armelf"
 			;;
-armeb-*-netbsdelf*)	targ_emul=armelfb_nbsd;
+armeb-*-netbsd*)	targ_emul=armelfb_nbsd;
 			targ_extra_emuls="armelf_nbsd armelf"
 			;;
-arm-*-netbsdelf*)	targ_emul=armelf_nbsd;
+arm-*-netbsd*)	targ_emul=armelf_nbsd;
 			targ_extra_emuls="armelfb_nbsd armelf"
 			;;
 arm-*-nto*)		targ_emul=armnto
@@ -340,7 +340,10 @@  i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
 			targ_extra_emuls="elf_i386"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
-i[3-7]86-*-netbsdelf* | \
+i[3-7]86-*-netbsdpe*)	targ_emul=i386pe
+			targ_extra_ofiles="deffilep.o pe-dll.o"
+			;;
+i[3-7]86-*-netbsd* | \
 i[3-7]86-*-netbsd*-gnu* | \
 i[3-7]86-*-knetbsd*-gnu | \
 i[3-7]86-*-openbsd*)
@@ -443,7 +446,7 @@  m68hc11-*-*|m6811-*-*)	targ_emul=m68hc11elf
 m68hc12-*-*|m6812-*-*)	targ_emul=m68hc12elf
 			targ_extra_emuls="m68hc12elfb m68hc11elf m68hc11elfb"
 			;;
-m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
+m68*-*-netbsd*)	targ_emul=m68kelfnbsd
 			;;
 m68*-*-*)		targ_emul=m68kelf
 			;;
@@ -809,10 +812,16 @@  sh*eb-*-linux*)		targ_emul=shelf_linux
 sh*-*-linux*)		targ_emul=shlelf_linux
 			targ_extra_emuls="shlelf_fd"
 			;;
-sh*l*-*-netbsdelf*)	targ_emul=shlelf_nbsd
+sh*l*-*-netbsdaout*)	targ_emul=shl
+			targ_extra_emuls=sh
+			;;
+sh*-*-netbsdaout*)	targ_emul=sh
+			targ_extra_emuls=shl
+			;;
+sh*l*-*-netbsd*)	targ_emul=shlelf_nbsd
 			targ_extra_emuls=shelf_nbsd
 			;;
-sh*-*-netbsdelf*)	targ_emul=shelf_nbsd
+sh*-*-netbsd*)	targ_emul=shelf_nbsd
 			targ_extra_emuls=shlelf_nbsd
 			;;
 shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
@@ -913,13 +922,12 @@  tilepro-*-*)		targ_emul=elf32tilepro
 v850*-*-*)		targ_emul=v850_rh850
 			targ_extra_emuls=v850
 			;;
-vax-*-netbsdelf*)	targ_emul=elf32vax
-			targ_extra_emuls=vaxnbsd
-			;;
-vax-*-netbsdaout* | vax-*-netbsd*)
-			targ_emul=vaxnbsd
+vax-*-netbsdaout*)	targ_emul=vaxnbsd
 			targ_extra_emuls=elf32vax
 			;;
+vax-*-netbsd*)		targ_emul=elf32vax
+			targ_extra_emuls=vaxnbsd
+			;;
 vax-*-linux-*)		targ_emul=elf32vax
 			;;
 visium-*-elf)		targ_emul=elf32visium
@@ -951,19 +959,9 @@  x86_64-*-netbsd* | x86_64-*-openbsd*)
 			targ_emul=elf_x86_64
 			targ_extra_emuls="elf_i386 elf_iamcu elf_l1om elf_k1om"
 			tdir_elf_iamcu=`echo ${targ_alias} | \
-			    sed -e 's/x86_64/i386/'`
-			case "${tdir_elf_iamcu}" in
-			*-netbsdelf*)   ;;
-			*)		tdir_elf_iamcu=`echo ${tdir_elf_iamcu} | \
-					sed -e 's/netbsd/netbsdelf/'`;;
-			esac
+			    sed -e 's/x86_64/i386/' -e 's/aout//'`
 			tdir_elf_i386=`echo ${targ_alias} | \
-			    sed -e 's/x86_64/i386/'`
-			case "${tdir_elf_i386}" in
-			*-netbsdelf*)   ;;
-			*)		tdir_elf_i386=`echo ${tdir_elf_i386} | \
-					sed -e 's/netbsd/netbsdelf/'`;;
-			esac
+			    sed -e 's/x86_64/i386/' -e 's/aout//'`
 			;;
 x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
 			targ_emul=elf_x86_64
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 9bad9b8859b..e94a5b71917 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -235,7 +235,7 @@  set tmp {
 	{{readelf -s script-type.sym}}
 	"script-type"}
 }
-if ![istarget "arm*-*-netbsdelf"] { append armelftests_common $tmp }
+if ![istarget "arm*-*-netbsd*"] { append armelftests_common $tmp }
 
 set tmp {
     {"callweak" "-static -T arm.ld" "" "" {callweak.s}
@@ -433,7 +433,7 @@  run_dump_test "pie-bind-locally"
 
 # Exclude non-ARM-EABI targets.
 
-if { [istarget "arm*-*-netbsdelf"] } {
+if { [istarget "arm*-*-netbsd*"] } {
     return
 }
 
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index e98bffc0c5f..01d22faad9a 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -304,7 +304,7 @@  set array_tests_static {
 }
 
 # NetBSD ELF systems do not currently support the .*_array sections.
-set xfails "*-*-netbsdelf*"
+set xfails "*-*-netbsd*"
 run_ld_link_exec_tests $array_tests $xfails
 
 if { [istarget *-*-linux*]
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index d00358e47ef..4eb5fba94f8 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -1124,7 +1124,7 @@  set run_tests [list \
 ]
 
 # NetBSD ELF systems do not currently support the .*_array sections.
-run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
+run_ld_link_exec_tests $run_tests "*-*-netbsd*"
 
 # These tests require dlopen support.
 set dlopen_run_tests [list \
@@ -1182,7 +1182,7 @@  if [check_libdl_available] {
   # Disable all sanitizers.
   set old_CFLAGS "$CFLAGS"
   append CFLAGS " $NOSANITIZE_CFLAGS"
-  run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsdelf*"
+  run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsd*"
   set CFLAGS "$old_CFLAGS"
 }
 
diff --git a/libiberty/configure b/libiberty/configure
index 9fb28924093..f4169b40e0f 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -5358,9 +5358,7 @@  case "${host}" in
     sh-*-linux* | sh[2346lbe]*-*-linux*)
 	PICFLAG=-fpic
 	;;
-    # FIXME: Simplify to sh*-*-netbsd*?
-    sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
-      sh64-*-netbsd* | sh64l*-*-netbsd*)
+    sh*-*-netbsd*)
 	PICFLAG=-fpic
 	;;
     # Default to -fPIC unless specified otherwise.