Make *-netbsd mean ELF rather than a.out for all CPU archs

Message ID 20210706195533.1363069-1-git@JohnEricson.me
State Superseded
Headers show
Series
  • Make *-netbsd mean ELF rather than a.out for all CPU archs
Related show

Commit Message

John Ericson July 6, 2021, 7:55 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.

Note that NetBSD target support on master for GDB is currently broken
until [1] lands. With that patch and this one applied, I have confirmed
the following:

--target=i686-unknown-netbsdaout builds completely

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

[1]: https://sourceware.org/pipermail/gdb-patches/2021-July/180722.html
Message is also referenced, for that El Dorado email client which
supports DAG threading.
---
 bfd/config.bfd                             | 48 ++++++++++++++--------
 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                           | 47 ++++++++++-----------
 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, 88 insertions(+), 98 deletions(-)

-- 
2.31.1

Comments

Andrea Corallo via Binutils July 16, 2021, 3:54 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.


One problem with that - the NS32K target.  As far as I can see this target
only supports aout format NetBSD, not ELF...

Possibly NS32K support in NetBSD is entirely deprecated.  If so, then we
can add the ns32k-netbsd target to the obsolete list.  But I would like
to have you confirm this first.


> diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp

> index 59e25df99b0..bfb8911737a 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

>       }

>   


Typo.  The new line should be:

   +   if { [istarget *-*-netbsdaout*] } {

Ie with a closing square parenthesis.

A patch with the typo corrected and NS32K added to the obsolete list in config.bfd
is approved, provided that you can confirm that the NS32K is no longer supported.

Cheers
   Nick
John Ericson July 18, 2021, 10 p.m. | #2
Thanks Nick,

I've asked on the NetBSD "tech-toolchain" list where I fielded these questions before. I've also fixed up the typo on my local branch (https://github.com/Ericson2314/binutils-gdb/tree/netbsd-elf-by-default) so I don't forget. Hope to have a new version to submit soon.

Cheers,

John

On Fri, Jul 16, 2021, at 11:54 AM, Nick Clifton wrote:
> 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.

> 

> One problem with that - the NS32K target.  As far as I can see this target

> only supports aout format NetBSD, not ELF...

> 

> Possibly NS32K support in NetBSD is entirely deprecated.  If so, then we

> can add the ns32k-netbsd target to the obsolete list.  But I would like

> to have you confirm this first.

> 

> 

> > diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp

> > index 59e25df99b0..bfb8911737a 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

> >       }

> >   

> 

> Typo.  The new line should be:

> 

>    +   if { [istarget *-*-netbsdaout*] } {

> 

> Ie with a closing square parenthesis.

> 

> A patch with the typo corrected and NS32K added to the obsolete list in config.bfd

> is approved, provided that you can confirm that the NS32K is no longer supported.

> 

> Cheers

>    Nick

> 

>
John Ericson Aug. 3, 2021, 6:59 p.m. | #3
> A patch with the typo corrected and NS32K added to the obsolete list

> in config.bfd is approved, provided that you can confirm that the

> NS32K is no longer supported.


Sorry to be slow to get back to you, Nick. I believe I've done both of
those things, and also tested it a few ways.

Patch

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 30087e3b8f8..2fe1b6f13d4 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -63,8 +63,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
     ;;
@@ -79,7 +90,7 @@  case $targ in
  a29k-* | \
  arm*-*-aout | \
  arm-*-coff | \
- arm-*-netbsd* | \
+ arm*-*-netbsdaout* | \
  arm-*-openbsd* | \
  arm-*-oabi | \
  arm-*-riscix* | \
@@ -100,7 +111,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* | \
@@ -143,6 +154,7 @@  case $targ in
  mips*el-*-rtems* | \
  powerpc-*-lynxos* | powerpc-*-windiss* | \
  powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin* | \
+ sh*-*-netbsdaout* | \
  sh*-*-symbianelf* | sh5*-*-* | sh64*-*-* | \
  sparc*-*-*aout* | \
  sparc*-*-chorus* | \
@@ -347,11 +359,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"
     ;;
@@ -611,15 +623,15 @@  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)
-    targ_defvec=i386_elf32_vec
-    targ_selvecs="iamcu_elf32_vec"
-    targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
-    ;;
   i[3-7]86-*-netbsdpe*)
     targ_defvec=i386_pe_vec
     targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
     ;;
+  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"
+    ;;
   i[3-7]86-*-openbsd*)
     targ_defvec=i386_elf32_vec
     targ_selvecs="iamcu_elf32_vec"
@@ -1228,11 +1240,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"
     ;;
@@ -1351,17 +1363,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 07a75ed1626..c37fb32b56e 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 59e25df99b0..bfb8911737a 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 338892add2a..22c6caa4e72 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 ;;
@@ -288,7 +288,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 ;;
 
@@ -374,7 +374,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 ;;
@@ -403,7 +403,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 643973917fe..d10b588436c 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -579,7 +579,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 6205d7c9872..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,16 +340,16 @@  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*)
 			targ_emul=elf_i386
 			targ_extra_emuls="elf_iamcu"
 			;;
-i[3-7]86-*-netbsdpe*)	targ_emul=i386pe
-			targ_extra_ofiles="deffilep.o pe-dll.o"
-			;;
 i[3-7]86-*-elfiamcu)	targ_emul=elf_iamcu
 			targ_extra_emuls=elf_i386
 			;;
@@ -446,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
 			;;
@@ -812,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*)
@@ -916,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
@@ -954,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.