configure.ac 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(Makefile.in)
  3. AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
  4. # DEPRECATED
  5. #
  6. # Instead of defining a `subtarget' macro, code should be checking
  7. # the value of {STATE,CPU}_ARCHITECTURE to identify the architecture
  8. # in question.
  9. #
  10. case "${target}" in
  11. mips64vr*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1" ;;
  12. mips*tx39*) SIM_SUBTARGET="-DSUBTARGET_R3900=1";;
  13. mips*-sde-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  14. mips*-mti-elf*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  15. mipsisa32*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  16. mipsisa64*-*-*) SIM_SUBTARGET="-DTARGET_ENABLE_FR=1";;
  17. *) SIM_SUBTARGET="";;
  18. esac
  19. AC_SUBST(SIM_SUBTARGET)
  20. #
  21. # Select the bitsize of the target
  22. #
  23. case "${target}" in
  24. mips*-sde-elf*) mips_bitsize=64 ; mips_msb=63 ;;
  25. mips*-mti-elf*) mips_bitsize=64 ; mips_msb=63 ;;
  26. mips64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  27. mips16*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  28. mipsisa32*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
  29. mipsisa64*-*-*) mips_bitsize=64 ; mips_msb=63 ;;
  30. mips*-*-*) mips_bitsize=32 ; mips_msb=31 ;;
  31. *) mips_bitsize=64 ; mips_msb=63 ;;
  32. esac
  33. SIM_AC_OPTION_BITSIZE($mips_bitsize,$mips_msb)
  34. #
  35. # Select the floating hardware support of the target
  36. #
  37. mips_fpu=HARDWARE_FLOATING_POINT
  38. mips_fpu_bitsize=
  39. case "${target}" in
  40. mips*tx39*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
  41. mips*-sde-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  42. mips*-mti-elf*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  43. mips64*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
  44. mips16*-*-*) mips_fpu=HARD_FLOATING_POINT ;;
  45. mipsisa32*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  46. mipsisa64*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=64 ;;
  47. mips*-*-*) mips_fpu=HARD_FLOATING_POINT ; mips_fpu_bitsize=32 ;;
  48. *) mips_fpu=HARD_FLOATING_POINT ;;
  49. esac
  50. SIM_AC_OPTION_FLOAT($mips_fpu,$mips_fpu_bitsize)
  51. #
  52. # Select the IGEN architecture
  53. #
  54. sim_gen=IGEN
  55. sim_igen_machine="-M mipsIV"
  56. sim_m16_machine="-M mips16,mipsIII"
  57. sim_igen_filter="32,64,f"
  58. sim_m16_filter="16"
  59. sim_mach_default="mips8000"
  60. case "${target}" in
  61. mips*tx39*) sim_gen=IGEN
  62. sim_igen_filter="32,f"
  63. sim_igen_machine="-M r3900"
  64. ;;
  65. mips64vr43*-*-*) sim_gen=IGEN
  66. sim_igen_machine="-M mipsIV"
  67. sim_mach_default="mips8000"
  68. ;;
  69. mips64vr5*-*-*) sim_gen=IGEN
  70. sim_igen_machine="-M vr5000"
  71. sim_mach_default="mips5000"
  72. ;;
  73. mips64vr41*) sim_gen=M16
  74. sim_igen_machine="-M vr4100"
  75. sim_m16_machine="-M vr4100"
  76. sim_igen_filter="32,64,f"
  77. sim_m16_filter="16"
  78. sim_mach_default="mips4100"
  79. ;;
  80. mips64vr-*-* | mips64vrel-*-*)
  81. sim_gen=MULTI
  82. sim_multi_configs="\
  83. vr4100:mipsIII,mips16,vr4100:32,64:mips4100,mips4111\
  84. vr4120:mipsIII,mips16,vr4120:32,64:mips4120\
  85. vr5000:mipsIV:32,64,f:mips4300,mips5000\
  86. vr5400:mipsIV,vr5400:32,64,f:mips5400\
  87. vr5500:mipsIV,vr5500:32,64,f:mips5500"
  88. sim_multi_default=mips5000
  89. ;;
  90. mips*-sde-elf* | mips*-mti-elf*)
  91. sim_gen=MULTI
  92. sim_multi_configs="\
  93. micromips:micromips64,micromipsdsp:32,64,f:mips_micromips\
  94. mipsisa64r2:mips64r2,mips16,mips16e,mdmx,dsp,dsp2,mips3d,smartmips:32,64,f:mipsisa32r2,mipsisa64r2,mipsisa32r5,mipsisa64r5\
  95. mipsisa64r6:mips64r6:32,64,f:mipsisa32r6,mipsisa64r6"
  96. sim_multi_default=mipsisa64r2
  97. ;;
  98. mips64*-*-*) sim_igen_filter="32,64,f"
  99. sim_gen=IGEN
  100. ;;
  101. mips16*-*-*) sim_gen=M16
  102. sim_igen_filter="32,64,f"
  103. sim_m16_filter="16"
  104. ;;
  105. mipsisa32r2*-*-*) sim_gen=MULTI
  106. sim_multi_configs="\
  107. micromips:micromips32,micromipsdsp:32,f:mips_micromips\
  108. mips32r2:mips32r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2"
  109. sim_multi_default=mipsisa32r2
  110. ;;
  111. mipsisa32r6*-*-*) sim_gen=IGEN
  112. sim_igen_machine="-M mips32r6"
  113. sim_igen_filter="32,f"
  114. sim_mach_default="mipsisa32r6"
  115. ;;
  116. mipsisa32*-*-*) sim_gen=M16
  117. sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
  118. sim_m16_machine="-M mips16,mips16e,mips32"
  119. sim_igen_filter="32,f"
  120. sim_mach_default="mipsisa32"
  121. ;;
  122. mipsisa64r2*-*-*) sim_gen=M16
  123. sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
  124. sim_m16_machine="-M mips16,mips16e,mips64r2"
  125. sim_igen_filter="32,64,f"
  126. sim_mach_default="mipsisa64r2"
  127. ;;
  128. mipsisa64r6*-*-*) sim_gen=IGEN
  129. sim_igen_machine="-M mips64r6"
  130. sim_igen_filter="32,64,f"
  131. sim_mach_default="mipsisa64r6"
  132. ;;
  133. mipsisa64sb1*-*-*) sim_gen=IGEN
  134. sim_igen_machine="-M mips64,mips3d,sb1"
  135. sim_igen_filter="32,64,f"
  136. sim_mach_default="mips_sb1"
  137. ;;
  138. mipsisa64*-*-*) sim_gen=M16
  139. sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
  140. sim_m16_machine="-M mips16,mips16e,mips64"
  141. sim_igen_filter="32,64,f"
  142. sim_mach_default="mipsisa64"
  143. ;;
  144. mips*lsi*) sim_gen=M16
  145. sim_igen_machine="-M mipsIII,mips16"
  146. sim_m16_machine="-M mips16,mipsIII"
  147. sim_igen_filter="32,f"
  148. sim_m16_filter="16"
  149. sim_mach_default="mips4000"
  150. ;;
  151. mips*-*-*) sim_gen=IGEN
  152. sim_igen_filter="32,f"
  153. ;;
  154. esac
  155. # The MULTI generator can combine several simulation engines into one.
  156. # executable. A configuration which uses the MULTI should set two
  157. # variables: ${sim_multi_configs} and ${sim_multi_default}.
  158. #
  159. # ${sim_multi_configs} is the list of engines to build. Each
  160. # space-separated entry has the form NAME:MACHINE:FILTER:BFDMACHS,
  161. # where:
  162. #
  163. # - NAME is a C-compatible prefix for the engine,
  164. # - MACHINE is a -M argument,
  165. # - FILTER is a -F argument, and
  166. # - BFDMACHS is a comma-separated list of bfd machines that the
  167. # simulator can run.
  168. #
  169. # Each entry will have a separate simulation engine whose prefix is
  170. # m32<NAME>. If the machine list includes "mips16", there will also
  171. # be a mips16 engine, prefix m16<NAME>. The mips16 engine will be
  172. # generated using the same machine list as the 32-bit version,
  173. # but the filter will be "16" instead of FILTER.
  174. #
  175. # The simulator compares the bfd mach against BFDMACHS to decide
  176. # which engine to use. Entries in BFDMACHS should be bfd_mach
  177. # values with "bfd_mach_" removed. ${sim_multi_default} says
  178. # which entry should be the default.
  179. if test ${sim_gen} = MULTI; then
  180. # Simple sanity check.
  181. if test -z "${sim_multi_configs}" || test -z "${sim_multi_default}"; then
  182. AC_MSG_ERROR(Error in configure.ac: MULTI simulator not set up correctly)
  183. fi
  184. # Start in a known state.
  185. rm -f multi-include.h multi-run.c
  186. sim_multi_flags=
  187. sim_multi_src=
  188. sim_multi_obj=
  189. sim_multi_igen_configs=
  190. sim_seen_default=no
  191. cat << __EOF__ > multi-run.c
  192. /* Main entry point for MULTI simulators.
  193. Copyright (C) 2003-2022 Free Software Foundation, Inc.
  194. This program is free software; you can redistribute it and/or modify
  195. it under the terms of the GNU General Public License as published by
  196. the Free Software Foundation; either version 3 of the License, or
  197. (at your option) any later version.
  198. This program is distributed in the hope that it will be useful,
  199. but WITHOUT ANY WARRANTY; without even the implied warranty of
  200. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  201. GNU General Public License for more details.
  202. You should have received a copy of the GNU General Public License
  203. along with this program. If not, see <http://www.gnu.org/licenses/>.
  204. --
  205. This file was generated by sim/mips/configure. */
  206. #include "sim-main.h"
  207. #include "multi-include.h"
  208. #include "elf-bfd.h"
  209. #include "elfxx-mips.h"
  210. #include "elf/mips.h"
  211. #define SD sd
  212. #define CPU cpu
  213. void
  214. sim_engine_run (SIM_DESC sd,
  215. int next_cpu_nr,
  216. int nr_cpus,
  217. int signal) /* ignore */
  218. {
  219. int mach;
  220. if (STATE_ARCHITECTURE (sd) == NULL)
  221. mach = bfd_mach_${sim_multi_default};
  222. else if (elf_elfheader (STATE_PROG_BFD (sd))->e_flags
  223. & EF_MIPS_ARCH_ASE_MICROMIPS)
  224. mach = bfd_mach_mips_micromips;
  225. else
  226. {
  227. mach = _bfd_elf_mips_mach (elf_elfheader (STATE_PROG_BFD (sd))->e_flags);
  228. if (!mach)
  229. mach = STATE_ARCHITECTURE (SD)->mach;
  230. }
  231. switch (mach)
  232. {
  233. __EOF__
  234. for fc in ${sim_multi_configs}; do
  235. # Split up the entry. ${c} contains the first three elements.
  236. # Note: outer sqaure brackets are m4 quotes.
  237. c=`echo ${fc} | sed ['s/:[^:]*$//']`
  238. bfdmachs=`echo ${fc} | sed 's/.*://'`
  239. name=`echo ${c} | sed 's/:.*//'`
  240. machine=`echo ${c} | sed 's/.*:\(.*\):.*/\1/'`
  241. filter=`echo ${c} | sed 's/.*://'`
  242. # Build the following lists:
  243. #
  244. # sim_multi_flags: all -M and -F flags used by the simulator
  245. # sim_multi_src: all makefile-generated source files
  246. # sim_multi_obj: the objects for ${sim_multi_src}
  247. # sim_multi_igen_configs: igen configuration strings.
  248. #
  249. # Each entry in ${sim_multi_igen_configs} is a prefix (m32
  250. # or m16) followed by the NAME, MACHINE and FILTER part of
  251. # the ${sim_multi_configs} entry.
  252. sim_multi_flags="${sim_multi_flags} -F ${filter} -M ${machine}"
  253. # Check whether special handling is needed.
  254. case ${c} in
  255. *:*mips16*:*)
  256. # Run igen twice, once for normal mode and once for mips16.
  257. ws="m32 m16"
  258. # The top-level function for the mips16 simulator is
  259. # in a file m16${name}_run.c, generated by the
  260. # tmp-run-multi Makefile rule.
  261. sim_multi_src="${sim_multi_src} m16${name}_run.c"
  262. sim_multi_obj="${sim_multi_obj} m16${name}_run.o"
  263. sim_multi_flags="${sim_multi_flags} -F 16"
  264. ;;
  265. *:*micromips32*:*)
  266. # Run igen thrice, once for micromips32, once for micromips16,
  267. # and once for m32.
  268. ws="micromips_m32 micromips16 micromips32"
  269. # The top-level function for the micromips simulator is
  270. # in a file micromips${name}_run.c, generated by the
  271. # tmp-run-multi Makefile rule.
  272. sim_multi_src="${sim_multi_src} micromips${name}_run.c"
  273. sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
  274. sim_multi_flags="${sim_multi_flags} -F 16,32"
  275. ;;
  276. *:*micromips64*:*)
  277. # Run igen thrice, once for micromips64, once for micromips16,
  278. # and once for m64.
  279. ws="micromips_m64 micromips16 micromips64"
  280. # The top-level function for the micromips simulator is
  281. # in a file micromips${name}_run.c, generated by the
  282. # tmp-run-multi Makefile rule.
  283. sim_multi_src="${sim_multi_src} micromips${name}_run.c"
  284. sim_multi_obj="${sim_multi_obj} micromips${name}_run.o"
  285. sim_multi_flags="${sim_multi_flags} -F 16,32,64"
  286. ;;
  287. *)
  288. ws=m32
  289. ;;
  290. esac
  291. # Now add the list of igen-generated files to ${sim_multi_src}
  292. # and ${sim_multi_obj}.
  293. for w in ${ws}; do
  294. for base in engine icache idecode model semantics support; do
  295. sim_multi_src="${sim_multi_src} ${w}${name}_${base}.c"
  296. sim_multi_src="${sim_multi_src} ${w}${name}_${base}.h"
  297. sim_multi_obj="${sim_multi_obj} ${w}${name}_${base}.o"
  298. done
  299. sim_multi_igen_configs="${sim_multi_igen_configs} ${w}${c}"
  300. done
  301. # Add an include for the engine.h file. This file declares the
  302. # top-level foo_engine_run() function.
  303. echo "#include \"${w}${name}_engine.h\"" >> multi-include.h
  304. # Add case statements for this engine to sim_engine_run().
  305. for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
  306. echo " case bfd_mach_${mach}:" >> multi-run.c
  307. if test ${mach} = ${sim_multi_default}; then
  308. echo " default:" >> multi-run.c
  309. sim_seen_default=yes
  310. fi
  311. done
  312. echo " ${w}${name}_engine_run (sd, next_cpu_nr, nr_cpus, signal);" \
  313. >> multi-run.c
  314. echo " break;" >> multi-run.c
  315. done
  316. # Check whether we added a 'default:' label.
  317. if test ${sim_seen_default} = no; then
  318. AC_MSG_ERROR(Error in configure.ac: \${sim_multi_configs} doesn't have an entry for \${sim_multi_default})
  319. fi
  320. cat << __EOF__ >> multi-run.c
  321. }
  322. }
  323. int
  324. mips_mach_multi (SIM_DESC sd)
  325. {
  326. if (STATE_ARCHITECTURE (sd) == NULL)
  327. return bfd_mach_${sim_multi_default};
  328. switch (STATE_ARCHITECTURE (SD)->mach)
  329. {
  330. __EOF__
  331. # Add case statements for this engine to mips_mach_multi().
  332. for fc in ${sim_multi_configs}; do
  333. # Split up the entry. ${c} contains the first three elements.
  334. # Note: outer sqaure brackets are m4 quotes.
  335. c=`echo ${fc} | sed ['s/:[^:]*$//']`
  336. bfdmachs=`echo ${fc} | sed 's/.*://'`
  337. for mach in `echo ${bfdmachs} | sed 's/,/ /g'`; do
  338. echo " case bfd_mach_${mach}:" >> multi-run.c
  339. done
  340. done
  341. cat << __EOF__ >> multi-run.c
  342. return (STATE_ARCHITECTURE (SD)->mach);
  343. default:
  344. return bfd_mach_${sim_multi_default};
  345. }
  346. }
  347. __EOF__
  348. SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_MULTI"
  349. else
  350. # For clean-extra
  351. sim_multi_src=doesnt-exist.c
  352. if test x"${sim_mach_default}" = x""; then
  353. AC_MSG_ERROR(Error in configure.ac: \${sim_mach_default} not defined)
  354. fi
  355. SIM_SUBTARGET="$SIM_SUBTARGET -DMIPS_MACH_DEFAULT=bfd_mach_${sim_mach_default}"
  356. fi
  357. sim_igen_flags="-F ${sim_igen_filter} ${sim_igen_machine} ${sim_igen_smp}"
  358. sim_m16_flags=" -F ${sim_m16_filter} ${sim_m16_machine} ${sim_igen_smp}"
  359. sim_micromips16_flags=" -F ${sim_micromips16_filter} ${sim_micromips16_machine} ${sim_igen_smp}"
  360. sim_micromips_flags=" -F ${sim_micromips_filter} ${sim_micromips_machine} ${sim_igen_smp}"
  361. AC_SUBST(sim_igen_flags)
  362. AC_SUBST(sim_m16_flags)
  363. AC_SUBST(sim_micromips_flags)
  364. AC_SUBST(sim_micromips16_flags)
  365. AC_SUBST(sim_gen)
  366. AC_SUBST(sim_multi_flags)
  367. AC_SUBST(sim_multi_igen_configs)
  368. AC_SUBST(sim_multi_src)
  369. AC_SUBST(sim_multi_obj)
  370. SIM_AC_OUTPUT