diff --git a/sim/aarch64/ChangeLog b/sim/aarch64/ChangeLog
index dc3eee25dd7..b5ef612e6f1 100644
--- a/sim/aarch64/ChangeLog
+++ b/sim/aarch64/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* cpustate.c: Include defs.h.
+	* interp.c: Replace config.h include with defs.h.
+	* memory.c, simulator.c: Likewise.
+	* cpustate.h, simulator.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
index f6b93fbb1a8..6007d74872d 100644
--- a/sim/aarch64/cpustate.c
+++ b/sim/aarch64/cpustate.c
@@ -19,6 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <math.h>
 
diff --git a/sim/aarch64/cpustate.h b/sim/aarch64/cpustate.h
index c3f26376f49..b9e1f92d640 100644
--- a/sim/aarch64/cpustate.h
+++ b/sim/aarch64/cpustate.h
@@ -22,7 +22,6 @@
 #ifndef _CPU_STATE_H
 #define _CPU_STATE_H
 
-#include "config.h"
 #include <sys/types.h>
 #include <stdint.h>
 #include <inttypes.h>
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index cc3cf6add34..fd35f4fa683 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -19,7 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
diff --git a/sim/aarch64/memory.c b/sim/aarch64/memory.c
index aa2f2e5fc22..22caf617074 100644
--- a/sim/aarch64/memory.c
+++ b/sim/aarch64/memory.c
@@ -19,7 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c
index a8391212c06..be1c2987636 100644
--- a/sim/aarch64/simulator.c
+++ b/sim/aarch64/simulator.c
@@ -19,7 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/aarch64/simulator.h b/sim/aarch64/simulator.h
index f80e1f2eba8..5875c843e90 100644
--- a/sim/aarch64/simulator.h
+++ b/sim/aarch64/simulator.h
@@ -22,7 +22,6 @@
 #ifndef _SIMULATOR_H
 #define _SIMULATOR_H
 
-#include "config.h"
 #include <sys/types.h>
 #include <setjmp.h>
 
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index c85e70563ae..aabdae22412 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* armcopro.c, armemu.c, arminit.c, armsupp.c, armvirt.c, iwmmxt.c,
+	maverick.c, thumbemu.c: Include defs.h.
+	* armos.c, wrapper.c: Replace config.h include with defs.h.
+	* armdefs.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/arm/armcopro.c b/sim/arm/armcopro.c
index 9227fc097ac..5cd33fb3ae5 100644
--- a/sim/arm/armcopro.c
+++ b/sim/arm/armcopro.c
@@ -14,6 +14,9 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "armdefs.h"
 #include "armos.h"
 #include "armemu.h"
diff --git a/sim/arm/armdefs.h b/sim/arm/armdefs.h
index 68cf199db6b..7df5d022942 100644
--- a/sim/arm/armdefs.h
+++ b/sim/arm/armdefs.h
@@ -14,7 +14,6 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
-#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c
index f93ad0cee25..ab7454628ba 100644
--- a/sim/arm/armemu.c
+++ b/sim/arm/armemu.c
@@ -15,6 +15,9 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "armdefs.h"
 #include "armemu.h"
 #include "armos.h"
diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c
index 3a626c84674..bc5456f47b7 100644
--- a/sim/arm/arminit.c
+++ b/sim/arm/arminit.c
@@ -14,6 +14,9 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <string.h>
 
 #include "armdefs.h"
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index 72bdf599718..a3713a5c334 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -21,7 +21,9 @@
    fun, and definign VAILDATE will define SWI 1 to enter SVC mode, and SWI
    0x11 to halt the emulator.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ansidecl.h"
 #include "libiberty.h"
 
diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c
index 11bb53c5b70..1a5eeaff1d6 100644
--- a/sim/arm/armsupp.c
+++ b/sim/arm/armsupp.c
@@ -14,6 +14,9 @@
     You should have received a copy of the GNU General Public License
     along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "armdefs.h"
 #include "armemu.h"
 #include "ansidecl.h"
diff --git a/sim/arm/armvirt.c b/sim/arm/armvirt.c
index 4f95ed838f6..ba01a652ebc 100644
--- a/sim/arm/armvirt.c
+++ b/sim/arm/armvirt.c
@@ -22,6 +22,9 @@
    freed as they might be needed again. A single area of memory may be
    defined to generate aborts.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "armos.h"
 #include "armdefs.h"
 #include "ansidecl.h"
diff --git a/sim/arm/iwmmxt.c b/sim/arm/iwmmxt.c
index 8e818248645..c71d06f4c6b 100644
--- a/sim/arm/iwmmxt.c
+++ b/sim/arm/iwmmxt.c
@@ -15,6 +15,9 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/sim/arm/maverick.c b/sim/arm/maverick.c
index 15041b63cc8..fb62ccd8c8c 100644
--- a/sim/arm/maverick.c
+++ b/sim/arm/maverick.c
@@ -15,6 +15,9 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <assert.h>
 #include "armdefs.h"
 #include "ansidecl.h"
diff --git a/sim/arm/thumbemu.c b/sim/arm/thumbemu.c
index fa70d5bfcfb..6915d23ec4c 100644
--- a/sim/arm/thumbemu.c
+++ b/sim/arm/thumbemu.c
@@ -18,6 +18,9 @@
 instruction into its corresponding ARM instruction, and using the
 existing ARM simulator.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #ifndef MODET			/* required for the Thumb instruction support */
 #if 1
 #error "MODET needs to be defined for the Thumb world to work"
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index d25184afa09..a1147e402cc 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -20,7 +20,9 @@
    run.c and gdb (when the simulator is linked with gdb).
    All simulator interaction should go through this file.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h>
diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog
index ce0978394b7..2a979aa6d95 100644
--- a/sim/avr/ChangeLog
+++ b/sim/avr/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index df1f6e55401..75a10efe90a 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -17,7 +17,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <string.h>
 
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 84e1dd34a55..c9b64b11f42 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,3 +1,16 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* bfin-sim.c, devices.c, dv-bfin_cec.c, dv-bfin_ctimer.c,
+	dv-bfin_dma.c, dv-bfin_dmac.c, dv-bfin_ebiu_amc.c,
+	dv-bfin_ebiu_ddrc.c, dv-bfin_ebiu_sdc.c, dv-bfin_emac.c,
+	dv-bfin_eppi.c, dv-bfin_evt.c, dv-bfin_gpio.c, dv-bfin_gpio2.c,
+	dv-bfin_gptimer.c, dv-bfin_jtag.c, dv-bfin_mmu.c, dv-bfin_nfc.c,
+	dv-bfin_otp.c, dv-bfin_pfmon.c, dv-bfin_pint.c, dv-bfin_pll.c,
+	dv-bfin_ppi.c, dv-bfin_rtc.c, dv-bfin_sic.c, dv-bfin_spi.c,
+	dv-bfin_trace.c, dv-bfin_twi.c, dv-bfin_uart.c, dv-bfin_uart2.c,
+	dv-bfin_wdog.c, dv-bfin_wp.c, dv-eth_phy.c, gui.c, interp.c,
+	machs.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c
index 33bbc6e4963..486fe4717ef 100644
--- a/sim/bfin/bfin-sim.c
+++ b/sim/bfin/bfin-sim.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/bfin/devices.c b/sim/bfin/devices.c
index aadb9bcf1f4..97873f6f59e 100644
--- a/sim/bfin/devices.c
+++ b/sim/bfin/devices.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-hw.h"
diff --git a/sim/bfin/dv-bfin_cec.c b/sim/bfin/dv-bfin_cec.c
index 2236830d24d..6179b16ad8a 100644
--- a/sim/bfin/dv-bfin_cec.c
+++ b/sim/bfin/dv-bfin_cec.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_ctimer.c b/sim/bfin/dv-bfin_ctimer.c
index beb4a0e76f8..df62d9487e6 100644
--- a/sim/bfin/dv-bfin_ctimer.c
+++ b/sim/bfin/dv-bfin_ctimer.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_dma.c b/sim/bfin/dv-bfin_dma.c
index e3834d76143..d7dc541dd8c 100644
--- a/sim/bfin/dv-bfin_dma.c
+++ b/sim/bfin/dv-bfin_dma.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdlib.h>
 
diff --git a/sim/bfin/dv-bfin_dmac.c b/sim/bfin/dv-bfin_dmac.c
index ae720cb8b61..d5c608f4cd9 100644
--- a/sim/bfin/dv-bfin_dmac.c
+++ b/sim/bfin/dv-bfin_dmac.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-hw.h"
diff --git a/sim/bfin/dv-bfin_ebiu_amc.c b/sim/bfin/dv-bfin_ebiu_amc.c
index 67f557d29b2..29c4c4a5a9f 100644
--- a/sim/bfin/dv-bfin_ebiu_amc.c
+++ b/sim/bfin/dv-bfin_ebiu_amc.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_ebiu_ddrc.c b/sim/bfin/dv-bfin_ebiu_ddrc.c
index 4206c253778..4160cb210e5 100644
--- a/sim/bfin/dv-bfin_ebiu_ddrc.c
+++ b/sim/bfin/dv-bfin_ebiu_ddrc.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_ebiu_sdc.c b/sim/bfin/dv-bfin_ebiu_sdc.c
index d542f02c082..4af04dcdac4 100644
--- a/sim/bfin/dv-bfin_ebiu_sdc.c
+++ b/sim/bfin/dv-bfin_ebiu_sdc.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_emac.c b/sim/bfin/dv-bfin_emac.c
index 249aef6b9d3..e5ceedbef51 100644
--- a/sim/bfin/dv-bfin_emac.c
+++ b/sim/bfin/dv-bfin_emac.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <errno.h>
 #include <fcntl.h>
diff --git a/sim/bfin/dv-bfin_eppi.c b/sim/bfin/dv-bfin_eppi.c
index ad36a943f20..169895d3dd4 100644
--- a/sim/bfin/dv-bfin_eppi.c
+++ b/sim/bfin/dv-bfin_eppi.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_evt.c b/sim/bfin/dv-bfin_evt.c
index c4cf691da92..e49f4804fe6 100644
--- a/sim/bfin/dv-bfin_evt.c
+++ b/sim/bfin/dv-bfin_evt.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_gpio.c b/sim/bfin/dv-bfin_gpio.c
index 2830aa3847f..bbcc54f0fb5 100644
--- a/sim/bfin/dv-bfin_gpio.c
+++ b/sim/bfin/dv-bfin_gpio.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_gpio2.c b/sim/bfin/dv-bfin_gpio2.c
index 2933ad15b86..61c99802c13 100644
--- a/sim/bfin/dv-bfin_gpio2.c
+++ b/sim/bfin/dv-bfin_gpio2.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_gptimer.c b/sim/bfin/dv-bfin_gptimer.c
index 8f2b476eeb6..3dfa2b58e91 100644
--- a/sim/bfin/dv-bfin_gptimer.c
+++ b/sim/bfin/dv-bfin_gptimer.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_jtag.c b/sim/bfin/dv-bfin_jtag.c
index d97b9eac822..12629970cc8 100644
--- a/sim/bfin/dv-bfin_jtag.c
+++ b/sim/bfin/dv-bfin_jtag.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_mmu.c b/sim/bfin/dv-bfin_mmu.c
index cbaaaa2cae1..cadc9df552e 100644
--- a/sim/bfin/dv-bfin_mmu.c
+++ b/sim/bfin/dv-bfin_mmu.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-options.h"
diff --git a/sim/bfin/dv-bfin_nfc.c b/sim/bfin/dv-bfin_nfc.c
index a26cb139903..80fe49da72c 100644
--- a/sim/bfin/dv-bfin_nfc.c
+++ b/sim/bfin/dv-bfin_nfc.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_otp.c b/sim/bfin/dv-bfin_otp.c
index e11e04e9672..6cf1c8155c6 100644
--- a/sim/bfin/dv-bfin_otp.c
+++ b/sim/bfin/dv-bfin_otp.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_pfmon.c b/sim/bfin/dv-bfin_pfmon.c
index 2216c064569..bffe67b18a0 100644
--- a/sim/bfin/dv-bfin_pfmon.c
+++ b/sim/bfin/dv-bfin_pfmon.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_pint.c b/sim/bfin/dv-bfin_pint.c
index 90b3190c025..b4f4f40ab65 100644
--- a/sim/bfin/dv-bfin_pint.c
+++ b/sim/bfin/dv-bfin_pint.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_pll.c b/sim/bfin/dv-bfin_pll.c
index 5ba1a6afafc..e2a5f5cd55c 100644
--- a/sim/bfin/dv-bfin_pll.c
+++ b/sim/bfin/dv-bfin_pll.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "machs.h"
diff --git a/sim/bfin/dv-bfin_ppi.c b/sim/bfin/dv-bfin_ppi.c
index e319df91440..a67dc5eecb0 100644
--- a/sim/bfin/dv-bfin_ppi.c
+++ b/sim/bfin/dv-bfin_ppi.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_rtc.c b/sim/bfin/dv-bfin_rtc.c
index 5486ac8287f..06ae4249d6e 100644
--- a/sim/bfin/dv-bfin_rtc.c
+++ b/sim/bfin/dv-bfin_rtc.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <time.h>
 #include "sim-main.h"
diff --git a/sim/bfin/dv-bfin_sic.c b/sim/bfin/dv-bfin_sic.c
index 94e55f21eea..cc90a4cf22a 100644
--- a/sim/bfin/dv-bfin_sic.c
+++ b/sim/bfin/dv-bfin_sic.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_spi.c b/sim/bfin/dv-bfin_spi.c
index 8fdd9dbc514..c0869fcf77c 100644
--- a/sim/bfin/dv-bfin_spi.c
+++ b/sim/bfin/dv-bfin_spi.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_trace.c b/sim/bfin/dv-bfin_trace.c
index ab8220f7a19..56fad63cd3e 100644
--- a/sim/bfin/dv-bfin_trace.c
+++ b/sim/bfin/dv-bfin_trace.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_twi.c b/sim/bfin/dv-bfin_twi.c
index 87794f53852..00b080f122c 100644
--- a/sim/bfin/dv-bfin_twi.c
+++ b/sim/bfin/dv-bfin_twi.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_uart.c b/sim/bfin/dv-bfin_uart.c
index d0136217502..7aa843065b8 100644
--- a/sim/bfin/dv-bfin_uart.c
+++ b/sim/bfin/dv-bfin_uart.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "dv-sockser.h"
diff --git a/sim/bfin/dv-bfin_uart2.c b/sim/bfin/dv-bfin_uart2.c
index 2fd540164dc..a7985889f87 100644
--- a/sim/bfin/dv-bfin_uart2.c
+++ b/sim/bfin/dv-bfin_uart2.c
@@ -19,7 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-bfin_wdog.c b/sim/bfin/dv-bfin_wdog.c
index 4be19aa6458..850ae0618df 100644
--- a/sim/bfin/dv-bfin_wdog.c
+++ b/sim/bfin/dv-bfin_wdog.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "dv-sockser.h"
diff --git a/sim/bfin/dv-bfin_wp.c b/sim/bfin/dv-bfin_wp.c
index 28626a569f8..189c121d97a 100644
--- a/sim/bfin/dv-bfin_wp.c
+++ b/sim/bfin/dv-bfin_wp.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/dv-eth_phy.c b/sim/bfin/dv-eth_phy.c
index 14aafee9192..486054277c2 100644
--- a/sim/bfin/dv-eth_phy.c
+++ b/sim/bfin/dv-eth_phy.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "devices.h"
diff --git a/sim/bfin/gui.c b/sim/bfin/gui.c
index 029a22ef3b5..8e84d2dff96 100644
--- a/sim/bfin/gui.c
+++ b/sim/bfin/gui.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #ifdef HAVE_SDL
 # include <SDL.h>
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index aa5c245c829..8e3a1214b78 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/bfin/machs.c b/sim/bfin/machs.c
index a2060e8d898..e94af5d0f5b 100644
--- a/sim/bfin/machs.c
+++ b/sim/bfin/machs.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdlib.h>
 
diff --git a/sim/bpf/ChangeLog b/sim/bpf/ChangeLog
index 689c76bd45b..69156e6fa1d 100644
--- a/sim/bpf/ChangeLog
+++ b/sim/bpf/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* bpf-helpers.c, bpf.c, sim-if.c, traps.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/bpf/bpf-helpers.c b/sim/bpf/bpf-helpers.c
index d7760d57266..c308812ab1c 100644
--- a/sim/bpf/bpf-helpers.c
+++ b/sim/bpf/bpf-helpers.c
@@ -21,6 +21,9 @@
    implementation of the helpers, which can be customized by the
    user.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_BPFBF
 #define WANT_CPU bpfbf
 
diff --git a/sim/bpf/bpf.c b/sim/bpf/bpf.c
index a0cc803da82..c626781adbf 100644
--- a/sim/bpf/bpf.c
+++ b/sim/bpf/bpf.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_BPFBF
 #define WANT_CPU bpfbf
 
diff --git a/sim/bpf/sim-if.c b/sim/bpf/sim-if.c
index c2c01fc547a..185e96dd7b9 100644
--- a/sim/bpf/sim-if.c
+++ b/sim/bpf/sim-if.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 
 #include "sim-main.h"
diff --git a/sim/bpf/traps.c b/sim/bpf/traps.c
index b58d17f0401..85da1cba02e 100644
--- a/sim/bpf/traps.c
+++ b/sim/bpf/traps.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU bpfbf
 #define WANT_CPU_BPFBF
 
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index b221166212a..1d875bb1cbd 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,24 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* callback.c: Replace config.h include with defs.h.
+	* cgen-accfp.c, cgen-fpu.c, cgen-par.c, cgen-run.c, cgen-scache.c,
+	dv-core.c, dv-glue.c, genmloop.sh, hw-alloc.c, hw-base.c, hw-device.c,
+	hw-events.c, hw-handles.c, hw-instances.c, hw-ports.c,
+	hw-properties.c, hw-tree.c, sim-abort.c, sim-arange.c, sim-bits.c,
+	sim-close.c, sim-command.c, sim-config.c, sim-core.c, sim-cpu.c,
+	sim-endian.c, sim-engine.c, sim-events.c, sim-fpu.c, sim-hload.c,
+	sim-hrw.c, sim-hw.c, sim-info.c, sim-inline.c, sim-model.c,
+	sim-profile.c, sim-reason.c, sim-reg.c, sim-resume.c, sim-run.c,
+	sim-signal.c, sim-stop.c, sim-trace.c, sim-utils.c: Include defs.h.
+	* cgen-trace.c, cgen-utils.c, dv-cfi.c, dv-pal.c, dv-sockser.c,
+	nrun.c, sim-basics.h, sim-load.c, sim-memopt.c, sim-module.c,
+	sim-options.c, sim-syscall.c, sim-watch.c, syscall.c: Replace
+	config.h include with defs.h.
+	* gentmap.c (gen_targ_map_c): Replace config.h with defs.h.
+	* sim-io.c: Include defs.h.
+	(open): Undefine.
+	* defs.h: New file.
+
 2021-05-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* nrun.c: Include environ.h.
diff --git a/sim/common/callback.c b/sim/common/callback.c
index 24ea47025e1..f2587a45254 100644
--- a/sim/common/callback.c
+++ b/sim/common/callback.c
@@ -20,9 +20,9 @@
 /* This file provides a standard way for targets to talk to the host OS
    level.  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ansidecl.h"
 #include <stdarg.h>
 #include <stdio.h>
diff --git a/sim/common/cgen-accfp.c b/sim/common/cgen-accfp.c
index d6cd751e2b0..345cfe81eb2 100644
--- a/sim/common/cgen-accfp.c
+++ b/sim/common/cgen-accfp.c
@@ -11,6 +11,9 @@
    - proper rounding
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-fpu.h"
 
diff --git a/sim/common/cgen-fpu.c b/sim/common/cgen-fpu.c
index 3a8d5199bea..1b035eae343 100644
--- a/sim/common/cgen-fpu.c
+++ b/sim/common/cgen-fpu.c
@@ -1,6 +1,9 @@
 /* CGEN fpu support
    Copyright (C) 1999 Cygnus Solutions.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-fpu.h"
 
diff --git a/sim/common/cgen-par.c b/sim/common/cgen-par.c
index 4cf0388e16f..b535edfdaec 100644
--- a/sim/common/cgen-par.c
+++ b/sim/common/cgen-par.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include <stdlib.h>
 #include "cgen-mem.h"
diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c
index 1458c4e5d15..443b62a0bbc 100644
--- a/sim/common/cgen-run.c
+++ b/sim/common/cgen-run.c
@@ -33,6 +33,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    When the framework is more modular, this can be.
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c
index 56df075f680..f1c75714840 100644
--- a/sim/common/cgen-scache.c
+++ b/sim/common/cgen-scache.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define SCACHE_DEFINE_INLINE
 
 #include "sim-main.h"
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index ea0399fdb6e..66250c09be7 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <errno.h>
 #include <stdlib.h>
 #include "dis-asm.h"
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 602abcba182..890ed0218d1 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "bfd.h"
 #include "sim-main.h"
 #include "dis-asm.h"
diff --git a/sim/common/defs.h b/sim/common/defs.h
new file mode 100644
index 00000000000..3a0737cb9b8
--- /dev/null
+++ b/sim/common/defs.h
@@ -0,0 +1,30 @@
+/* The configure generated header settings.
+
+   Copyright 2002-2021 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This file should be included by every .c file before any other header.  */
+
+#ifndef DEFS_H
+#define DEFS_H
+
+#ifdef HAVE_CONFIG_H
+
+/* Include sim's various configure tests.  */
+#include "config.h"
+
+#endif
+
+#endif
diff --git a/sim/common/dv-cfi.c b/sim/common/dv-cfi.c
index b8652271752..02a2cedd558 100644
--- a/sim/common/dv-cfi.c
+++ b/sim/common/dv-cfi.c
@@ -22,7 +22,8 @@
 
 /* TODO: support vendor query tables.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <math.h>
 #include <errno.h>
diff --git a/sim/common/dv-core.c b/sim/common/dv-core.c
index be56aa46295..c596da45c98 100644
--- a/sim/common/dv-core.c
+++ b/sim/common/dv-core.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/common/dv-glue.c b/sim/common/dv-glue.c
index 8bda3261578..7c8e1f877af 100644
--- a/sim/common/dv-glue.c
+++ b/sim/common/dv-glue.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 
diff --git a/sim/common/dv-pal.c b/sim/common/dv-pal.c
index dd4ab4fb390..c60f524ea8e 100644
--- a/sim/common/dv-pal.c
+++ b/sim/common/dv-pal.c
@@ -19,7 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 #include "sim-io.h"
diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c
index 73c473b15c0..ef652f62f46 100644
--- a/sim/common/dv-sockser.c
+++ b/sim/common/dv-sockser.c
@@ -18,7 +18,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* FIXME: will obviously need to evolve.
    - connectionless sockets might be more appropriate.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 
 #include <string.h>
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index 460a26c31e5..fa4e7b90a51 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -301,6 +301,9 @@ exec 1>tmp-mloop-$$.cin
 cat << EOF
 /* This file is generated by the genmloop script.  DO NOT EDIT! */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 /* Enable switch() support in cgen headers.  */
 #define SEM_IN_SWITCH
 
diff --git a/sim/common/gentmap.c b/sim/common/gentmap.c
index 8085c3576ac..254ec3f1119 100644
--- a/sim/common/gentmap.c
+++ b/sim/common/gentmap.c
@@ -67,7 +67,7 @@ gen_targ_map_c (void)
   printf ("/* Target value mapping utilities needed by the simulator and gdb.  */\n");
   printf ("/* This file is machine generated by gentmap.c.  */\n\n");
 
-  printf ("#include \"config.h\"\n");
+  printf ("#include \"defs.h\"\n");
   printf ("#include <errno.h>\n");
   printf ("#include <fcntl.h>\n");
   printf ("#include \"ansidecl.h\"\n");
diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c
index 141dc21167f..a16666b931a 100644
--- a/sim/common/hw-alloc.c
+++ b/sim/common/hw-alloc.c
@@ -17,6 +17,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c
index af8b1812489..af4cc50f1a4 100644
--- a/sim/common/hw-base.c
+++ b/sim/common/hw-base.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c
index bc91264c020..9b743ead1f2 100644
--- a/sim/common/hw-device.c
+++ b/sim/common/hw-device.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index 81628f0b642..620b47d5255 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -17,6 +17,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index bbd08f632fd..fb878e49277 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-instances.c b/sim/common/hw-instances.c
index 6227c0a2343..9d786198fd5 100644
--- a/sim/common/hw-instances.c
+++ b/sim/common/hw-instances.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-ports.c b/sim/common/hw-ports.c
index 50e2cbc30e4..fbc7278ddd1 100644
--- a/sim/common/hw-ports.c
+++ b/sim/common/hw-ports.c
@@ -17,6 +17,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/hw-properties.c b/sim/common/hw-properties.c
index 11a371cea00..3836aa73527 100644
--- a/sim/common/hw-properties.c
+++ b/sim/common/hw-properties.c
@@ -19,6 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "hw-main.h"
 #include "hw-base.h"
 
diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c
index 4d50ec6ed62..1bf4edab746 100644
--- a/sim/common/hw-tree.c
+++ b/sim/common/hw-tree.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "hw-main.h"
 #include "hw-base.h"
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index 8a1b3c19acc..2cccff6a211 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -15,9 +15,7 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Need to be before general includes, to pick up e.g. _GNU_SOURCE.  */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "defs.h"
 
 #include <signal.h>
 #include <stdlib.h>
diff --git a/sim/common/sim-abort.c b/sim/common/sim-abort.c
index bf05504255f..06df127c19c 100644
--- a/sim/common/sim-abort.c
+++ b/sim/common/sim-abort.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c
index a40dabbeb7d..5a28a2c0c49 100644
--- a/sim/common/sim-arange.c
+++ b/sim/common/sim-arange.c
@@ -20,6 +20,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef _SIM_ARANGE_C_
 #define _SIM_ARANGE_C_
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "libiberty.h"
 #include "sim-basics.h"
 #include "sim-arange.h"
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index 7d9c831da51..25c1193dca4 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -26,9 +26,7 @@
 
 /* Basic configuration */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "defs.h"
 
 /* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
    bring potential conflicts out in the open */
diff --git a/sim/common/sim-bits.c b/sim/common/sim-bits.c
index 9e9063cb594..4be07521b00 100644
--- a/sim/common/sim-bits.c
+++ b/sim/common/sim-bits.c
@@ -23,6 +23,9 @@
 #ifndef _SIM_BITS_C_
 #define _SIM_BITS_C_
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-basics.h"
 #include "sim-assert.h"
 #include "sim-io.h"
diff --git a/sim/common/sim-close.c b/sim/common/sim-close.c
index e64d59e6361..c774d453bfd 100644
--- a/sim/common/sim-close.c
+++ b/sim/common/sim-close.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-module.h"
 #include "sim/sim.h"
diff --git a/sim/common/sim-command.c b/sim/common/sim-command.c
index d49ac8a2628..b5ba2c05054 100644
--- a/sim/common/sim-command.c
+++ b/sim/common/sim-command.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "sim-utils.h"
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index 2acd1e4f77a..df99d6a957f 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-assert.h"
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index 222f9fd8fe9..6604f31ea97 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -23,6 +23,9 @@
 #ifndef SIM_CORE_C
 #define SIM_CORE_C
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "libiberty.h"
diff --git a/sim/common/sim-cpu.c b/sim/common/sim-cpu.c
index 552e48c1970..587a3e8c9e1 100644
--- a/sim/common/sim-cpu.c
+++ b/sim/common/sim-cpu.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 
 #include "sim-main.h"
diff --git a/sim/common/sim-endian.c b/sim/common/sim-endian.c
index 395b487ee81..5f0e46a84e5 100644
--- a/sim/common/sim-endian.c
+++ b/sim/common/sim-endian.c
@@ -23,6 +23,9 @@
 #ifndef _SIM_ENDIAN_C_
 #define _SIM_ENDIAN_C_
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-basics.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-engine.c b/sim/common/sim-engine.c
index fcdf284127f..a5f84af2801 100644
--- a/sim/common/sim-engine.c
+++ b/sim/common/sim-engine.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index 60e4c55a874..5a5798d102a 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -23,6 +23,9 @@
 #ifndef _SIM_EVENTS_C_
 #define _SIM_EVENTS_C_
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-cpu.h"
diff --git a/sim/common/sim-fpu.c b/sim/common/sim-fpu.c
index bff5b08b5e5..fe8ecf8a3ce 100644
--- a/sim/common/sim-fpu.c
+++ b/sim/common/sim-fpu.c
@@ -35,6 +35,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef SIM_FPU_C
 #define SIM_FPU_C
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-basics.h"
 #include "sim-fpu.h"
 
diff --git a/sim/common/sim-hload.c b/sim/common/sim-hload.c
index 243437dba17..f33dcf6368a 100644
--- a/sim/common/sim-hload.c
+++ b/sim/common/sim-hload.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "bfd.h"
 #include "sim-utils.h"
diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c
index 920cc160688..3df91d2b712 100644
--- a/sim/common/sim-hrw.c
+++ b/sim/common/sim-hrw.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 984817f25fd..95d95042ded 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-options.h"
diff --git a/sim/common/sim-info.c b/sim/common/sim-info.c
index 7dcb656f815..3c92c87faab 100644
--- a/sim/common/sim-info.c
+++ b/sim/common/sim-info.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-inline.c b/sim/common/sim-inline.c
index 93ea6f03cad..7c3edd0d1cd 100644
--- a/sim/common/sim-inline.c
+++ b/sim/common/sim-inline.c
@@ -26,6 +26,9 @@
 #undef SIM_INLINE_P
 #define SIM_INLINE_P 1
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-inline.h"
 #include "sim-main.h"
 
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index edef26e8e12..b5e874bef79 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -19,6 +19,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-io.h"
@@ -35,6 +37,8 @@
 
 #include <stdlib.h>
 
+#undef open
+
 /* Define the rate at which the simulator should poll the host
    for a quit. */
 #ifndef POLL_QUIT_INTERVAL
diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index b9d85ca2fd6..3ea50e7fbcd 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -18,9 +18,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    as it is used by simulators that don't use it [though that doesn't mean
    to suggest that they shouldn't :-)].  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ansidecl.h"
 #include <stdio.h> /* for NULL */
 #include <stdarg.h>
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index a102d74ecd0..636f6a9a0fe 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -17,7 +17,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-assert.h"
diff --git a/sim/common/sim-model.c b/sim/common/sim-model.c
index 5596656eff5..e1af9d4b1e4 100644
--- a/sim/common/sim-model.c
+++ b/sim/common/sim-model.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-model.h"
 #include "libiberty.h"
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index 3bb7db0df76..97d619c4aed 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -19,7 +19,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-io.h"
 #include "sim-options.h"
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index ff325e6cc5f..06bd5826ef7 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index 455e1a246d9..f2d65e09303 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-io.h"
 #include "sim-options.h"
diff --git a/sim/common/sim-reason.c b/sim/common/sim-reason.c
index 0f128c2a424..73a57654c24 100644
--- a/sim/common/sim-reason.c
+++ b/sim/common/sim-reason.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-reg.c b/sim/common/sim-reg.c
index 457ac223da3..ee340884aa3 100644
--- a/sim/common/sim-reg.c
+++ b/sim/common/sim-reg.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c
index 6fe9a4233f6..8f854da8475 100644
--- a/sim/common/sim-resume.c
+++ b/sim/common/sim-resume.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-run.c b/sim/common/sim-run.c
index 54f6286f09e..f2e477e3361 100644
--- a/sim/common/sim-run.c
+++ b/sim/common/sim-run.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-signal.c b/sim/common/sim-signal.c
index 9596847af55..f9fef4c24c6 100644
--- a/sim/common/sim-signal.c
+++ b/sim/common/sim-signal.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include "sim-main.h"
 
diff --git a/sim/common/sim-stop.c b/sim/common/sim-stop.c
index 305c455dc49..aa48fc3e6f3 100644
--- a/sim/common/sim-stop.c
+++ b/sim/common/sim-stop.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-syscall.c b/sim/common/sim-syscall.c
index 9dbc71ac9fb..0f7601cafd7 100644
--- a/sim/common/sim-syscall.c
+++ b/sim/common/sim-syscall.c
@@ -17,7 +17,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <errno.h>
 
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index 26d9556322c..b8224e0b834 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-io.h"
 #include "sim-options.h"
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 86ab059744c..abb87f8c5a0 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 8630b063bb6..fa035b38054 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "libiberty.h"
diff --git a/sim/common/syscall.c b/sim/common/syscall.c
index 0a1d3f4114d..4e76d2008a3 100644
--- a/sim/common/syscall.c
+++ b/sim/common/syscall.c
@@ -23,9 +23,9 @@
    tree, nor should it live in the gdb source tree.  K&R C must be
    supported.  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ansidecl.h"
 #include "libiberty.h"
 #include <stdarg.h>
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index d311b2db6f3..1a7341d2e8e 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,3 +1,12 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* cr16_sim.h: Delete config.h include.
+	* gencode.c: Replace config.h include with defs.h.
+	(write_template): Output defs.h include.
+	(write_opcodes): Likewise.
+	* interp.c: Replace config.h include with defs.h.
+	* simops.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/cr16/cr16_sim.h b/sim/cr16/cr16_sim.h
index c3d590d537b..a865d093648 100644
--- a/sim/cr16/cr16_sim.h
+++ b/sim/cr16/cr16_sim.h
@@ -18,7 +18,6 @@
    along with this program. If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#include "config.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <limits.h>
diff --git a/sim/cr16/gencode.c b/sim/cr16/gencode.c
index 335ab2607fc..30fda931c8c 100644
--- a/sim/cr16/gencode.c
+++ b/sim/cr16/gencode.c
@@ -17,8 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <limits.h>
@@ -67,6 +68,7 @@ write_template (void)
 {
   int i = 0,j, k, flags;
 
+  printf ("#include \"defs.h\"\n");
   printf ("#include \"sim-main.h\"\n");
   printf ("#include \"simops.h\"\n\n");
 
@@ -131,6 +133,7 @@ write_opcodes (void)
   int i = 0, j = 0, k;
   
   /* write out opcode table.  */
+  printf ("#include \"defs.h\"\n");
   printf ("#include \"sim-main.h\"\n");
   printf ("#include \"simops.h\"\n\n");
   printf ("struct simops Simops[] = {\n");
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 7db7f56e21b..7f6b07fe286 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -17,7 +17,9 @@
    You should have received a copy of the GNU General Public License 
    along with this program. If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <inttypes.h>
 #include <signal.h>
 #include <stdlib.h>
diff --git a/sim/cr16/simops.c b/sim/cr16/simops.c
index ca96dd07588..b383dfa1f92 100644
--- a/sim/cr16/simops.c
+++ b/sim/cr16/simops.c
@@ -17,8 +17,8 @@
    You should have received a copy of the GNU General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.  */
 
-
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <signal.h>
 #include <errno.h>
diff --git a/sim/cris/ChangeLog b/sim/cris/ChangeLog
index 01645b57f93..80b0d7cb736 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* cris-tmpl.c, crisv10f.c, crisv32f.c, dv-cris.c, dv-cris_900000xx.c,
+	dv-rv.c, traps.c: Include defs.h.
+	* rvdummy.c, sim-if.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/cris/cris-tmpl.c b/sim/cris/cris-tmpl.c
index 95579dbffa9..c1153058cfb 100644
--- a/sim/cris/cris-tmpl.c
+++ b/sim/cris/cris-tmpl.c
@@ -19,6 +19,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* The infrastructure is based on that of i960.c.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 
 #include "sim-main.h"
diff --git a/sim/cris/crisv10f.c b/sim/cris/crisv10f.c
index 69bfbc851e9..c649eff691e 100644
--- a/sim/cris/crisv10f.c
+++ b/sim/cris/crisv10f.c
@@ -19,6 +19,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* The infrastructure is based on that of i960.c.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_CRISV10F
 
 #define BASENUM 10
diff --git a/sim/cris/crisv32f.c b/sim/cris/crisv32f.c
index 1e4a4fa48e5..656be733b4e 100644
--- a/sim/cris/crisv32f.c
+++ b/sim/cris/crisv32f.c
@@ -19,6 +19,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* The infrastructure is based on that of i960.c.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_CRISV32F
 
 #define SPECIFIC_U_EXEC_FN
diff --git a/sim/cris/dv-cris.c b/sim/cris/dv-cris.c
index 1bb89e48f70..b4251d0b5e4 100644
--- a/sim/cris/dv-cris.c
+++ b/sim/cris/dv-cris.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 
diff --git a/sim/cris/dv-cris_900000xx.c b/sim/cris/dv-cris_900000xx.c
index c6afe020c86..5cecdc7b0a5 100644
--- a/sim/cris/dv-cris_900000xx.c
+++ b/sim/cris/dv-cris_900000xx.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 
diff --git a/sim/cris/dv-rv.c b/sim/cris/dv-rv.c
index cef164b0983..310155c8442 100644
--- a/sim/cris/dv-rv.c
+++ b/sim/cris/dv-rv.c
@@ -18,6 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/cris/rvdummy.c b/sim/cris/rvdummy.c
index 788f8edb504..b53e823f8f7 100644
--- a/sim/cris/rvdummy.c
+++ b/sim/cris/rvdummy.c
@@ -29,9 +29,8 @@ main (int argc, char *argv[])
 }
 #else
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "getopt.h"
 #include "libiberty.h"
diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c
index 388d1ef8962..15a4018b5b7 100644
--- a/sim/cris/sim-if.c
+++ b/sim/cris/sim-if.c
@@ -20,7 +20,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Based on the fr30 file, mixing in bits from the i960 and pruning of
    dead code.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "libiberty.h"
 #include "bfd.h"
 #include "elf-bfd.h"
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index 483747fb4e0..99344a283df 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "sim-options.h"
diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog
index 622a9111ec0..bce1617d90e 100644
--- a/sim/d10v/ChangeLog
+++ b/sim/d10v/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* d10v_sim.h, gencode.c: Delete config.h include.
+	* endian.c: Include defs.h.
+	* interp.c, simops.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/d10v/d10v_sim.h b/sim/d10v/d10v_sim.h
index 972402cc4d0..1e1e84c76a8 100644
--- a/sim/d10v/d10v_sim.h
+++ b/sim/d10v/d10v_sim.h
@@ -1,4 +1,3 @@
-#include "config.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <limits.h>
diff --git a/sim/d10v/endian.c b/sim/d10v/endian.c
index dbc3db20034..70f63d8e544 100644
--- a/sim/d10v/endian.c
+++ b/sim/d10v/endian.c
@@ -1,6 +1,9 @@
 /* If we're being compiled as a .c file, rather than being included in
    d10v_sim.h, then ENDIAN_INLINE won't be defined yet.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #ifndef ENDIAN_INLINE
 #define NO_ENDIAN_INLINE
 #include "sim-main.h"
diff --git a/sim/d10v/gencode.c b/sim/d10v/gencode.c
index 9f8a41c9369..6e006d089a6 100644
--- a/sim/d10v/gencode.c
+++ b/sim/d10v/gencode.c
@@ -1,4 +1,3 @@
-#include "config.h"
 #include <stdio.h>
 #include <ctype.h>
 #include <limits.h>
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index a0dc2f59685..b56b204c72d 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -1,4 +1,6 @@
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <inttypes.h>
 #include <signal.h>
 #include "bfd.h"
diff --git a/sim/d10v/simops.c b/sim/d10v/simops.c
index ed0c8a36259..af725ad9bb9 100644
--- a/sim/d10v/simops.c
+++ b/sim/d10v/simops.c
@@ -1,4 +1,5 @@
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <signal.h>
 #include <errno.h>
diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index 40dd9310793..355880e22af 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* erc32.c, exec.c, float.c, func.c, help.c, interf.c, sis.c: Replace
+	config.h include with defs.h.
+	* sis.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
index a93b62b798c..747ac780b89 100644
--- a/sim/erc32/erc32.c
+++ b/sim/erc32/erc32.c
@@ -18,7 +18,9 @@
 
 /* The control space devices */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c
index 8daf759514e..d8a8c6c662b 100644
--- a/sim/erc32/exec.c
+++ b/sim/erc32/exec.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sis.h"
 #include <math.h>
 #include <stdio.h>
diff --git a/sim/erc32/float.c b/sim/erc32/float.c
index 6d3d2bd73d2..d2ae39785a3 100644
--- a/sim/erc32/float.c
+++ b/sim/erc32/float.c
@@ -26,7 +26,9 @@
      4. Clear host exception bits.
  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sis.h"
 #include <fenv.h>
 
diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index 52428e48350..ff53f3bca51 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/sim/erc32/help.c b/sim/erc32/help.c
index 419ab0d33ef..211de52f536 100644
--- a/sim/erc32/help.c
+++ b/sim/erc32/help.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include "sis.h"
 
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index c199dabea37..28c981bbb92 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <string.h>
 #include <stdio.h>
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index 05044c3ad8f..749d25620b4 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 10c500f820a..7f787cf1433 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -13,7 +13,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
 #include "ansidecl.h"
 #include "sim/callback.h"
 #include "sim/sim.h"
diff --git a/sim/example-synacor/ChangeLog b/sim/example-synacor/ChangeLog
index 0f91ff2727f..ddd56b2ea8f 100644
--- a/sim/example-synacor/ChangeLog
+++ b/sim/example-synacor/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c, sim-main.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/example-synacor/interp.c b/sim/example-synacor/interp.c
index e613e167828..eaf8f1fdf97 100644
--- a/sim/example-synacor/interp.c
+++ b/sim/example-synacor/interp.c
@@ -25,7 +25,8 @@
    For more specific details on these functions, see the sim/sim.h header
    file.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-options.h"
diff --git a/sim/example-synacor/sim-main.c b/sim/example-synacor/sim-main.c
index a7d748f3022..d7a68b38bf4 100644
--- a/sim/example-synacor/sim-main.c
+++ b/sim/example-synacor/sim-main.c
@@ -21,7 +21,8 @@
 /* This file contains the main simulator decoding logic.  i.e. everything that
    is architecture specific.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 
diff --git a/sim/frv/ChangeLog b/sim/frv/ChangeLog
index 6b93dd8c68f..e9e94631afd 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* cache.c, frv.c, interrupts.c, memory.c, options.c, pipeline.c,
+	profile-fr400.c, profile-fr450.c, profile-fr500.c, profile-fr550.c,
+	profile.c, registers.c, reset.c, sim-if.c, traps.c: Include defs.h.
+	* sim-main.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/frv/cache.c b/sim/frv/cache.c
index c10d46373f5..e569d5239de 100644
--- a/sim/frv/cache.c
+++ b/sim/frv/cache.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/frv.c b/sim/frv/frv.c
index fee59c2aae7..aff9dc1a49e 100644
--- a/sim/frv/frv.c
+++ b/sim/frv/frv.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/interrupts.c b/sim/frv/interrupts.c
index 0b8ed763987..a657c68e241 100644
--- a/sim/frv/interrupts.c
+++ b/sim/frv/interrupts.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/memory.c b/sim/frv/memory.c
index 5978d151627..681fea49c84 100644
--- a/sim/frv/memory.c
+++ b/sim/frv/memory.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/options.c b/sim/frv/options.c
index b5cc8dec798..3528c357c68 100644
--- a/sim/frv/options.c
+++ b/sim/frv/options.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/pipeline.c b/sim/frv/pipeline.c
index 564a33b9fc2..f8a5ba44268 100644
--- a/sim/frv/pipeline.c
+++ b/sim/frv/pipeline.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/profile-fr400.c b/sim/frv/profile-fr400.c
index 06cf4316afd..f6752d88c10 100644
--- a/sim/frv/profile-fr400.c
+++ b/sim/frv/profile-fr400.c
@@ -16,9 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
-*/
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/profile-fr450.c b/sim/frv/profile-fr450.c
index 0e8b01bc59c..8e4f06ba3e5 100644
--- a/sim/frv/profile-fr450.c
+++ b/sim/frv/profile-fr450.c
@@ -16,9 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
-*/
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/profile-fr500.c b/sim/frv/profile-fr500.c
index 32d7f85faf8..41ee067c97a 100644
--- a/sim/frv/profile-fr500.c
+++ b/sim/frv/profile-fr500.c
@@ -16,9 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
-*/
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/profile-fr550.c b/sim/frv/profile-fr550.c
index 94837a753b8..af42d37a171 100644
--- a/sim/frv/profile-fr550.c
+++ b/sim/frv/profile-fr550.c
@@ -16,9 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
-*/
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/profile.c b/sim/frv/profile.c
index 441590eb581..0d2b6f40c42 100644
--- a/sim/frv/profile.c
+++ b/sim/frv/profile.c
@@ -16,9 +16,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This must come before any other includes.  */
+#include "defs.h"
 
-*/
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/registers.c b/sim/frv/registers.c
index 764a6755b3f..8a92038fd58 100644
--- a/sim/frv/registers.c
+++ b/sim/frv/registers.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/reset.c b/sim/frv/reset.c
index 4cae7997e3f..c87b99f2a95 100644
--- a/sim/frv/reset.c
+++ b/sim/frv/reset.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 65e29375369..c5fd93f0b31 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 #define WANT_CPU_FRVBF
 #include "sim-main.h"
diff --git a/sim/frv/sim-main.h b/sim/frv/sim-main.h
index 25a0e566dca..1515c325e73 100644
--- a/sim/frv/sim-main.h
+++ b/sim/frv/sim-main.h
@@ -19,10 +19,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Main header for the frv.  */
 
-/* sim-basics.h includes config.h but cgen-types.h must be included before
-   sim-basics.h and cgen-types.h needs config.h.  */
-#include "config.h"
-
 /* This is a global setting.  Different cpu families can't mix-n-match -scache
    and -pbb.  However some cpu families may use -simple while others use
    one of -scache/-pbb. ???? */
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index 5e6a4d06ef4..25b4e3eea25 100644
--- a/sim/frv/traps.c
+++ b/sim/frv/traps.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU frvbf
 #define WANT_CPU_FRVBF
 
diff --git a/sim/ft32/ChangeLog b/sim/ft32/ChangeLog
index 08a5b9bb339..819625ef0e8 100644
--- a/sim/ft32/ChangeLog
+++ b/sim/ft32/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 6120df179b5..5fc9ea24658 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -18,7 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <fcntl.h>
 #include <signal.h>
 #include <stdlib.h>
diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog
index b53309a0279..dfbaecb5daa 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* compile.c: Replace config.h include with defs.h.
+	* sim-main.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 365f8667c6a..2ac6dd0bf74 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -17,7 +17,9 @@
  * AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <time.h>
 #include <stdlib.h>
diff --git a/sim/h8300/sim-main.h b/sim/h8300/sim-main.h
index b6169b3bc12..68e44ae9333 100644
--- a/sim/h8300/sim-main.h
+++ b/sim/h8300/sim-main.h
@@ -1,6 +1,5 @@
 /* Main header for the Hitachi h8/300 architecture.  */
 
-#include "config.h"
 #include "bfd.h"
 
 #ifndef SIM_MAIN_H
diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog
index 1f90b573cf1..b21e075d71d 100644
--- a/sim/iq2000/ChangeLog
+++ b/sim/iq2000/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* iq2000.c, sim-if.c: Include defs.h.
+	* sim-main.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c
index 66d7b47dfb4..018c6a63a3f 100644
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU
 #define WANT_CPU_IQ2000BF
 
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 4db2e4d9b06..b363eb04a21 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 
 #include <stdlib.h>
diff --git a/sim/iq2000/sim-main.h b/sim/iq2000/sim-main.h
index 829f9bb56ba..d0ae1cfef7b 100644
--- a/sim/iq2000/sim-main.h
+++ b/sim/iq2000/sim-main.h
@@ -4,10 +4,6 @@
 #ifndef SIM_MAIN_H
 #define SIM_MAIN_H
 
-/* sim-basics.h includes config.h but cgen-types.h must be included before
-   sim-basics.h and cgen-types.h needs config.h.  */
-#include "config.h"
-
 /* This is a global setting.  Different cpu families can't mix-n-match -scache
    and -pbb.  However some cpu families may use -simple while others use
    one of -scache/-pbb. ???? */
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 90613411a57..db0e8f0c8af 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-lm32cpu.c, dv-lm32timer.c, dv-lm32uart.c, lm32.c, sim-if.c,
+	traps.c, user.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/lm32/dv-lm32cpu.c b/sim/lm32/dv-lm32cpu.c
index 2ef32c7e6e1..2f702bd7229 100644
--- a/sim/lm32/dv-lm32cpu.c
+++ b/sim/lm32/dv-lm32cpu.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "hw-main.h"
 #include "sim-main.h"
 
diff --git a/sim/lm32/dv-lm32timer.c b/sim/lm32/dv-lm32timer.c
index 801d27d42f9..a04afc1d34b 100644
--- a/sim/lm32/dv-lm32timer.c
+++ b/sim/lm32/dv-lm32timer.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 #include "sim-assert.h"
diff --git a/sim/lm32/dv-lm32uart.c b/sim/lm32/dv-lm32uart.c
index c840b1796bd..1f8ba1d92ee 100644
--- a/sim/lm32/dv-lm32uart.c
+++ b/sim/lm32/dv-lm32uart.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 #include "sim-assert.h"
diff --git a/sim/lm32/lm32.c b/sim/lm32/lm32.c
index 3c68eafb052..2ffe48de1bd 100644
--- a/sim/lm32/lm32.c
+++ b/sim/lm32/lm32.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU lm32bf
 #define WANT_CPU_LM32BF
 
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index c97a45129dc..1cccf626b67 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "libiberty.h"
diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c
index 75b8ee7251f..5b010f9d3fe 100644
--- a/sim/lm32/traps.c
+++ b/sim/lm32/traps.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU lm32bf
 #define WANT_CPU_LM32BF
 
diff --git a/sim/lm32/user.c b/sim/lm32/user.c
index d84075a03f2..1e7bb71515b 100644
--- a/sim/lm32/user.c
+++ b/sim/lm32/user.c
@@ -18,6 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 
 /* Handle user defined instructions.  */
diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog
index af71d21bbfd..591d8b9ddd1 100644
--- a/sim/m32c/ChangeLog
+++ b/sim/m32c/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* int.c, misc.c, opc2c.c, reg.c, srcdest.c: Include defs.h.
+	* gdb-if.c, load.c, main.c, mem.c, syscalls.c, trace.c: Replace
+	config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c
index 36986487673..b00d878f0be 100644
--- a/sim/m32c/gdb-if.c
+++ b/sim/m32c/gdb-if.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
diff --git a/sim/m32c/int.c b/sim/m32c/int.c
index ffc96ae5dde..4275399683d 100644
--- a/sim/m32c/int.c
+++ b/sim/m32c/int.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "int.h"
 #include "cpu.h"
diff --git a/sim/m32c/load.c b/sim/m32c/load.c
index 86e774e3abe..277fc141495 100644
--- a/sim/m32c/load.c
+++ b/sim/m32c/load.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/m32c/main.c b/sim/m32c/main.c
index ac36bc57071..4c2c255ecd5 100644
--- a/sim/m32c/main.c
+++ b/sim/m32c/main.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c
index 4baf71fa672..243b7c4e072 100644
--- a/sim/m32c/mem.c
+++ b/sim/m32c/mem.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/misc.c b/sim/m32c/misc.c
index 50692e5ac72..5e09885be64 100644
--- a/sim/m32c/misc.c
+++ b/sim/m32c/misc.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 
diff --git a/sim/m32c/opc2c.c b/sim/m32c/opc2c.c
index 4c976449433..3d1713d2034 100644
--- a/sim/m32c/opc2c.c
+++ b/sim/m32c/opc2c.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/m32c/reg.c b/sim/m32c/reg.c
index 1b3c774cf81..a57b6a11c68 100644
--- a/sim/m32c/reg.c
+++ b/sim/m32c/reg.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/srcdest.c b/sim/m32c/srcdest.c
index d5feb1716fb..f3040c571e8 100644
--- a/sim/m32c/srcdest.c
+++ b/sim/m32c/srcdest.c
@@ -18,6 +18,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/sim/m32c/syscalls.c b/sim/m32c/syscalls.c
index e9400840be9..e8d9d2e6cc7 100644
--- a/sim/m32c/syscalls.c
+++ b/sim/m32c/syscalls.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/sim/m32c/trace.c b/sim/m32c/trace.c
index f871c01d82b..d16be4c8d9a 100644
--- a/sim/m32c/trace.c
+++ b/sim/m32c/trace.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 04031e7f90c..2e099a07fe9 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-m32r_cache.c, dv-m32r_uart.c: Replace config.h include with
+	defs.h.
+	* m32r.c, m32r2.c, m32rx.c, sim-if.c, traps-linux.c,
+	traps.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/m32r/dv-m32r_cache.c b/sim/m32r/dv-m32r_cache.c
index 44e2537dc6d..bb63b3d6b23 100644
--- a/sim/m32r/dv-m32r_cache.c
+++ b/sim/m32r/dv-m32r_cache.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m32r/dv-m32r_uart.c b/sim/m32r/dv-m32r_uart.c
index e4b091203ed..c6b529d9352 100644
--- a/sim/m32r/dv-m32r_uart.c
+++ b/sim/m32r/dv-m32r_uart.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m32r/m32r.c b/sim/m32r/m32r.c
index 1d0a7356bb0..3f8305ecd5e 100644
--- a/sim/m32r/m32r.c
+++ b/sim/m32r/m32r.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU m32rbf
 #define WANT_CPU_M32RBF
 
diff --git a/sim/m32r/m32r2.c b/sim/m32r/m32r2.c
index b4346cf6cbf..852c10814c5 100644
--- a/sim/m32r/m32r2.c
+++ b/sim/m32r/m32r2.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU m32r2f
 #define WANT_CPU_M32R2F
 
diff --git a/sim/m32r/m32rx.c b/sim/m32r/m32rx.c
index 31bcee10889..0e774bace74 100644
--- a/sim/m32r/m32rx.c
+++ b/sim/m32r/m32rx.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU m32rxf
 #define WANT_CPU_M32RXF
 
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index 8d9f4324c9c..a6d8c486168 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "libiberty.h"
diff --git a/sim/m32r/traps-linux.c b/sim/m32r/traps-linux.c
index 1ee1781f0eb..63ed13788a5 100644
--- a/sim/m32r/traps-linux.c
+++ b/sim/m32r/traps-linux.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "syscall.h"
diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c
index 9fca2b1ec1d..ffa09f1527f 100644
--- a/sim/m32r/traps.c
+++ b/sim/m32r/traps.c
@@ -17,6 +17,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "targ-vals.h"
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 410660c55c4..a070cdd5286 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-m68hc11.c, dv-m68hc11eepr.c, dv-m68hc11sio.c, dv-m68hc11spi.c,
+	dv-m68hc11tim.c, dv-nvram.c, emulos.c, gencode.c, interp.c,
+	interrupts.c, m68hc11_sim.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/m68hc11/dv-m68hc11.c b/sim/m68hc11/dv-m68hc11.c
index f4815883a33..5b2d1ba0b52 100644
--- a/sim/m68hc11/dv-m68hc11.c
+++ b/sim/m68hc11/dv-m68hc11.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-hw.h"
diff --git a/sim/m68hc11/dv-m68hc11eepr.c b/sim/m68hc11/dv-m68hc11eepr.c
index 88bd121980d..1e4cb5eab05 100644
--- a/sim/m68hc11/dv-m68hc11eepr.c
+++ b/sim/m68hc11/dv-m68hc11eepr.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m68hc11/dv-m68hc11sio.c b/sim/m68hc11/dv-m68hc11sio.c
index b6eacb4883e..cf51d17f9ff 100644
--- a/sim/m68hc11/dv-m68hc11sio.c
+++ b/sim/m68hc11/dv-m68hc11sio.c
@@ -20,6 +20,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m68hc11/dv-m68hc11spi.c b/sim/m68hc11/dv-m68hc11spi.c
index 1e9d56c849d..6fe759d3449 100644
--- a/sim/m68hc11/dv-m68hc11spi.c
+++ b/sim/m68hc11/dv-m68hc11spi.c
@@ -20,6 +20,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c
index d7bcac3feca..2c2e523da11 100644
--- a/sim/m68hc11/dv-m68hc11tim.c
+++ b/sim/m68hc11/dv-m68hc11tim.c
@@ -20,6 +20,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m68hc11/dv-nvram.c b/sim/m68hc11/dv-nvram.c
index 586ee2ff5fc..88fab2f4461 100644
--- a/sim/m68hc11/dv-nvram.c
+++ b/sim/m68hc11/dv-nvram.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/m68hc11/emulos.c b/sim/m68hc11/emulos.c
index 247e66871cf..d7436f79b36 100644
--- a/sim/m68hc11/emulos.c
+++ b/sim/m68hc11/emulos.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c
index 2a2210d7ac6..46817606797 100644
--- a/sim/m68hc11/gencode.c
+++ b/sim/m68hc11/gencode.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index 07e4a8858a7..d4b2531abea 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-hw.h"
diff --git a/sim/m68hc11/interrupts.c b/sim/m68hc11/interrupts.c
index 03c78ac2181..1adce508219 100644
--- a/sim/m68hc11/interrupts.c
+++ b/sim/m68hc11/interrupts.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 
diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c
index 0d7860170bc..3c619c14ab0 100644
--- a/sim/m68hc11/m68hc11_sim.c
+++ b/sim/m68hc11/m68hc11_sim.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 #include "sim-module.h"
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
index 3a14634057d..7e708046213 100644
--- a/sim/mcore/ChangeLog
+++ b/sim/mcore/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 5e8ad3b8a2f..3517068abf5 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index dce172193b8..7b205acf094 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index 1b89bb49408..e451f2d68d1 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -16,7 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index 76134b78619..68c2503ec60 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+	* cp1.c, dsp.c, dv-tx3904cpu.c, dv-tx3904irc.c, dv-tx3904sio.c,
+	dv-tx3904tmr.c, m16run.c, mdmx.c, micromipsrun.c, sim-main.c:
+	Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/mips/cp1.c b/sim/mips/cp1.c
index f5d3d1dd5fb..03ed0c0558f 100644
--- a/sim/mips/cp1.c
+++ b/sim/mips/cp1.c
@@ -40,6 +40,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    (Originally, this code was in interp.c)
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 
 #include <stdlib.h>
diff --git a/sim/mips/dsp.c b/sim/mips/dsp.c
index b82ff6880d2..fb25caa8356 100644
--- a/sim/mips/dsp.c
+++ b/sim/mips/dsp.c
@@ -17,6 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 
 int DSPLO_REGNUM[4] =
diff --git a/sim/mips/dv-tx3904cpu.c b/sim/mips/dv-tx3904cpu.c
index bf23a066857..43f38d2a7ae 100644
--- a/sim/mips/dv-tx3904cpu.c
+++ b/sim/mips/dv-tx3904cpu.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mips/dv-tx3904irc.c b/sim/mips/dv-tx3904irc.c
index d9a919752e3..0896b0fabb0 100644
--- a/sim/mips/dv-tx3904irc.c
+++ b/sim/mips/dv-tx3904irc.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mips/dv-tx3904sio.c b/sim/mips/dv-tx3904sio.c
index 9676344bc33..c81b2dd3a5e 100644
--- a/sim/mips/dv-tx3904sio.c
+++ b/sim/mips/dv-tx3904sio.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mips/dv-tx3904tmr.c b/sim/mips/dv-tx3904tmr.c
index 48b169fd9b8..5b5d8ac97f7 100644
--- a/sim/mips/dv-tx3904tmr.c
+++ b/sim/mips/dv-tx3904tmr.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 49b79f91dbc..25eb4975652 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -22,7 +22,9 @@ code on the hardware.
 
 */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "bfd.h"
 #include "sim-main.h"
 #include "sim-utils.h"
@@ -32,9 +34,6 @@ code on the hardware.
 
 #include "itable.h"
 
-
-#include "config.h"
-
 #include <stdio.h>
 #include <stdarg.h>
 #include <ansidecl.h>
diff --git a/sim/mips/m16run.c b/sim/mips/m16run.c
index 44fb9e4538c..a04e3eed3bf 100644
--- a/sim/mips/m16run.c
+++ b/sim/mips/m16run.c
@@ -17,6 +17,9 @@
  
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "m16_idecode.h"
 #include "m32_idecode.h"
diff --git a/sim/mips/mdmx.c b/sim/mips/mdmx.c
index 948bb0d2ebe..6978251a241 100644
--- a/sim/mips/mdmx.c
+++ b/sim/mips/mdmx.c
@@ -18,6 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 
 #include "sim-main.h"
diff --git a/sim/mips/micromipsrun.c b/sim/mips/micromipsrun.c
index 3950dc2fafd..53a5c081187 100644
--- a/sim/mips/micromipsrun.c
+++ b/sim/mips/micromipsrun.c
@@ -19,6 +19,9 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "micromips16_idecode.h"
 #include "micromips32_idecode.h"
diff --git a/sim/mips/sim-main.c b/sim/mips/sim-main.c
index 620f4b2990b..24e16029d22 100644
--- a/sim/mips/sim-main.c
+++ b/sim/mips/sim-main.c
@@ -19,6 +19,9 @@
 #ifndef SIM_MAIN_C
 #define SIM_MAIN_C
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-assert.h"
 
diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 42eed824296..92dd6d1c347 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-mn103cpu.c, dv-mn103int.c, dv-mn103iop.c, dv-mn103ser.c,
+	dv-mn103tim.c, op_utils.c: Include defs.h.
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/mn10300/dv-mn103cpu.c b/sim/mn10300/dv-mn103cpu.c
index 3c3e843fa64..2a3591b8a37 100644
--- a/sim/mn10300/dv-mn103cpu.c
+++ b/sim/mn10300/dv-mn103cpu.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mn10300/dv-mn103int.c b/sim/mn10300/dv-mn103int.c
index cb81bc11527..2c47ca0e055 100644
--- a/sim/mn10300/dv-mn103int.c
+++ b/sim/mn10300/dv-mn103int.c
@@ -18,6 +18,8 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "hw-main.h"
diff --git a/sim/mn10300/dv-mn103iop.c b/sim/mn10300/dv-mn103iop.c
index ecce7ec1fd5..1fd8d178ba5 100644
--- a/sim/mn10300/dv-mn103iop.c
+++ b/sim/mn10300/dv-mn103iop.c
@@ -18,6 +18,9 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 
diff --git a/sim/mn10300/dv-mn103ser.c b/sim/mn10300/dv-mn103ser.c
index 8d9bf8fa4fb..3465954f75f 100644
--- a/sim/mn10300/dv-mn103ser.c
+++ b/sim/mn10300/dv-mn103ser.c
@@ -18,6 +18,9 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 #include "dv-sockser.h"
diff --git a/sim/mn10300/dv-mn103tim.c b/sim/mn10300/dv-mn103tim.c
index 61807c99322..ad9c24bbc6e 100644
--- a/sim/mn10300/dv-mn103tim.c
+++ b/sim/mn10300/dv-mn103tim.c
@@ -18,6 +18,9 @@
     
     */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "hw-main.h"
 #include "sim-assert.h"
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 55e9e212fe7..b6c5d5b087e 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -1,4 +1,6 @@
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <signal.h>
 
 #include "sim-main.h"
diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c
index 882ff462409..cd0f1a667e4 100644
--- a/sim/mn10300/op_utils.c
+++ b/sim/mn10300/op_utils.c
@@ -1,3 +1,6 @@
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "targ-vals.h"
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index be18085cda6..39b19d32186 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index 135716386f7..caf9e43deda 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -17,7 +17,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <fcntl.h>
 #include <signal.h>
 #include <stdlib.h>
diff --git a/sim/msp430/ChangeLog b/sim/msp430/ChangeLog
index c6a4c653260..4664091de00 100644
--- a/sim/msp430/ChangeLog
+++ b/sim/msp430/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* msp430-sim.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/msp430/msp430-sim.c b/sim/msp430/msp430-sim.c
index 4e213f978c6..58a54698993 100644
--- a/sim/msp430/msp430-sim.c
+++ b/sim/msp430/msp430-sim.c
@@ -19,7 +19,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/or1k/ChangeLog b/sim/or1k/ChangeLog
index ddfa6181135..af6afc4609d 100644
--- a/sim/or1k/ChangeLog
+++ b/sim/or1k/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h: Delete config.h include.
+	* or1k.c, sim-if.c, traps.c: Include defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/or1k/or1k.c b/sim/or1k/or1k.c
index 4b44e508b71..650d98b5230 100644
--- a/sim/or1k/or1k.c
+++ b/sim/or1k/or1k.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_OR1K32BF
 #define WANT_CPU
 
diff --git a/sim/or1k/sim-if.c b/sim/or1k/sim-if.c
index 41dbaaebf1d..005124b9ad7 100644
--- a/sim/or1k/sim-if.c
+++ b/sim/or1k/sim-if.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "libiberty.h"
diff --git a/sim/or1k/sim-main.h b/sim/or1k/sim-main.h
index cac1abb2b8f..f91a351a2db 100644
--- a/sim/or1k/sim-main.h
+++ b/sim/or1k/sim-main.h
@@ -21,8 +21,6 @@
 
 #define WITH_SCACHE_PBB 1
 
-#include "config.h"
-
 #include "ansidecl.h"
 #include "or1k-desc.h"
 #include "sim-basics.h"
diff --git a/sim/or1k/traps.c b/sim/or1k/traps.c
index 0a0f1aa0711..7f5a38f68be 100644
--- a/sim/or1k/traps.c
+++ b/sim/or1k/traps.c
@@ -16,6 +16,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #define WANT_CPU_OR1K32BF
 #define WANT_CPU
 
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 42db5f26857..0755fe288b7 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,10 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* Makefile.in (gentmap): Pass -DUSE_CONFIG_H.
+	* basics.h, debug.c, filter_filename.c, inline.c, sim-endian.c,
+	words.h: Replace config.h include with defs.h.
+	* defs.h: New file.
+
 2021-05-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (WERROR_CFLAGS): Define.
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index 9fc864e677a..5ce511e96b3 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -629,7 +629,7 @@ mon.o: mon.c $(BASICS_H) $(CPU_H) $(MON_H)
 # As a kludge, build the common stuff here for now.
 gentmap: $(srcdir)/../common/gentmap.c Makefile targ-vals.def
 	$(LINK_FOR_BUILD) -I. -I../common -I$(srcdir)/../common \
-		$(srcdir)/../common/gentmap.c
+		$(srcdir)/../common/gentmap.c -DUSE_CONFIG_H
 
 targ-vals.def: $(srcdir)/../common/nltvals.def
 	rm -f targ-vals.def tmp-def
diff --git a/sim/ppc/basics.h b/sim/ppc/basics.h
index 2b923ea3cc3..057cf1ab0e4 100644
--- a/sim/ppc/basics.h
+++ b/sim/ppc/basics.h
@@ -21,6 +21,8 @@
 #ifndef _BASICS_H_
 #define _BASICS_H_
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
 /* from Michael Meissner, macro's to handle concating symbols better */
 
@@ -85,7 +87,6 @@ typedef enum {
 
 /* Basic configuration */
 
-#include "config.h"
 #include "ppc-config.h"
 #include "inline.h"
 
diff --git a/sim/ppc/debug.c b/sim/ppc/debug.c
index dba14255366..53a392a303e 100644
--- a/sim/ppc/debug.c
+++ b/sim/ppc/debug.c
@@ -21,7 +21,9 @@
 #ifndef _DEBUG_C_
 #define _DEBUG_C_
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "basics.h"
 
 #include <stdlib.h>
diff --git a/sim/ppc/defs.h b/sim/ppc/defs.h
new file mode 100644
index 00000000000..66e76d26dba
--- /dev/null
+++ b/sim/ppc/defs.h
@@ -0,0 +1,26 @@
+/* The configure generated header settings.
+
+   Copyright 2002-2021 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* This file should be included by every .c file before any other header.  */
+
+#ifndef DEFS_H
+#define DEFS_H
+
+/* Include sim's various configure tests.  */
+#include "config.h"
+
+#endif
diff --git a/sim/ppc/filter_filename.c b/sim/ppc/filter_filename.c
index 2457b687907..b59ca21ca55 100644
--- a/sim/ppc/filter_filename.c
+++ b/sim/ppc/filter_filename.c
@@ -17,7 +17,9 @@
  
     */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ppc-config.h"
 #include "filter_filename.h"
 
diff --git a/sim/ppc/inline.c b/sim/ppc/inline.c
index 8813169c60e..1db2dec5c30 100644
--- a/sim/ppc/inline.c
+++ b/sim/ppc/inline.c
@@ -21,7 +21,9 @@
 #ifndef _INLINE_C_
 #define _INLINE_C_
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "ppc-config.h"
 
 #include "inline.h"
diff --git a/sim/ppc/sim-endian.c b/sim/ppc/sim-endian.c
index 1ffa2d7e4eb..2625d80d0b8 100644
--- a/sim/ppc/sim-endian.c
+++ b/sim/ppc/sim-endian.c
@@ -21,7 +21,9 @@
 #ifndef _SIM_ENDIAN_C_
 #define _SIM_ENDIAN_C_
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "basics.h"
 
 
diff --git a/sim/ppc/words.h b/sim/ppc/words.h
index 7645349ac5b..641f22514ec 100644
--- a/sim/ppc/words.h
+++ b/sim/ppc/words.h
@@ -43,9 +43,8 @@
 */
 
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+/* This must come before any other includes.  */
+#include "defs.h"
 
 /* bit based */
 typedef char natural8;
diff --git a/sim/pru/ChangeLog b/sim/pru/ChangeLog
index 7b6aac181a3..0fef8ffbc7c 100644
--- a/sim/pru/ChangeLog
+++ b/sim/pru/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+	* pru.h, sim-main.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index 6398c6714f2..58ac333c1e6 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -18,7 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdbool.h>
 #include <stdint.h>
 #include <stddef.h>
diff --git a/sim/pru/pru.h b/sim/pru/pru.h
index c2b631cda66..17febb295b7 100644
--- a/sim/pru/pru.h
+++ b/sim/pru/pru.h
@@ -19,7 +19,6 @@
 #ifndef PRU_H
 #define PRU_H
 
-#include "config.h"
 #include "opcode/pru.h"
 
 /* Needed for handling the dual PRU address space.  */
diff --git a/sim/pru/sim-main.h b/sim/pru/sim-main.h
index 966cacf5693..8233c20cefd 100644
--- a/sim/pru/sim-main.h
+++ b/sim/pru/sim-main.h
@@ -19,8 +19,6 @@
 #ifndef PRU_SIM_MAIN
 #define PRU_SIM_MAIN
 
-#include "config.h"
-
 #include <stdint.h>
 #include <stddef.h>
 #include "pru.h"
diff --git a/sim/riscv/ChangeLog b/sim/riscv/ChangeLog
index 9fe89f45277..53081dc0bb9 100644
--- a/sim/riscv/ChangeLog
+++ b/sim/riscv/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c, machs.c, sim-main.c: Replace config.h include with defs.h.
+
 2021-05-15  Mike Frysinger  <vapier@gentoo.org>
 
 	* sim-main.c (mulhu): Change check to HAVE___INT128.
diff --git a/sim/riscv/interp.c b/sim/riscv/interp.c
index 6192b6dc5b2..d430d77d701 100644
--- a/sim/riscv/interp.c
+++ b/sim/riscv/interp.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 #include "sim-options.h"
diff --git a/sim/riscv/machs.c b/sim/riscv/machs.c
index 853a3afb42f..9ff23033678 100644
--- a/sim/riscv/machs.c
+++ b/sim/riscv/machs.c
@@ -18,7 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include "sim-main.h"
 
diff --git a/sim/riscv/sim-main.c b/sim/riscv/sim-main.c
index bb45ffee576..7f87f1beb50 100644
--- a/sim/riscv/sim-main.c
+++ b/sim/riscv/sim-main.c
@@ -21,7 +21,8 @@
 /* This file contains the main simulator decoding logic.  i.e. everything that
    is architecture specific.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <inttypes.h>
 #include <time.h>
diff --git a/sim/rl78/ChangeLog b/sim/rl78/ChangeLog
index 9fc92e1e040..ecd9ed0fc76 100644
--- a/sim/rl78/ChangeLog
+++ b/sim/rl78/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* cpu.c, gdb-if.c, load.c, main.c, mem.c, rl78.c, trace.c: Replace
+	config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/rl78/cpu.c b/sim/rl78/cpu.c
index fde8afee96b..1bd8b6ee38f 100644
--- a/sim/rl78/cpu.c
+++ b/sim/rl78/cpu.c
@@ -19,7 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c
index 87e343cdd48..a2414f9a355 100644
--- a/sim/rl78/gdb-if.c
+++ b/sim/rl78/gdb-if.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
diff --git a/sim/rl78/load.c b/sim/rl78/load.c
index c137ba6e40e..a2a57b0b198 100644
--- a/sim/rl78/load.c
+++ b/sim/rl78/load.c
@@ -19,8 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rl78/main.c b/sim/rl78/main.c
index 8d8a79d5da8..178fa75f79f 100644
--- a/sim/rl78/main.c
+++ b/sim/rl78/main.c
@@ -19,8 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/rl78/mem.c b/sim/rl78/mem.c
index 77e4987b6ff..0b6ab8e79f1 100644
--- a/sim/rl78/mem.c
+++ b/sim/rl78/mem.c
@@ -19,7 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rl78/rl78.c b/sim/rl78/rl78.c
index 006691c4c0a..e45750ad7bf 100644
--- a/sim/rl78/rl78.c
+++ b/sim/rl78/rl78.c
@@ -19,7 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rl78/trace.c b/sim/rl78/trace.c
index 6f897eb0339..1b4b365af1e 100644
--- a/sim/rl78/trace.c
+++ b/sim/rl78/trace.c
@@ -19,8 +19,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog
index db00b6e5a56..dc30d46090d 100644
--- a/sim/rx/ChangeLog
+++ b/sim/rx/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* err.c: Include defs.h.
+	* fpu.c, gdb-if.c, load.c, main.c, mem.c, misc.c, reg.c, rx.c,
+	syscalls.c, trace.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/rx/err.c b/sim/rx/err.c
index e72b6d3ddee..c9b1c3cb57c 100644
--- a/sim/rx/err.c
+++ b/sim/rx/err.c
@@ -18,6 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/sim/rx/fpu.c b/sim/rx/fpu.c
index 6c4738c0b21..611d9123d48 100644
--- a/sim/rx/fpu.c
+++ b/sim/rx/fpu.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c
index 4a0f0701a56..7298631965b 100644
--- a/sim/rx/gdb-if.c
+++ b/sim/rx/gdb-if.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <assert.h>
 #include <signal.h>
diff --git a/sim/rx/load.c b/sim/rx/load.c
index b04826f55c7..d1448880277 100644
--- a/sim/rx/load.c
+++ b/sim/rx/load.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
diff --git a/sim/rx/main.c b/sim/rx/main.c
index 20a8434388e..5d7092ba1d1 100644
--- a/sim/rx/main.c
+++ b/sim/rx/main.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
diff --git a/sim/rx/mem.c b/sim/rx/mem.c
index 7e62bfb8953..f9b9cc1a97e 100644
--- a/sim/rx/mem.c
+++ b/sim/rx/mem.c
@@ -18,6 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
+
 /* This slows down the simulator and we get some false negatives from
    gcc, like when it uses a long-sized hole to hold a byte-sized
    variable, knowing that it doesn't care about the other bits.  But,
@@ -25,7 +28,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1.  */
 #define RDCHECK 0
 
-#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rx/misc.c b/sim/rx/misc.c
index 2a4a2539e41..e7447aca463 100644
--- a/sim/rx/misc.c
+++ b/sim/rx/misc.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 
 #include "cpu.h"
diff --git a/sim/rx/reg.c b/sim/rx/reg.c
index bdf2debac69..1d27c59bb94 100644
--- a/sim/rx/reg.c
+++ b/sim/rx/reg.c
@@ -18,8 +18,9 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rx/rx.c b/sim/rx/rx.c
index e3737a56e98..869dd3aa89c 100644
--- a/sim/rx/rx.c
+++ b/sim/rx/rx.c
@@ -18,7 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/sim/rx/syscalls.c b/sim/rx/syscalls.c
index 73ca0f2b190..1981b5d3c3e 100644
--- a/sim/rx/syscalls.c
+++ b/sim/rx/syscalls.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/sim/rx/trace.c b/sim/rx/trace.c
index a005797b4ec..bb191dbdd39 100644
--- a/sim/rx/trace.c
+++ b/sim/rx/trace.c
@@ -18,8 +18,9 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* This must come before any other includes.  */
+#include "defs.h"
 
-#include "config.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
index 4f687e8b52b..3dc1630fc5e 100644
--- a/sim/sh/ChangeLog
+++ b/sim/sh/ChangeLog
@@ -1,3 +1,7 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c: Replace config.h include with defs.h.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 5fb6aff02f0..65245035776 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -18,7 +18,8 @@
 
 */
 
-#include "config.h"
+/* This must come before any other includes.  */
+#include "defs.h"
 
 #include <ctype.h>
 #include <stdio.h>
diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog
index 21706571e51..81120ed51c0 100644
--- a/sim/v850/ChangeLog
+++ b/sim/v850/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c, simops.c: Include defs.h.
+	* sim-main.h: Delete config.h include.
+
 2021-05-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/v850/interp.c b/sim/v850/interp.c
index ff2f6a23e56..79c6e0f7ddc 100644
--- a/sim/v850/interp.c
+++ b/sim/v850/interp.c
@@ -1,3 +1,6 @@
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "sim-options.h"
 #include "v850_sim.h"
diff --git a/sim/v850/sim-main.h b/sim/v850/sim-main.h
index e7276a68f8f..6556273f678 100644
--- a/sim/v850/sim-main.h
+++ b/sim/v850/sim-main.h
@@ -5,7 +5,6 @@
 
 #define WITH_TARGET_WORD_MSB 31
 
-#include "config.h"
 #include "sim-basics.h"
 #include "sim-signal.h"
 #include "sim-fpu.h"
diff --git a/sim/v850/simops.c b/sim/v850/simops.c
index bd23f92aba4..62a2bbcbb61 100644
--- a/sim/v850/simops.c
+++ b/sim/v850/simops.c
@@ -1,3 +1,6 @@
+/* This must come before any other includes.  */
+#include "defs.h"
+
 #include "sim-main.h"
 #include "v850_sim.h"
 #include "simops.h"