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