From 2d5700ad4e6e43d76548be5e8148c05f6948aea2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 11 Nov 2022 15:44:57 +0700 Subject: [PATCH] sim: mips: move subtarget defines to top-level configure We want to kill off mips/configure entirely. Move this small part out now to get started. --- sim/Makefile.in | 2 ++ sim/arch-subdir.mk.in | 3 +++ sim/configure | 29 +++++++++++++++++++++++++++-- sim/configure.ac | 1 + sim/mips/Makefile.in | 3 +-- sim/mips/acinclude-top.m4 | 34 ++++++++++++++++++++++++++++++++++ sim/mips/configure | 20 -------------------- sim/mips/configure.ac | 19 ------------------- 8 files changed, 68 insertions(+), 43 deletions(-) create mode 100644 sim/mips/acinclude-top.m4 diff --git a/sim/Makefile.in b/sim/Makefile.in index 0c9975ecbad..a1483457ba4 100644 --- a/sim/Makefile.in +++ b/sim/Makefile.in @@ -246,6 +246,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ $(top_srcdir)/m4/sim_ac_platform.m4 \ $(top_srcdir)/m4/sim_ac_toolchain.m4 \ $(top_srcdir)/frv/acinclude.m4 \ + $(top_srcdir)/mips/acinclude-top.m4 \ $(top_srcdir)/riscv/acinclude.m4 $(top_srcdir)/rx/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -1105,6 +1106,7 @@ SIM_FRV_TRAPDUMP_FLAGS = @SIM_FRV_TRAPDUMP_FLAGS@ SIM_HW_CFLAGS = @SIM_HW_CFLAGS@ SIM_HW_SOCKSER = @SIM_HW_SOCKSER@ SIM_INLINE = @SIM_INLINE@ +SIM_MIPS_SUBTARGET = @SIM_MIPS_SUBTARGET@ SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@ SIM_RISCV_BITSIZE = @SIM_RISCV_BITSIZE@ SIM_RX_CYCLE_ACCURATE_FLAGS = @SIM_RX_CYCLE_ACCURATE_FLAGS@ diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in index cfde3f3fb78..ca2d2417ec6 100644 --- a/sim/arch-subdir.mk.in +++ b/sim/arch-subdir.mk.in @@ -73,3 +73,6 @@ SIM_INLINE = @SIM_INLINE@ SIM_HW_CFLAGS = @SIM_HW_CFLAGS@ SIM_HW_OBJS = $(SIM_HW_DEVICES:%=dv-%.o) @SIM_ENABLE_HW_FALSE@SIM_HW_OBJS = + +# This can be removed once mips/configure is gone. +SIM_MIPS_SUBTARGET = @SIM_MIPS_SUBTARGET@ diff --git a/sim/configure b/sim/configure index 57c4fcf6972..bf81c832696 100755 --- a/sim/configure +++ b/sim/configure @@ -641,6 +641,7 @@ LTLIBOBJS include_makefile SIM_RX_CYCLE_ACCURATE_FLAGS SIM_RISCV_BITSIZE +SIM_MIPS_SUBTARGET SIM_FRV_TRAPDUMP_FLAGS sim_float sim_bitsize @@ -12431,7 +12432,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12434 "configure" +#line 12435 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12537,7 +12538,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12540 "configure" +#line 12541 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16276,6 +16277,30 @@ $as_echo "no" >&6; } fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking mips subtarget" >&5 +$as_echo_n "checking mips subtarget... " >&6; } +SIM_MIPS_SUBTARGET= +case ${target} in #( + mips64vr*-*-*) : + SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; #( + mips*tx39*) : + SIM_MIPS_SUBTARGET="-DSUBTARGET_R3900=1" ;; #( + mips*-sde-elf*) : + SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; #( + mips*-mti-elf*) : + SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; #( + mipsisa32*-*-*) : + SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; #( + mipsisa64*-*-*) : + SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; #( + *) : + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SIM_MIPS_SUBTARGET:-none}" >&5 +$as_echo "${SIM_MIPS_SUBTARGET:-none}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking riscv bitsize" >&5 $as_echo_n "checking riscv bitsize... " >&6; } SIM_RISCV_BITSIZE=64 diff --git a/sim/configure.ac b/sim/configure.ac index 675fa1bb44d..a631d2b3a22 100644 --- a/sim/configure.ac +++ b/sim/configure.ac @@ -203,6 +203,7 @@ AC_SUBST(sim_float) dnl Some arches have unique configure flags. m4_include([frv/acinclude.m4]) +m4_include([mips/acinclude-top.m4]) m4_include([riscv/acinclude.m4]) m4_include([rx/acinclude.m4]) diff --git a/sim/mips/Makefile.in b/sim/mips/Makefile.in index eadb34697c8..d8d50eaabd7 100644 --- a/sim/mips/Makefile.in +++ b/sim/mips/Makefile.in @@ -67,8 +67,7 @@ SIM_OBJS = \ sim-resume.o \ # List of flags to always pass to $(CC). -SIM_SUBTARGET=@SIM_SUBTARGET@ -SIM_EXTRA_CFLAGS = $(SIM_SUBTARGET) +SIM_EXTRA_CFLAGS = $(SIM_MIPS_SUBTARGET) SIM_EXTRA_CLEAN = clean-extra SIM_EXTRA_DISTCLEAN = distclean-extra diff --git a/sim/mips/acinclude-top.m4 b/sim/mips/acinclude-top.m4 new file mode 100644 index 00000000000..4eb6c19f812 --- /dev/null +++ b/sim/mips/acinclude-top.m4 @@ -0,0 +1,34 @@ +dnl TODO: Rename this to acinclude.m4 once mips/configure is removed. +dnl +dnl Copyright (C) 2005-2022 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl +dnl NB: This file is included in sim/configure, so keep settings namespaced. + +dnl DEPRECATED +dnl +dnl Instead of defining a `subtarget' macro, code should be checking the value +dnl of {STATE,CPU}_ARCHITECTURE to identify the architecture dnl in question. +AC_MSG_CHECKING([mips subtarget]) +SIM_MIPS_SUBTARGET= +AS_CASE([${target}], + [mips64vr*-*-*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"], + [mips*tx39*], [SIM_MIPS_SUBTARGET="-DSUBTARGET_R3900=1"], + [mips*-sde-elf*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"], + [mips*-mti-elf*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"], + [mipsisa32*-*-*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"], + [mipsisa64*-*-*], [SIM_MIPS_SUBTARGET="-DTARGET_ENABLE_FR=1"]) +AC_MSG_RESULT([${SIM_MIPS_SUBTARGET:-none}]) +AC_SUBST(SIM_MIPS_SUBTARGET) diff --git a/sim/mips/configure b/sim/mips/configure index 19b91fadc29..70939f9851a 100755 --- a/sim/mips/configure +++ b/sim/mips/configure @@ -595,7 +595,6 @@ sim_micromips16_flags sim_micromips_flags sim_m16_flags sim_igen_flags -SIM_SUBTARGET target_os target_vendor target_cpu @@ -1844,25 +1843,6 @@ test -n "$target_alias" && program_prefix=${target_alias}- -# DEPRECATED -# -# Instead of defining a `subtarget' macro, code should be checking -# the value of {STATE,CPU}_ARCHITECTURE to identify the architecture -# in question. -# -case "${target}" in - mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; - mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";; - mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - *) SIM_SUBTARGET="";; -esac - - - - # # Select the bitsize of the target # diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac index 52e54bc8bce..308b3aefbeb 100644 --- a/sim/mips/configure.ac +++ b/sim/mips/configure.ac @@ -6,25 +6,6 @@ dnl The sim shouldn't be checking $target and changing behavior. But it is, dnl and until we clean that up, we need to expand --target for use below. AC_CANONICAL_SYSTEM -# DEPRECATED -# -# Instead of defining a `subtarget' macro, code should be checking -# the value of {STATE,CPU}_ARCHITECTURE to identify the architecture -# in question. -# -case "${target}" in - mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;; - mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";; - mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";; - *) SIM_SUBTARGET="";; -esac -AC_SUBST(SIM_SUBTARGET) - - - # # Select the bitsize of the target # -- 2.30.2