[binutils-gdb] sim: enable hardware support by default

Michael Frysinger vapier@sourceware.org
Tue Apr 27 02:31:24 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=66d055c75479e0c51745fc3b40faec6df7a01620

commit 66d055c75479e0c51745fc3b40faec6df7a01620
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri Apr 23 16:24:27 2021 -0400

    sim: enable hardware support by default
    
    Force this on for all ports.  We have a few common models that can
    be used, so make them generally available.  If the port doesn't use
    any hardware (the default), then behavior is unchanged.

Diff:
---
 sim/ChangeLog                  |   4 ++
 sim/aarch64/ChangeLog          |   4 ++
 sim/aarch64/aclocal.m4         |   1 +
 sim/aarch64/config.in          |   6 +++
 sim/aarch64/configure          | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/arm/ChangeLog              |   4 ++
 sim/arm/aclocal.m4             |   1 +
 sim/arm/config.in              |   6 +++
 sim/arm/configure              | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/avr/ChangeLog              |   4 ++
 sim/avr/aclocal.m4             |   1 +
 sim/avr/config.in              |   6 +++
 sim/avr/configure              | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/bpf/ChangeLog              |   4 ++
 sim/bpf/aclocal.m4             |   1 +
 sim/bpf/config.in              |   6 +++
 sim/bpf/configure              | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/cr16/ChangeLog             |   4 ++
 sim/cr16/aclocal.m4            |   1 +
 sim/cr16/config.in             |   6 +++
 sim/cr16/configure             | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/d10v/ChangeLog             |   4 ++
 sim/d10v/aclocal.m4            |   1 +
 sim/d10v/config.in             |   6 +++
 sim/d10v/configure             | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/erc32/ChangeLog            |   4 ++
 sim/erc32/aclocal.m4           |   1 +
 sim/erc32/config.in            |   6 +++
 sim/erc32/configure            | 116 ++++++++++++++++++++++++++++++++++++++---
 sim/example-synacor/ChangeLog  |   4 ++
 sim/example-synacor/aclocal.m4 |   1 +
 sim/example-synacor/config.in  |   6 +++
 sim/example-synacor/configure  | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/frv/ChangeLog              |   5 ++
 sim/frv/configure              |   1 -
 sim/frv/configure.ac           |   2 -
 sim/ft32/ChangeLog             |   4 ++
 sim/ft32/aclocal.m4            |   1 +
 sim/ft32/config.in             |   6 +++
 sim/ft32/configure             | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/h8300/ChangeLog            |   4 ++
 sim/h8300/aclocal.m4           |   1 +
 sim/h8300/config.in            |   6 +++
 sim/h8300/configure            | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/iq2000/ChangeLog           |   5 ++
 sim/iq2000/configure           |   1 -
 sim/iq2000/configure.ac        |   2 -
 sim/m32c/ChangeLog             |   4 ++
 sim/m32c/aclocal.m4            |   1 +
 sim/m32c/config.in             |   6 +++
 sim/m32c/configure             | 116 ++++++++++++++++++++++++++++++++++++++---
 sim/m4/sim_ac_output.m4        |   1 +
 sim/mcore/ChangeLog            |   4 ++
 sim/mcore/aclocal.m4           |   1 +
 sim/mcore/config.in            |   6 +++
 sim/mcore/configure            | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/microblaze/ChangeLog       |   4 ++
 sim/microblaze/aclocal.m4      |   1 +
 sim/microblaze/config.in       |   6 +++
 sim/microblaze/configure       | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/moxie/ChangeLog            |   4 ++
 sim/moxie/aclocal.m4           |   1 +
 sim/moxie/config.in            |   6 +++
 sim/moxie/configure            | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/msp430/ChangeLog           |   4 ++
 sim/msp430/aclocal.m4          |   1 +
 sim/msp430/config.in           |   6 +++
 sim/msp430/configure           | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/or1k/ChangeLog             |   4 ++
 sim/or1k/aclocal.m4            |   1 +
 sim/or1k/config.in             |   6 +++
 sim/or1k/configure             | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/pru/ChangeLog              |   4 ++
 sim/pru/aclocal.m4             |   1 +
 sim/pru/config.in              |   6 +++
 sim/pru/configure              | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/riscv/ChangeLog            |   4 ++
 sim/riscv/aclocal.m4           |   1 +
 sim/riscv/config.in            |   6 +++
 sim/riscv/configure            | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/rl78/ChangeLog             |   4 ++
 sim/rl78/aclocal.m4            |   1 +
 sim/rl78/config.in             |   6 +++
 sim/rl78/configure             | 116 ++++++++++++++++++++++++++++++++++++++---
 sim/rx/ChangeLog               |   4 ++
 sim/rx/aclocal.m4              |   1 +
 sim/rx/config.in               |   6 +++
 sim/rx/configure               | 116 ++++++++++++++++++++++++++++++++++++++---
 sim/sh/ChangeLog               |   4 ++
 sim/sh/aclocal.m4              |   1 +
 sim/sh/config.in               |   6 +++
 sim/sh/configure               | 114 ++++++++++++++++++++++++++++++++++++++--
 sim/v850/ChangeLog             |   4 ++
 sim/v850/aclocal.m4            |   1 +
 sim/v850/config.in             |   6 +++
 sim/v850/configure             | 114 ++++++++++++++++++++++++++++++++++++++--
 96 files changed, 2659 insertions(+), 120 deletions(-)

diff --git a/sim/ChangeLog b/sim/ChangeLog
index fdeed7d8f53..51ca4926c73 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* m4/sim_ac_output.m4 (SIM_AC_OUTPUT): Require SIM_AC_OPTION_HARDWARE.
+
 2021-04-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* README-HACKING (SIM_AC_OPTION_HARDWARE): Delete first two args.
diff --git a/sim/aarch64/ChangeLog b/sim/aarch64/ChangeLog
index 30257c2d836..23736d6b842 100644
--- a/sim/aarch64/ChangeLog
+++ b/sim/aarch64/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/aarch64/aclocal.m4 b/sim/aarch64/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/aarch64/aclocal.m4
+++ b/sim/aarch64/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/aarch64/config.in b/sim/aarch64/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/aarch64/config.in
+++ b/sim/aarch64/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/aarch64/configure b/sim/aarch64/configure
index 22d4678c12f..1d6a498f020 100755
--- a/sim/aarch64/configure
+++ b/sim/aarch64/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12034,6 +12037,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index fbd977c3722..c466deb6fef 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-26  Nick Clifton  <nickc@redhat.com>
 
 	PR 22790
diff --git a/sim/arm/aclocal.m4 b/sim/arm/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/arm/aclocal.m4
+++ b/sim/arm/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/arm/config.in b/sim/arm/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/arm/config.in
+++ b/sim/arm/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/arm/configure b/sim/arm/configure
index 2a74bb745fe..8cabf9261bf 100755
--- a/sim/arm/configure
+++ b/sim/arm/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index c8f51eb0c4e..9c53284bcfc 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/avr/aclocal.m4 b/sim/avr/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/avr/aclocal.m4
+++ b/sim/avr/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/avr/config.in b/sim/avr/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/avr/config.in
+++ b/sim/avr/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/avr/configure b/sim/avr/configure
index ae50e462452..5c43b2964df 100755
--- a/sim/avr/configure
+++ b/sim/avr/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/bpf/ChangeLog b/sim/bpf/ChangeLog
index 90215850213..e5e223122bc 100644
--- a/sim/bpf/ChangeLog
+++ b/sim/bpf/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/bpf/aclocal.m4 b/sim/bpf/aclocal.m4
index 73a795c9e9d..e1659b4fa6a 100644
--- a/sim/bpf/aclocal.m4
+++ b/sim/bpf/aclocal.m4
@@ -118,6 +118,7 @@ m4_include([../m4/sim_ac_option_cgen_maint.m4])
 m4_include([../m4/sim_ac_option_default_model.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_scache.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
diff --git a/sim/bpf/config.in b/sim/bpf/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/bpf/config.in
+++ b/sim/bpf/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/bpf/configure b/sim/bpf/configure
index 31e7c8209af..32b4a77529e 100755
--- a/sim/bpf/configure
+++ b/sim/bpf/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_float
 cgen_breaks
 cgen
@@ -758,6 +755,9 @@ WERROR_CFLAGS
 WARN_CFLAGS
 sim_scache
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_default_model
 sim_bitsize
@@ -792,6 +792,7 @@ enable_werror
 enable_build_warnings
 enable_sim_build_warnings
 enable_cgen_maint
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1457,6 +1458,8 @@ Optional Features:
                           enable SIM specific build-time compiler warnings if
                           gcc is used
   --enable-cgen-maint=DIR build cgen generated files
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11196,7 +11199,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11199 "configure"
+#line 11202 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11302,7 +11305,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11305 "configure"
+#line 11308 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12167,6 +12170,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 4be46d603e8..2540c373471 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* simops.c: Update includes.
diff --git a/sim/cr16/aclocal.m4 b/sim/cr16/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/cr16/aclocal.m4
+++ b/sim/cr16/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/cr16/config.in b/sim/cr16/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/cr16/config.in
+++ b/sim/cr16/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/cr16/configure b/sim/cr16/configure
index f0cfde9164b..b0d92cef4ab 100755
--- a/sim/cr16/configure
+++ b/sim/cr16/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 22d1e8fdf83..9945be49a8f 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/d10v/aclocal.m4 b/sim/d10v/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/d10v/aclocal.m4
+++ b/sim/d10v/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/d10v/config.in b/sim/d10v/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/d10v/config.in
+++ b/sim/d10v/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/d10v/configure b/sim/d10v/configure
index c02a02b8be9..3daef523520 100755
--- a/sim/d10v/configure
+++ b/sim/d10v/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index 0a7d0339f02..a6d1cad8234 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/erc32/aclocal.m4 b/sim/erc32/aclocal.m4
index db8c5cd5c13..ed052697cd9 100644
--- a/sim/erc32/aclocal.m4
+++ b/sim/erc32/aclocal.m4
@@ -113,6 +113,7 @@ m4_include([../../lt~obsolete.m4])
 m4_include([../m4/sim_ac_common.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/erc32/config.in b/sim/erc32/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/erc32/config.in
+++ b/sim/erc32/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/erc32/configure b/sim/erc32/configure
index eab6d868247..a884ee7d2ea 100755
--- a/sim/erc32/configure
+++ b/sim/erc32/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -761,7 +758,10 @@ PATH_SEPARATOR
 SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
-sim_inline'
+sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
@@ -786,6 +786,7 @@ with_bugurl
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1440,6 +1441,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11179,7 +11182,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11182 "configure"
+#line 11185 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11285,7 +11288,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11288 "configure"
+#line 11291 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12072,6 +12075,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/example-synacor/ChangeLog b/sim/example-synacor/ChangeLog
index a5c868bb9ec..886509303d1 100644
--- a/sim/example-synacor/ChangeLog
+++ b/sim/example-synacor/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/example-synacor/aclocal.m4 b/sim/example-synacor/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/example-synacor/aclocal.m4
+++ b/sim/example-synacor/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/example-synacor/config.in b/sim/example-synacor/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/example-synacor/config.in
+++ b/sim/example-synacor/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/example-synacor/configure b/sim/example-synacor/configure
index 7fab5fac9e1..a5938bef338 100755
--- a/sim/example-synacor/configure
+++ b/sim/example-synacor/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index bc981ac1d1e..645239900f3 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete call.
+	* configure: Regenerate.
+
 2021-04-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
diff --git a/sim/frv/configure b/sim/frv/configure
index 30c7c817c13..921f6221f6b 100755
--- a/sim/frv/configure
+++ b/sim/frv/configure
@@ -12231,7 +12231,6 @@ fi
 fi
 
 
-
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index 6588fe5e87e..e5bbdbfba22 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -27,6 +27,4 @@ if test x"$silent" != x"yes" && test x"$sim_trapdump" != x""; then
 fi],[sim_trapdump=""])dnl
 AC_SUBST(sim_trapdump)
 
-SIM_AC_OPTION_HARDWARE
-
 SIM_AC_OUTPUT
diff --git a/sim/ft32/ChangeLog b/sim/ft32/ChangeLog
index 0a06ef30c8d..6a2643622c8 100644
--- a/sim/ft32/ChangeLog
+++ b/sim/ft32/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/ft32/aclocal.m4 b/sim/ft32/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/ft32/aclocal.m4
+++ b/sim/ft32/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/ft32/config.in b/sim/ft32/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/ft32/config.in
+++ b/sim/ft32/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/ft32/configure b/sim/ft32/configure
index 2f14e5a35bb..d80f8f82e18 100755
--- a/sim/ft32/configure
+++ b/sim/ft32/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index 0a02c9c7255..c3daaf4d795 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/h8300/aclocal.m4 b/sim/h8300/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/h8300/aclocal.m4
+++ b/sim/h8300/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/h8300/config.in b/sim/h8300/config.in
index fbed42af1ed..505aa8cf5f9 100644
--- a/sim/h8300/config.in
+++ b/sim/h8300/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/h8300/configure b/sim/h8300/configure
index 682019b1e22..fd7bc25b626 100755
--- a/sim/h8300/configure
+++ b/sim/h8300/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11184,7 +11187,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11187 "configure"
+#line 11190 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11290,7 +11293,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11293 "configure"
+#line 11296 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12032,6 +12035,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index addf3c6387c..ffb7ab9da54 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete call.
+	* configure: Regenerate.
+
 2021-04-23  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac (SIM_AC_OPTION_HARDWARE): Delete arguments.
diff --git a/sim/iq2000/configure b/sim/iq2000/configure
index 21b500c8079..0607bc6db7f 100755
--- a/sim/iq2000/configure
+++ b/sim/iq2000/configure
@@ -12210,7 +12210,6 @@ fi
 fi
 
 
-
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index f21bc804bdd..623fa192d74 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -11,6 +11,4 @@ SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
-SIM_AC_OPTION_HARDWARE
-
 SIM_AC_OUTPUT
diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog
index 2919dc40bc7..c2991c60f86 100644
--- a/sim/m32c/ChangeLog
+++ b/sim/m32c/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/m32c/aclocal.m4 b/sim/m32c/aclocal.m4
index db8c5cd5c13..ed052697cd9 100644
--- a/sim/m32c/aclocal.m4
+++ b/sim/m32c/aclocal.m4
@@ -113,6 +113,7 @@ m4_include([../../lt~obsolete.m4])
 m4_include([../m4/sim_ac_common.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/m32c/config.in b/sim/m32c/config.in
index aaa80a5fa2e..3b33610fa42 100644
--- a/sim/m32c/config.in
+++ b/sim/m32c/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/m32c/configure b/sim/m32c/configure
index 2e2ed73de2c..c0fa44f22a1 100755
--- a/sim/m32c/configure
+++ b/sim/m32c/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -758,7 +755,10 @@ PATH_SEPARATOR
 SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
-sim_inline'
+sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
@@ -783,6 +783,7 @@ with_bugurl
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1437,6 +1438,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11181,7 +11184,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11184 "configure"
+#line 11187 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11287,7 +11290,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11290 "configure"
+#line 11293 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11946,6 +11949,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/m4/sim_ac_output.m4 b/sim/m4/sim_ac_output.m4
index 9ec566d8acd..b18f2540f70 100644
--- a/sim/m4/sim_ac_output.m4
+++ b/sim/m4/sim_ac_output.m4
@@ -22,6 +22,7 @@ dnl the target's fragment at the appropriate points.
 AC_DEFUN([SIM_AC_OUTPUT],
 [dnl
 AC_REQUIRE([SIM_AC_OPTION_WARNINGS])dnl
+AC_REQUIRE([SIM_AC_OPTION_HARDWARE])dnl
 
 dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
 cgen_breaks=""
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index 9e700dc130d..815cd1a7c69 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/mcore/aclocal.m4 b/sim/mcore/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/mcore/aclocal.m4
+++ b/sim/mcore/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/mcore/config.in b/sim/mcore/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/mcore/config.in
+++ b/sim/mcore/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/mcore/configure b/sim/mcore/configure
index 25f04f5db5d..afd78ba0457 100755
--- a/sim/mcore/configure
+++ b/sim/mcore/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12027,6 +12030,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 089c15a8db5..5d6957b7101 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/microblaze/aclocal.m4 b/sim/microblaze/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/microblaze/aclocal.m4
+++ b/sim/microblaze/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/microblaze/config.in b/sim/microblaze/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/microblaze/config.in
+++ b/sim/microblaze/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/microblaze/configure b/sim/microblaze/configure
index 2a74bb745fe..8cabf9261bf 100755
--- a/sim/microblaze/configure
+++ b/sim/microblaze/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index ff2b8ebf3d5..3e74d3fbd57 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/moxie/aclocal.m4 b/sim/moxie/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/moxie/aclocal.m4
+++ b/sim/moxie/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/moxie/config.in b/sim/moxie/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/moxie/config.in
+++ b/sim/moxie/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/moxie/configure b/sim/moxie/configure
index 23e04baa74b..0314c647517 100755
--- a/sim/moxie/configure
+++ b/sim/moxie/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -758,6 +755,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -786,6 +786,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1445,6 +1446,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11184,7 +11187,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11187 "configure"
+#line 11190 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11290,7 +11293,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11293 "configure"
+#line 11296 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12124,6 +12127,107 @@ $as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
 fi
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index ed87e9f5af7..3d14ecbbd59 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/msp430/aclocal.m4 b/sim/msp430/aclocal.m4
index ddeb1f56430..4300d0eac67 100644
--- a/sim/msp430/aclocal.m4
+++ b/sim/msp430/aclocal.m4
@@ -115,6 +115,7 @@ m4_include([../m4/sim_ac_option_alignment.m4])
 m4_include([../m4/sim_ac_option_assert.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
 m4_include([../m4/sim_ac_output.m4])
diff --git a/sim/msp430/config.in b/sim/msp430/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/msp430/config.in
+++ b/sim/msp430/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/msp430/configure b/sim/msp430/configure
index ae50e462452..5c43b2964df 100755
--- a/sim/msp430/configure
+++ b/sim/msp430/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_default_model
 sim_scache
 sim_float
@@ -757,6 +754,9 @@ SHELL
 WERROR_CFLAGS
 WARN_CFLAGS
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_alignment'
 ac_subst_files=''
@@ -785,6 +785,7 @@ enable_sim_alignment
 enable_werror
 enable_build_warnings
 enable_sim_build_warnings
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1444,6 +1445,8 @@ Optional Features:
   --enable-sim-build-warnings
                           enable SIM specific build-time compiler warnings if
                           gcc is used
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11183,7 +11186,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11186 "configure"
+#line 11189 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11289,7 +11292,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11292 "configure"
+#line 11295 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12030,6 +12033,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_log2=yes
+else
+  ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+;;
+  esac
+fi
+
+
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
 cgen_breaks="break cgen_rtx_error";
diff --git a/sim/or1k/ChangeLog b/sim/or1k/ChangeLog
index b4404f0114f..dd34d45653c 100644
--- a/sim/or1k/ChangeLog
+++ b/sim/or1k/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-26  Mike Frysinger  <vapier@gentoo.org>
+
+	* aclocal.m4, config.in, configure: Regenerate.
+
 2021-04-22  Tom Tromey  <tom@tromey.com>
 
 	* configure, config.in: Rebuild.
diff --git a/sim/or1k/aclocal.m4 b/sim/or1k/aclocal.m4
index 73a795c9e9d..e1659b4fa6a 100644
--- a/sim/or1k/aclocal.m4
+++ b/sim/or1k/aclocal.m4
@@ -118,6 +118,7 @@ m4_include([../m4/sim_ac_option_cgen_maint.m4])
 m4_include([../m4/sim_ac_option_default_model.m4])
 m4_include([../m4/sim_ac_option_endian.m4])
 m4_include([../m4/sim_ac_option_environment.m4])
+m4_include([../m4/sim_ac_option_hardware.m4])
 m4_include([../m4/sim_ac_option_inline.m4])
 m4_include([../m4/sim_ac_option_scache.m4])
 m4_include([../m4/sim_ac_option_warnings.m4])
diff --git a/sim/or1k/config.in b/sim/or1k/config.in
index 2416b7f038c..8d37b72597d 100644
--- a/sim/or1k/config.in
+++ b/sim/or1k/config.in
@@ -13,6 +13,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dv-sockser is usable. */
+#undef HAVE_DV_SOCKSER
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -28,6 +31,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
diff --git a/sim/or1k/configure b/sim/or1k/configure
index 4a7f8be385c..9e2040e1969 100755
--- a/sim/or1k/configure
+++ b/sim/or1k/configure
@@ -634,9 +634,6 @@ ac_func_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 sim_reserved_bits
-sim_hw
-sim_hw_objs
-sim_hw_cflags
 sim_float
 cgen_breaks
 cgen
@@ -758,6 +755,9 @@ WERROR_CFLAGS
 WARN_CFLAGS
 sim_scache
 sim_inline
+sim_hw
+sim_hw_objs
+sim_hw_cflags
 sim_endian
 sim_default_model
 sim_bitsize
@@ -792,6 +792,7 @@ enable_werror
 enable_build_warnings
 enable_sim_build_warnings
 enable_cgen_maint
+enable_sim_hardware
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1457,6 +1458,8 @@ Optional Features:
                           enable SIM specific build-time compiler warnings if
                           gcc is used
   --enable-cgen-maint=DIR build cgen generated files
+  --enable-sim-hardware=LIST
+                          Specify the hardware to be included in the build.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -11196,7 +11199,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11199 "configure"
+#line 11202 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11302,7 +11305,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11305 "configure"
+#line 11308 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12189,6 +12192,107 @@ fi
 
 
 
+hardware="cfi core pal glue "
+sim_hw_cflags="-DWITH_HW=1"
+sim_hw="$hardware"
+sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([^ ][^ ]*\)/dv-\1.o/g'`"
+
+# Check whether --enable-sim-hardware was given.
+if test "${enable_sim_hardware+set}" = set; then :
+  enableval=$enable_sim_hardware;
+else
+  enable_sim_hardware="yes"
+fi
+
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+esac
+
+if test "$enable_sim_hardware" = no; then
+  sim_hw_objs=
+  sim_hw_cflags="-DWITH_HW=0"
+  sim_hw=
+else
+  sim_hw_cflags="-DWITH_HW=1"
+  # remove duplicates
+  sim_hw=""
+  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
+  for i in $hardware ; do
+    case " $sim_hw " in
+      *" $i "*) ;;
+      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
+    esac
+  done
+  # mingw does not support sockser
+  case ${host} in
+    *mingw*) ;;
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DV_SOCKSER 1
+_ACEOF
+
+       ;;
+  esac
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
+  fi
+    case " $hardware " in
+    *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if ${ac_cv_lib_m_log2+:} false; then :
+  $as_e[...]

[diff truncated at 100000 bytes]


More information about the Gdb-cvs mailing list