1# SPDX-License-Identifier: GPL-3.0-or-later
2# GCC target-specific configuration file.
3# Copyright (C) 1997-2022 Free Software Foundation, Inc.
4
5#This file is part of GCC.
6
7#GCC is free software; you can redistribute it and/or modify it under
8#the terms of the GNU General Public License as published by the Free
9#Software Foundation; either version 3, or (at your option) any later
10#version.
11
12#GCC is distributed in the hope that it will be useful, but WITHOUT
13#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14#FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15#for more details.
16
17#You should have received a copy of the GNU General Public License
18#along with GCC; see the file COPYING3.  If not see
19#<http://www.gnu.org/licenses/>.
20
21# This is the GCC target-specific configuration file
22# where a configuration type is mapped to different system-specific
23# definitions and files.  This is invoked by the autoconf-generated
24# configure script.  Putting it in a separate shell file lets us skip
25# running autoconf when modifying target-specific information.
26
27# When you change the cases in the OS or target switches, consider
28# updating ../libgcc/config.host also.
29
30# This file switches on the shell variable ${target}, and also uses the
31# following shell variables:
32#
33#  with_*		Various variables as set by configure.
34#
35#  enable_threads	Either the name, yes or no depending on whether
36#			threads support was requested.
37#
38#  default_use_cxa_atexit
39#			  The default value for the $enable___cxa_atexit
40#			variable.  enable___cxa_atexit needs to be set to
41#			"yes" for the correct operation of C++ destructors
42#			but it relies upon the presence of a non-standard C
43#			library	function called	__cxa_atexit.
44#			  Since not all C libraries provide __cxa_atexit the
45#			default value of $default_use_cxa_atexit is set to
46#			"no" except for targets which are known to be OK.
47#
48#  default_gnu_indirect_function
49#                       The default value for the $enable_gnu_indirect_function
50#                       variable.  enable_gnu_indirect_function relies
51#			upon the presence of a non-standard gnu ifunc support
52#			in the assembler, linker and dynamic linker.
53#			Since not all libraries provide the dynamic linking
54#			support, the default value of
55#			$default_gnu_indirect_function is set to
56#			"no" except for targets which are known to be OK.
57#
58#  gas_flag		Either yes or no depending on whether GNU as was
59#			requested.
60#
61#  gnu_ld_flag		Either yes or no depending on whether GNU ld was
62#			requested.
63
64# This file sets the following shell variables for use by the
65# autoconf-generated configure script:
66#
67#  cpu_type		The name of the cpu, if different from the first
68#			chunk of the canonical target name.
69#
70#  tm_defines		List of target macros to define for all compilations.
71#
72#  tm_file		A list of target macro files, if different from
73#			"$cpu_type/$cpu_type.h". Usually it's constructed
74#			per target in a way like this:
75#			tm_file="${tm_file} dbxelf.h elfos.h ${cpu_type.h}/elf.h"
76#			Note that the preferred order is:
77#			- specific target header "${cpu_type}/${cpu_type.h}"
78#			- generic headers like dbxelf.h elfos.h, etc.
79#			- specializing target headers like ${cpu_type.h}/elf.h
80#			This helps to keep OS specific stuff out of the CPU
81#			defining header ${cpu_type}/${cpu_type.h}.
82#
83#			It is possible to include automatically-generated
84#			build-directory files by prefixing them with "./".
85#			All other files should relative to $srcdir/config.
86#
87#  tm_p_file		Location of file with declarations for functions
88#			in $out_file.
89#
90#  tm_d_file		A list of headers with definitions of target hook
91#			macros for the D compiler.
92#
93#  out_file		The name of the machine description C support
94#			file, if different from "$cpu_type/$cpu_type.c".
95#
96#  common_out_file	The name of the source file for code shared between
97#			the compiler proper and the driver.
98#
99#  md_file		The name of the machine-description file, if
100#			different from "$cpu_type/$cpu_type.md".
101#
102#  tmake_file		A list of machine-description-specific
103#			makefile-fragments, if different from
104#			"$cpu_type/t-$cpu_type".
105#
106#  extra_modes          The name of the file containing a list of extra
107#                       machine modes, if necessary and different from
108#                       "$cpu_type/$cpu_type-modes.def".
109#
110#  extra_objs		List of extra objects that should be linked into
111#			the compiler proper (cc1, cc1obj, cc1plus)
112#			depending on target.
113#
114#  extra_gcc_objs	List of extra objects that should be linked into
115#			the compiler driver (gcc) depending on target.
116#
117#  extra_headers	List of used header files from the directory
118#			config/${cpu_type}.
119#
120#  user_headers_inc_next_pre
121#			List of header file names of internal gcc header
122#			files, which should be prefixed by an include_next.
123#  user_headers_inc_next_post
124#			List of header file names of internal gcc header
125#			files, which should be postfixed by an include_next.
126#  use_gcc_tgmath	If set, add tgmath.h to the list of used header
127#			files.
128#
129#  use_gcc_stdint	If "wrap", install a version of stdint.h that
130#			wraps the system's copy for hosted compilations;
131#			if "provide", provide a version of systems without
132#			such a system header; otherwise "none", do not
133#			provide such a header at all.
134#
135#  extra_programs	List of extra executables compiled for this target
136#			machine, used when linking.
137#
138#  extra_options	List of target-dependent .opt files.
139#
140#  c_target_objs	List of extra target-dependent objects that be
141#			linked into the C compiler only.
142#
143#  cxx_target_objs	List of extra target-dependent objects that be
144#			linked into the C++ compiler only.
145#
146#  d_target_objs	List of extra target-dependent objects that be
147#			linked into the D compiler only.
148#
149#  fortran_target_objs	List of extra target-dependent objects that be
150#			linked into the fortran compiler only.
151#
152#  target_gtfiles       List of extra source files with type information.
153#
154#  xm_defines		List of macros to define when compiling for the
155#			target machine.
156#
157#  xm_file		List of files to include when compiling for the
158#			target machine.
159#
160#  use_collect2		Set to yes or no, depending on whether collect2
161#			will be used.
162#
163#  target_cpu_default	Set to override the default target model.
164#
165#  gdb_needs_out_file_path
166#			Set to yes if gdb needs a dir command with
167#			`dirname $out_file`.
168#
169#  thread_file		Set to control which thread package to use.
170#
171#  gas			Set to yes or no depending on whether the target
172#			system normally uses GNU as.
173#
174#  configure_default_options
175#			Set to an initializer for configure_default_options
176#			in configargs.h, based on --with-cpu et cetera.
177#
178#  native_system_header_dir
179#			Where system header files are found for this
180#			target.  This defaults to /usr/include.  If
181#			the --with-sysroot configure option or the
182#			--sysroot command line option is used this
183#			will be relative to the sysroot.
184# target_type_format_char 
185# 			The default character to be used for formatting
186#			the attribute in a
187#			.type symbol_name, ${t_t_f_c}<property>
188#			directive.
189
190# The following variables are used in each case-construct to build up the
191# outgoing variables:
192#
193#  gnu_ld		Set to yes or no depending on whether the target
194#			system normally uses GNU ld.
195#
196#  target_has_targetcm	Set to yes or no depending on whether the target
197#			has its own definition of targetcm.
198#
199#  target_has_targetm_common	Set to yes or no depending on whether the
200#			target has its own definition of targetm_common.
201#
202#  target_has_targetdm	Set to yes or no depending on whether the target
203#			has its own definition of targetdm.
204
205out_file=
206common_out_file=
207tmake_file=
208extra_headers=
209user_headers_inc_next_pre=
210user_headers_inc_next_post=
211use_gcc_tgmath=yes
212use_gcc_stdint=none
213extra_programs=
214extra_objs=
215extra_gcc_objs=
216extra_options=
217c_target_objs=
218cxx_target_objs=
219d_target_objs=
220fortran_target_objs=
221target_has_targetcm=no
222target_has_targetm_common=yes
223target_has_targetdm=no
224tm_defines=
225xm_defines=
226# Set this to force installation and use of collect2.
227use_collect2=
228# Set this to override the default target model.
229target_cpu_default=
230# Set this if gdb needs a dir command with `dirname $out_file`
231gdb_needs_out_file_path=
232# Set this to control which thread package will be used.
233thread_file=
234# Reinitialize these from the flag values every loop pass, since some
235# configure entries modify them.
236gas="$gas_flag"
237gnu_ld="$gnu_ld_flag"
238default_use_cxa_atexit=no
239default_gnu_indirect_function=no
240target_gtfiles=
241need_64bit_isa=
242native_system_header_dir=/usr/include
243target_type_format_char='@'
244
245# Don't carry these over build->host->target.  Please.
246xm_file=
247md_file=
248
249# Obsolete configurations.
250case ${target} in
251  tile*-*-*				\
252 | cr16-*-*				\
253 | hppa[12]*-*-hpux10*			\
254 | hppa[12]*-*-hpux11*			\
255 | m32c-*-rtems*			\
256 )
257    if test "x$enable_obsolete" != xyes; then
258      echo "*** Configuration ${target} is obsolete." >&2
259      echo "*** Specify --enable-obsolete to build it anyway." >&2
260      echo "*** Support will be REMOVED in the next major release of GCC," >&2
261      echo "*** unless a maintainer comes forward." >&2
262      exit 1
263    fi;;
264esac
265
266# Unsupported targets list.  Do not put an entry in this list unless
267# it would otherwise be caught by a more permissive pattern.  The list
268# should be in alphabetical order.
269case ${target} in
270 # Avoid special cases that are not obsolete
271   arm*-*-*eabi*			\
272 )
273	;;
274   arm*-wince-pe*			\
275 | arm*-*-ecos-elf			\
276 | arm*-*-elf				\
277 | arm*-*-linux*			\
278 | arm*-*-uclinux*			\
279 | cris-*-linux*			\
280 | crisv32-*-*				\
281 | i[34567]86-go32-*			\
282 | i[34567]86-*-go32*			\
283 | m32r-*-linux*			\
284 | m32rle-*-linux*			\
285 | m68k*-*-openbsd*			\
286 | m68k-*-uclinuxoldabi*		\
287 | mips64orion*-*-rtems*		\
288 | pdp11-*-bsd				\
289 | powerpc*-*-linux*paired*		\
290 | powerpc*-*-*spe*			\
291 | sparc-hal-solaris2*			\
292 | spu*-*-*				\
293 | thumb-*-*				\
294 | *-*-freebsd[12] | *-*-freebsd[1234].* \
295 | *-*-freebsd*aout*			\
296 | *-*-linux*aout*			\
297 | *-*-linux*coff*			\
298 | *-*-linux*libc1*			\
299 | *-*-linux*oldld*			\
300 | *-*-rtemsaout*			\
301 | *-*-rtemscoff*			\
302 | *-*-solaris2				\
303 | *-*-solaris2.[0-9]			\
304 | *-*-solaris2.[0-9].*			\
305 | *-*-solaris2.10*			\
306 | *-*-sysv*				\
307 | vax-*-vms*				\
308 )
309	echo "*** Configuration ${target} not supported" 1>&2
310	exit 1
311	;;
312esac
313
314# Set default cpu_type, tm_file, tm_p_file and xm_file so it can be
315# updated in each machine entry.  Also set default extra_headers for some
316# machines.
317tm_p_file=
318cpu_type=`echo ${target} | sed 's/-.*$//'`
319cpu_is_64bit=
320case ${target} in
321m32c*-*-*)
322        cpu_type=m32c
323	tmake_file=m32c/t-m32c
324	target_has_targetm_common=no
325        ;;
326aarch64*-*-*)
327	cpu_type=aarch64
328	extra_headers="arm_fp16.h arm_neon.h arm_bf16.h arm_acle.h arm_sve.h"
329	c_target_objs="aarch64-c.o"
330	cxx_target_objs="aarch64-c.o"
331	d_target_objs="aarch64-d.o"
332	extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch64-bti-insert.o aarch64-cc-fusion.o"
333	target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
334	target_has_targetm_common=yes
335	;;
336alpha*-*-*)
337	cpu_type=alpha
338	extra_options="${extra_options} g.opt"
339	;;
340amdgcn*)
341	cpu_type=gcn
342	use_gcc_stdint=wrap
343	;;
344am33_2.0-*-linux*)
345	cpu_type=mn10300
346	;;
347arc*-*-*)
348	cpu_type=arc
349	c_target_objs="arc-c.o"
350	cxx_target_objs="arc-c.o"
351	extra_options="${extra_options} arc/arc-tables.opt g.opt"
352	extra_headers="arc-simd.h"
353	;;
354arm*-*-*)
355	cpu_type=arm
356	extra_objs="arm-builtins.o arm-mve-builtins.o aarch-common.o"
357	extra_headers="mmintrin.h arm_neon.h arm_acle.h arm_fp16.h arm_cmse.h arm_bf16.h arm_mve_types.h arm_mve.h arm_cde.h"
358	target_type_format_char='%'
359	c_target_objs="arm-c.o"
360	cxx_target_objs="arm-c.o"
361	d_target_objs="arm-d.o"
362	extra_options="${extra_options} arm/arm-tables.opt"
363	target_gtfiles="\$(srcdir)/config/arm/arm-builtins.cc \$(srcdir)/config/arm/arm-mve-builtins.h \$(srcdir)/config/arm/arm-mve-builtins.cc"
364	;;
365avr-*-*)
366	cpu_type=avr
367	c_target_objs="avr-c.o"
368	cxx_target_objs="avr-c.o"
369	;;
370bfin*-*)
371	cpu_type=bfin
372	;;
373bpf-*-*)
374	cpu_type=bpf
375	;;
376frv*)	cpu_type=frv
377	extra_options="${extra_options} g.opt"
378	;;
379ft32*)	cpu_type=ft32
380	target_has_targetm_common=no
381	;;
382moxie*)	cpu_type=moxie
383	target_has_targetm_common=no
384	;;
385fido-*-*)
386	cpu_type=m68k
387	extra_headers=math-68881.h
388	extra_options="${extra_options} m68k/m68k-tables.opt"
389        ;;
390i[34567]86-*-* | x86_64-*-*)
391	cpu_type=i386
392	c_target_objs="i386-c.o"
393	cxx_target_objs="i386-c.o"
394	d_target_objs="i386-d.o"
395	extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o"
396	target_gtfiles="\$(srcdir)/config/i386/i386-builtins.cc \$(srcdir)/config/i386/i386-expand.cc \$(srcdir)/config/i386/i386-options.cc"
397	extra_options="${extra_options} fused-madd.opt"
398	extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
399		       pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
400		       nmmintrin.h bmmintrin.h fma4intrin.h wmmintrin.h
401		       immintrin.h x86intrin.h avxintrin.h xopintrin.h
402		       ia32intrin.h cross-stdarg.h lwpintrin.h popcntintrin.h
403		       lzcntintrin.h bmiintrin.h bmi2intrin.h tbmintrin.h
404		       avx2intrin.h avx512fintrin.h fmaintrin.h f16cintrin.h
405		       rtmintrin.h xtestintrin.h rdseedintrin.h prfchwintrin.h
406		       adxintrin.h fxsrintrin.h xsaveintrin.h xsaveoptintrin.h
407		       avx512cdintrin.h avx512erintrin.h avx512pfintrin.h
408		       shaintrin.h clflushoptintrin.h xsavecintrin.h
409		       xsavesintrin.h avx512dqintrin.h avx512bwintrin.h
410		       avx512vlintrin.h avx512vlbwintrin.h avx512vldqintrin.h
411		       avx512ifmaintrin.h avx512ifmavlintrin.h avx512vbmiintrin.h
412		       avx512vbmivlintrin.h avx5124fmapsintrin.h avx5124vnniwintrin.h
413		       avx512vpopcntdqintrin.h clwbintrin.h mwaitxintrin.h
414		       clzerointrin.h pkuintrin.h sgxintrin.h cetintrin.h
415		       gfniintrin.h cet.h avx512vbmi2intrin.h
416		       avx512vbmi2vlintrin.h avx512vnniintrin.h
417		       avx512vnnivlintrin.h vaesintrin.h vpclmulqdqintrin.h
418		       avx512vpopcntdqvlintrin.h avx512bitalgintrin.h
419		       pconfigintrin.h wbnoinvdintrin.h movdirintrin.h
420		       waitpkgintrin.h cldemoteintrin.h avx512bf16vlintrin.h
421		       avx512bf16intrin.h enqcmdintrin.h serializeintrin.h
422		       avx512vp2intersectintrin.h avx512vp2intersectvlintrin.h
423		       tsxldtrkintrin.h amxtileintrin.h amxint8intrin.h
424		       amxbf16intrin.h x86gprintrin.h uintrintrin.h
425		       hresetintrin.h keylockerintrin.h avxvnniintrin.h
426		       mwaitintrin.h avx512fp16intrin.h avx512fp16vlintrin.h"
427	;;
428ia64-*-*)
429	extra_headers=ia64intrin.h
430	extra_options="${extra_options} g.opt fused-madd.opt"
431	;;
432hppa*-*-*)
433	cpu_type=pa
434	;;
435lm32*)
436	extra_options="${extra_options} g.opt"
437	;;
438m32r*-*-*)
439        cpu_type=m32r
440	extra_options="${extra_options} g.opt"
441        ;;
442m5200-*-*|m5407-*-*)
443	cpu_type=m68k
444	extra_headers=math-68881.h
445	extra_options="${extra_options} m68k/m68k-tables.opt"
446	;;
447m680[012]0-*-*)
448	cpu_type=m68k
449	extra_headers=math-68881.h
450	extra_options="${extra_options} m68k/m68k-tables.opt"
451	;;
452m68k-*-*)
453	extra_headers=math-68881.h
454	extra_options="${extra_options} m68k/m68k-tables.opt"
455	;;
456microblaze*-*-*)
457        cpu_type=microblaze
458	extra_options="${extra_options} g.opt"
459        ;;
460mips*-*-*)
461	cpu_type=mips
462	d_target_objs="mips-d.o"
463	extra_headers="loongson.h loongson-mmiintrin.h msa.h"
464	extra_objs="frame-header-opt.o"
465	extra_options="${extra_options} g.opt fused-madd.opt mips/mips-tables.opt"
466	;;
467loongarch*-*-*)
468	cpu_type=loongarch
469	extra_headers="larchintrin.h"
470	extra_objs="loongarch-c.o loongarch-builtins.o loongarch-cpu.o loongarch-opts.o loongarch-def.o"
471	extra_gcc_objs="loongarch-driver.o loongarch-cpu.o loongarch-opts.o loongarch-def.o"
472	extra_options="${extra_options} g.opt fused-madd.opt"
473	;;
474nds32*)
475	cpu_type=nds32
476	extra_headers="nds32_intrinsic.h nds32_isr.h nds32_init.inc"
477	case ${target} in
478	  nds32*-*-linux*)
479	    extra_options="${extra_options} nds32/nds32-linux.opt"
480	    ;;
481	  nds32*-*-elf*)
482	    extra_options="${extra_options} nds32/nds32-elf.opt"
483	    ;;
484	  *)
485	    ;;
486	esac
487	extra_objs="nds32-cost.o nds32-intrinsic.o nds32-isr.o nds32-md-auxiliary.o nds32-pipelines-auxiliary.o nds32-predicates.o nds32-memory-manipulation.o nds32-fp-as-gp.o nds32-relax-opt.o nds32-utils.o"
488	;;
489nios2-*-*)
490	cpu_type=nios2
491	extra_options="${extra_options} g.opt"
492	;;
493nvptx-*-*)
494	cpu_type=nvptx
495	c_target_objs="nvptx-c.o"
496	cxx_target_objs="nvptx-c.o"
497	extra_options="${extra_options} nvptx/nvptx-gen.opt"
498	;;
499or1k*-*-*)
500	cpu_type=or1k
501	;;
502powerpc*-*-*)
503	cpu_type=rs6000
504	extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o"
505	extra_objs="${extra_objs} rs6000-call.o rs6000-pcrel-opt.o"
506	extra_objs="${extra_objs} rs6000-builtins.o rs6000-builtin.o"
507	extra_headers="ppc-asm.h altivec.h htmintrin.h htmxlintrin.h"
508	extra_headers="${extra_headers} bmi2intrin.h bmiintrin.h"
509	extra_headers="${extra_headers} xmmintrin.h mm_malloc.h emmintrin.h"
510	extra_headers="${extra_headers} mmintrin.h x86intrin.h"
511	extra_headers="${extra_headers} pmmintrin.h tmmintrin.h smmintrin.h"
512	extra_headers="${extra_headers} nmmintrin.h immintrin.h x86gprintrin.h"
513	extra_headers="${extra_headers} ppu_intrinsics.h spu2vmx.h vec_types.h si2vmx.h"
514	extra_headers="${extra_headers} amo.h"
515	case x$with_cpu in
516	    xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456789]|xpower10|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|xe6500)
517		cpu_is_64bit=yes
518		;;
519	esac
520	extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
521	target_gtfiles="$target_gtfiles \$(srcdir)/config/rs6000/rs6000-logue.cc \$(srcdir)/config/rs6000/rs6000-call.cc"
522	target_gtfiles="$target_gtfiles \$(srcdir)/config/rs6000/rs6000-pcrel-opt.cc"
523	target_gtfiles="$target_gtfiles ./rs6000-builtins.h"
524	;;
525pru-*-*)
526	cpu_type=pru
527	;;
528riscv*)
529	cpu_type=riscv
530	extra_objs="riscv-builtins.o riscv-c.o riscv-sr.o riscv-shorten-memrefs.o"
531	d_target_objs="riscv-d.o"
532	;;
533rs6000*-*-*)
534	extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
535	extra_objs="rs6000-string.o rs6000-p8swap.o rs6000-logue.o"
536	extra_objs="${extra_objs} rs6000-call.o rs6000-pcrel-opt.o"
537	target_gtfiles="$target_gtfiles \$(srcdir)/config/rs6000/rs6000-logue.cc \$(srcdir)/config/rs6000/rs6000-call.cc"
538	target_gtfiles="$target_gtfiles \$(srcdir)/config/rs6000/rs6000-pcrel-opt.cc"
539	;;
540sparc*-*-*)
541	cpu_type=sparc
542	c_target_objs="sparc-c.o"
543	cxx_target_objs="sparc-c.o"
544	d_target_objs="sparc-d.o"
545	extra_headers="visintrin.h"
546	;;
547s390*-*-*)
548	cpu_type=s390
549	d_target_objs="s390-d.o"
550	extra_options="${extra_options} fused-madd.opt"
551	extra_headers="s390intrin.h htmintrin.h htmxlintrin.h vecintrin.h"
552	;;
553# Note the 'l'; we need to be able to match e.g. "shle" or "shl".
554sh[123456789lbe]*-*-* | sh-*-*)
555	cpu_type=sh
556	extra_options="${extra_options} fused-madd.opt"
557	extra_objs="${extra_objs} sh_treg_combine.o sh-mem.o sh_optimize_sett_clrt.o"
558	;;
559v850*-*-*)
560	cpu_type=v850
561	;;
562tic6x-*-*)
563	cpu_type=c6x
564	extra_headers="c6x_intrinsics.h"
565	extra_options="${extra_options} c6x/c6x-tables.opt"
566	;;
567xtensa*-*-*)
568	extra_options="${extra_options} fused-madd.opt"
569	;;
570tilegx*-*-*)
571	cpu_type=tilegx
572	;;
573tilepro*-*-*)
574	cpu_type=tilepro
575	;;
576esac
577
578tm_file=${cpu_type}/${cpu_type}.h
579if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-protos.h
580then
581	tm_p_file=${cpu_type}/${cpu_type}-protos.h
582fi
583
584tm_d_file=
585if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-d.h
586then
587	tm_d_file="${tm_d_file} ${cpu_type}/${cpu_type}-d.h"
588fi
589
590extra_modes=
591if test -f ${srcdir}/config/${cpu_type}/${cpu_type}-modes.def
592then
593	extra_modes=${cpu_type}/${cpu_type}-modes.def
594fi
595if test -f ${srcdir}/config/${cpu_type}/${cpu_type}.opt
596then
597	extra_options="${extra_options} ${cpu_type}/${cpu_type}.opt"
598fi
599
600case ${target} in
601aarch64*-*-*)
602	tm_p_file="${tm_p_file} arm/aarch-common-protos.h"
603	case ${with_abi} in
604	"")
605		if test "x$with_multilib_list" = xilp32; then
606			tm_file="aarch64/biarchilp32.h ${tm_file}"
607		else
608			tm_file="aarch64/biarchlp64.h ${tm_file}"
609		fi
610		;;
611	ilp32)
612		tm_file="aarch64/biarchilp32.h ${tm_file}"
613		;;
614	lp64)
615		tm_file="aarch64/biarchlp64.h ${tm_file}"
616		;;
617	*)
618		echo "Unknown ABI used in --with-abi=$with_abi"
619		exit 1
620	esac
621	;;
622i[34567]86-*-*)
623	if test "x$with_abi" != x; then
624		echo "This target does not support --with-abi."
625		exit 1
626	fi
627	;;
628x86_64-*-darwin*)
629	;;
630x86_64-*-*)
631	case ${with_abi} in
632	"")
633		if test "x$with_multilib_list" = xmx32; then
634			tm_file="i386/biarchx32.h ${tm_file}"
635		else
636			tm_file="i386/biarch64.h ${tm_file}"
637		fi
638		;;
639	64 | m64)
640		tm_file="i386/biarch64.h ${tm_file}"
641		;;
642	x32 | mx32)
643		tm_file="i386/biarchx32.h ${tm_file}"
644		;;
645	*)
646		echo "Unknown ABI used in --with-abi=$with_abi"
647		exit 1
648	esac
649	;;
650arm*-*-*)
651	tm_p_file="arm/arm-flags.h ${tm_p_file} arm/aarch-common-protos.h"
652	;;
653esac
654
655# On a.out targets, we need to use collect2.
656case ${target} in
657*-*-*aout*)
658	use_collect2=yes
659	;;
660esac
661
662# Common C libraries.
663tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
664
665# 32-bit x86 processors supported by --with-arch=.  Each processor
666# MUST be separated by exactly one space.
667x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \
668athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \
669i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \
670pentium4 pentium4m pentiumpro prescott lakemont samuel-2 nehemiah \
671c7 esther"
672
673# 64-bit x86 processors supported by --with-arch=.  Each processor
674# MUST be separated by exactly one space.
675x86_64_archs="amdfam10 athlon64 athlon64-sse3 barcelona bdver1 bdver2 \
676bdver3 bdver4 znver1 znver2 znver3 znver4 btver1 btver2 k8 k8-sse3 opteron \
677opteron-sse3 nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom \
678slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
679silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
680skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
681sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
682nano-x2 eden-x4 nano-x4 x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native"
683
684# Additional x86 processors supported by --with-cpu=.  Each processor
685# MUST be separated by exactly one space.
686x86_cpus="generic intel"
687
688# Common parts for widely ported systems.
689case ${target} in
690*-*-darwin*)
691  tmake_file="t-darwin "
692  tm_file="${tm_file} darwin.h"
693  darwin_os=`echo ${target} | sed 's/.*darwin\([0-9.]*\).*$/\1/'`
694  darwin_maj=`expr "$darwin_os" : '\([0-9]*\).*'`
695  macos_min=`expr "$darwin_os" : '[0-9]*\.\([0-9]*\).*'`
696  macos_maj=10
697  if test x"${macos_min}" = x; then
698    macos_min=0
699  fi
700  def_ld64=85.2
701  # Tools hosted on earlier versions of Darwin constrained all object
702  # alignment to be 2^15 or smaller.  From Darwin11 (macOS 10.7) the
703  # alignment of non-common is allowed to be up to 2^28.  Note that the
704  #��larger alignment is permitted when targeting 10.6 from 10.7 so that
705  #��the constraint only need be applied per host (and only if the host
706  # is Darwin).
707  case ${host} in
708      *-*-darwin[4-9]* | *-*-darwin10*)
709          tm_defines="$tm_defines L2_MAX_OFILE_ALIGNMENT=15U"
710          ;;
711      *)
712          tm_defines="$tm_defines L2_MAX_OFILE_ALIGNMENT=28U"
713          ;;
714  esac
715  case ${target} in
716      # Darwin 4 to 19 correspond to macOS 10.0 to 10.15
717      *-*-darwin[4-9]* | *-*-darwin1[0-9]*)
718        macos_min=`expr $darwin_maj - 4`
719        ;;
720      *-*-darwin2*)
721        # Darwin 20 corresponds to macOS 11, Darwin 21 to macOS 12.
722        macos_maj=`expr $darwin_maj - 9`
723        def_ld64=609.0
724        ;;
725      *-*-darwin)
726        case ${cpu_type} in
727          aarch64) macos_maj=11 ;;
728          x86_64) macos_min=6 ;;
729          *)  macos_min=5 ;;
730          esac
731          case ${host} in
732            *-*-darwin*) tm_defines="$tm_defines DARWIN_USE_KERNEL_VERS" ;;
733            *)
734              # If configuring a cross-compiler then we will have set some
735              #��default above, but it is probably not what was intended.
736              echo "Warning: Using ${target} is only suitable for Darwin hosts" 1>&2
737              echo "configure with an explicit target version" 1>&2
738              ;;
739          esac
740        ;;
741      *)
742        echo "Error: configuring for an unreleased macOS version ${target}" 1>&2
743        exit 1
744        ;;
745  esac
746  tm_defines="$tm_defines DEF_MIN_OSX_VERSION=\\\"${macos_maj}.${macos_min}\\\""
747  tm_defines="$tm_defines DEF_LD64=\\\"${def_ld64}\\\""
748  tm_file="${tm_file} ${cpu_type}/darwin.h"
749  tm_p_file="${tm_p_file} darwin-protos.h"
750  target_gtfiles="$target_gtfiles \$(srcdir)/config/darwin.cc"
751  extra_options="${extra_options} rpath.opt darwin.opt"
752  c_target_objs="${c_target_objs} darwin-c.o"
753  cxx_target_objs="${cxx_target_objs} darwin-c.o"
754  d_target_objs="${d_target_objs} darwin-d.o"
755  fortran_target_objs="darwin-f.o"
756  target_has_targetcm=yes
757  target_has_targetdm=yes
758  extra_objs="${extra_objs} darwin.o"
759  extra_gcc_objs="darwin-driver.o"
760  default_use_cxa_atexit=yes
761  use_gcc_stdint=wrap
762  case ${enable_threads} in
763    "" | yes | posix) thread_file='posix' ;;
764  esac
765  ;;
766*-*-dragonfly*)
767  gas=yes
768  gnu_ld=yes
769  tmake_file="t-slibgcc"
770  case ${enable_threads} in
771    "" | yes | posix)
772      thread_file='posix'
773      ;;
774    no | single)
775      # Let these non-posix thread selections fall through if requested
776      ;;
777    *)
778      echo 'Unknown thread configuration for DragonFly BSD'
779      exit 1
780      ;;
781  esac
782  extra_options="$extra_options rpath.opt dragonfly.opt"
783  default_use_cxa_atexit=yes
784  use_gcc_stdint=wrap
785  d_target_objs="${d_target_objs} dragonfly-d.o"
786  tmake_file="${tmake_file} t-dragonfly"
787  target_has_targetdm=yes
788  ;;
789*-*-freebsd*)
790  # This is the generic ELF configuration of FreeBSD.  Later
791  # machine-specific sections may refine and add to this
792  # configuration.
793  #
794  # Due to tm_file entry ordering issues that vary between cpu
795  # architectures, we only define fbsd_tm_file to allow the
796  # machine-specific section to dictate the final order of all
797  # entries of tm_file with the minor exception that components
798  # of the tm_file set here will always be of the form:
799  #
800  # freebsd<version_number>.h [freebsd-<conf_option>.h ...] freebsd-spec.h freebsd.h
801  #
802  # The machine-specific section should not tamper with this
803  # ordering but may order all other entries of tm_file as it
804  # pleases around the provided core setting.
805  gas=yes
806  gnu_ld=yes
807  fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
808  if test "$fbsd_major" = ""; then
809    echo "Specify the major version number of the targeted FreeBSD release"
810    echo "like this: --target=amd64-unknown-freebsd10.1"
811    exit 1
812  fi
813  tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
814  tmake_file="t-slibgcc"
815  case ${enable_threads} in
816    no)
817      fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h"
818      ;;
819    "" | yes | posix)
820      thread_file='posix'
821      ;;
822    *)
823      echo 'Unknown thread configuration for FreeBSD'
824      exit 1
825      ;;
826  esac
827  fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h freebsd-stdint.h"
828  extra_options="$extra_options rpath.opt freebsd.opt"
829  case ${target} in
830    *-*-freebsd[345].*)
831      :;;
832    *)
833      default_use_cxa_atexit=yes;;
834  esac
835  use_gcc_stdint=wrap
836  d_target_objs="${d_target_objs} freebsd-d.o"
837  tmake_file="${tmake_file} t-freebsd"
838  target_has_targetdm=yes
839  ;;
840*-*-fuchsia*)
841  native_system_header_dir=/include
842  ;;
843*-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu | *-*-uclinuxfdpiceabi)
844  extra_options="$extra_options gnu-user.opt"
845  gas=yes
846  gnu_ld=yes
847  case ${enable_threads} in
848    "" | yes | posix) thread_file='posix' ;;
849  esac
850  tmake_file="t-slibgcc"
851  case $target in
852    *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-kopensolaris*-gnu)
853      :;;
854    *-*-gnu*)
855      native_system_header_dir=/include
856      ;;
857  esac
858  # Linux C libraries selection switch: glibc / uclibc / bionic.
859  # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD.
860  case $target in
861    *linux*)
862      tm_p_file="${tm_p_file} linux-protos.h"
863      tmake_file="${tmake_file} t-linux"
864      extra_objs="${extra_objs} linux.o"
865      extra_options="${extra_options} linux.opt"
866      ;;
867  esac
868  case $target in
869    *-*-*android*)
870      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC"
871      ;;
872    *-*-*uclibc* | *-*-uclinuxfdpiceabi)
873      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
874      ;;
875    *-*-*musl*)
876      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
877      ;;
878    *)
879      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
880      ;;
881  esac
882  # Assume that glibc or uClibc or Bionic are being used and so __cxa_atexit
883  # is provided.
884  default_use_cxa_atexit=yes
885  use_gcc_tgmath=no
886  use_gcc_stdint=wrap
887  # Enable compilation for Android by default for *android* targets.
888  case $target in
889    *-*-*android*)
890      tm_defines="$tm_defines ANDROID_DEFAULT=1"
891      ;;
892    *)
893      tm_defines="$tm_defines ANDROID_DEFAULT=0"
894      ;;
895  esac
896  c_target_objs="${c_target_objs} glibc-c.o"
897  cxx_target_objs="${cxx_target_objs} glibc-c.o"
898  d_target_objs="${d_target_objs} glibc-d.o"
899  tmake_file="${tmake_file} t-glibc"
900  target_has_targetcm=yes
901  target_has_targetdm=yes
902  case $target in
903    *-*-*uclibc* | *-*-uclinuxfdpiceabi)
904      ;;
905    *)
906      # Linux targets always support .init_array.
907      gcc_cv_initfini_array=yes
908      ;;
909  esac
910  ;;
911*-*-netbsd*)
912  tm_p_file="${tm_p_file} netbsd-protos.h"
913  tmake_file="t-netbsd t-slibgcc"
914  extra_objs="${extra_objs} netbsd.o"
915  d_target_objs="${d_target_objs} netbsd-d.o"
916  gas=yes
917  gnu_ld=yes
918  use_gcc_stdint=wrap
919  case ${enable_threads} in
920    "" | yes | posix) thread_file='posix' ;;
921  esac
922  case ${target} in
923    arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
924      default_gnu_indirect_function=yes
925      ;;
926  esac
927  nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
928  default_use_cxa_atexit=yes
929  target_has_targetdm=yes
930  case ${target} in
931    arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
932      default_gnu_indirect_function=yes
933      ;;
934  esac
935  ;;
936*-*-openbsd*)
937  tmake_file="t-openbsd"
938  case ${enable_threads} in
939    yes)
940      thread_file='posix'
941      ;;
942  esac
943  case ${target} in
944    *-*-openbsd4.[3-9]|*-*-openbsd[5-9]*)
945      default_use_cxa_atexit=yes
946      ;;
947  esac
948  d_target_objs="${d_target_objs} openbsd-d.o"
949  target_has_targetdm=yes
950  ;;
951*-*-phoenix*)
952  gas=yes
953  gnu_ld=yes
954  default_use_cxa_atexit=yes
955  ;;
956*-*-rtems*)
957  case ${enable_threads} in
958    "" | yes | rtems) thread_file='rtems' ;;
959    posix) thread_file='posix' ;;
960    no) ;;
961    *)
962      echo 'Unknown thread configuration for RTEMS'
963      exit 1
964      ;;
965  esac
966  tmake_file="${tmake_file} t-rtems"
967  extra_options="${extra_options} rtems.opt"
968  default_use_cxa_atexit=yes
969  use_gcc_stdint=wrap
970  ;;
971*-*-uclinux*)
972  extra_options="$extra_options gnu-user.opt"
973  use_gcc_stdint=wrap
974  case ${enable_threads} in
975    "" | yes | posix) thread_file='posix' ;;
976  esac
977  tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC SINGLE_LIBC"
978  ;;
979*-*-rdos*)
980  use_gcc_stdint=wrap
981  ;;
982*-*-solaris2*)
983  # i?86-*-solaris2* needs to insert headers between cpu default and
984  # Solaris 2 specific ones.
985  sol2_tm_file_head="dbxelf.h elfos.h ${cpu_type}/sysv4.h"
986  sol2_tm_file_tail="${cpu_type}/sol2.h sol2.h"
987  sol2_tm_file="${sol2_tm_file_head} ${sol2_tm_file_tail}"
988  case ${target} in
989    *-*-solaris2.1[1-9]*)
990      # __cxa_atexit was introduced in Solaris 11.4.
991      default_use_cxa_atexit=yes
992      ;;
993  esac
994  use_gcc_stdint=wrap
995  if test x$gnu_ld = xyes; then
996    tm_file="usegld.h ${tm_file}"
997  fi
998  if test x$gas = xyes; then
999    tm_file="usegas.h ${tm_file}"
1000  fi
1001  tm_p_file="${tm_p_file} sol2-protos.h"
1002  tmake_file="${tmake_file} t-sol2 t-slibgcc"
1003  c_target_objs="${c_target_objs} sol2-c.o"
1004  cxx_target_objs="${cxx_target_objs} sol2-c.o sol2-cxx.o"
1005  d_target_objs="${d_target_objs} sol2-d.o"
1006  extra_objs="${extra_objs} sol2.o sol2-stubs.o"
1007  extra_options="${extra_options} sol2.opt"
1008  case ${enable_threads}:${have_pthread_h}:${have_thread_h} in
1009    "":yes:* | yes:yes:* )
1010      thread_file=posix
1011      ;;
1012  esac
1013  target_has_targetdm=yes
1014  ;;
1015*-*-*vms*)
1016  extra_options="${extra_options} vms/vms.opt"
1017  xmake_file=vms/x-vms
1018  tmake_file="vms/t-vms t-slibgcc"
1019  extra_objs="vms.o"
1020  target_gtfiles="$target_gtfiles \$(srcdir)/config/vms/vms.cc"
1021  tm_p_file="${tm_p_file} vms/vms-protos.h"
1022  xm_file="vms/xm-vms.h"
1023  c_target_objs="vms-c.o"
1024  cxx_target_objs="vms-c.o"
1025  fortran_target_objs="vms-f.o"
1026  use_gcc_stdint=provide
1027  tm_file="${tm_file} vms/vms-stdint.h"
1028  if test x$gnu_ld != xyes; then
1029    # Build wrappers for native case.
1030    extra_programs="ld\$(exeext) ar\$(exeext)"
1031    tmake_file="$tmake_file vms/t-vmsnative"
1032  fi
1033  ;;
1034*-*-vxworks*)
1035  tmake_file=t-vxworks
1036  xm_defines=POSIX
1037
1038  extra_options="${extra_options} vxworks.opt"
1039  extra_objs="$extra_objs vxworks.o"
1040
1041  c_target_objs="${c_target_objs} vxworks-c.o"
1042  cxx_target_objs="${cxx_target_objs} vxworks-c.o"
1043  extra_headers="${extra_headers} ../vxworks/vxworks-predef.h"
1044  target_has_targetcm="yes"
1045
1046  # This private header exposes a consistent interface for checks on
1047  # the VxWorks version our runtime header files need to perform, based on
1048  # what the system headers adverstise:
1049
1050  extra_headers="${extra_headers} ../vxworks/_vxworks-versions.h"
1051
1052  # Starting from VxWorks 7, the system comes with a Dinkumware
1053  # environment which requires the inclusion of "yvals.h" before other
1054  # system headers.  We provide wrapped versions of a few headers to
1055  # accomodate such constraints:
1056
1057  extra_headers="${extra_headers} ../vxworks/_yvals.h"
1058  extra_headers="${extra_headers} ../vxworks/_yvals-wrapper.h"
1059
1060  extra_headers="${extra_headers} ../vxworks/math.h ../vxworks/complex.h"
1061  extra_headers="${extra_headers} ../vxworks/inttypes.h ../vxworks/setjmp.h"
1062
1063  # We provide (a tailored version of) stdint.h
1064  tm_file="${tm_file} vxworks-stdint.h"
1065  use_gcc_stdint=provide
1066
1067  case ${enable_threads} in
1068    no) ;;
1069    "" | yes | vxworks) thread_file='vxworks' ;;
1070    *) echo 'Unknown thread configuration for VxWorks'; exit 1 ;;
1071  esac
1072
1073  # A few common macro definitions conveying general characteristics
1074  # of the configuration at hand. Note that by VxWorks 7, we mean the
1075  # the SR6xx major update or beyond in vendor parlance:
1076
1077  case $target in
1078    *-*-vxworks7*)
1079      tm_defines="$tm_defines TARGET_VXWORKS7=1"
1080      ;;
1081  esac
1082  case $target in
1083    *64-*-vxworks*)
1084      tm_defines="$tm_defines TARGET_VXWORKS64=1"
1085      ;;
1086  esac
1087
1088  # Then a few build configuration controls for VxWorks 7, which
1089  # has specificities on top of which we aim to provide more complete
1090  # C++ support:
1091
1092  case $target in
1093    *-*-vxworks7*)
1094      # VxWorks 7 always has init/fini_array support and it is simpler to
1095      # just leverage this, sticking to what the system toolchain does:
1096      gcc_cv_initfini_array=yes
1097      ;;
1098  esac
1099  ;;
1100*-*-elf|arc*-*-elf*)
1101  # Assume that newlib is being used and so __cxa_atexit is provided.
1102  default_use_cxa_atexit=yes
1103  use_gcc_stdint=wrap
1104  ;;
1105esac
1106
1107case ${target} in
1108aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*)
1109	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h"
1110	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h"
1111	tmake_file="${tmake_file} aarch64/t-aarch64"
1112	case $target in
1113	aarch64-*-elf*)
1114		use_gcc_stdint=wrap
1115		;;
1116        aarch64-*-fuchsia*)
1117                tm_file="${tm_file} fuchsia.h"
1118                ;;
1119	aarch64-*-rtems*)
1120		tm_file="${tm_file} aarch64/rtems.h rtems.h"
1121		;;
1122	esac
1123	case $target in
1124	aarch64_be-*)
1125		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1126		;;
1127	esac
1128	aarch64_multilibs="${with_multilib_list}"
1129	if test "$aarch64_multilibs" = "default"; then
1130		aarch64_multilibs="lp64,ilp32"
1131	fi
1132	aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
1133	for aarch64_multilib in ${aarch64_multilibs}; do
1134		case ${aarch64_multilib} in
1135		ilp32 | lp64 )
1136			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
1137			;;
1138		*)
1139			echo "--with-multilib-list=${aarch64_multilib} not supported."
1140			exit 1
1141		esac
1142	done
1143	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
1144	;;
1145aarch64*-*-freebsd*)
1146	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file}"
1147	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-freebsd.h"
1148	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-freebsd"
1149	tm_defines="${tm_defines}  TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
1150	;;
1151aarch64*-*-netbsd*)
1152	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file}"
1153	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-netbsd.h"
1154	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-netbsd"
1155	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
1156	case $target in
1157	aarch64_be-*)
1158		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1159		;;
1160	esac
1161	;;
1162aarch64*-*-linux*)
1163	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h"
1164	tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-linux.h"
1165	tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-linux"
1166	tm_defines="${tm_defines}  TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1"
1167	case $target in
1168	aarch64_be-*)
1169		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1170		;;
1171	esac
1172	aarch64_multilibs="${with_multilib_list}"
1173	if test "$aarch64_multilibs" = "default"; then
1174		# TODO: turn on ILP32 multilib build after its support is mature.
1175		# aarch64_multilibs="lp64,ilp32"
1176		aarch64_multilibs="lp64"
1177	fi
1178	aarch64_multilibs=`echo $aarch64_multilibs | sed -e 's/,/ /g'`
1179	for aarch64_multilib in ${aarch64_multilibs}; do
1180		case ${aarch64_multilib} in
1181		ilp32 | lp64 )
1182			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${aarch64_multilib}"
1183			;;
1184		*)
1185			echo "--with-multilib-list=${aarch64_multilib} not supported."
1186			exit 1
1187		esac
1188	done
1189	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
1190	;;
1191aarch64*-wrs-vxworks*)
1192        tm_file="${tm_file} elfos.h aarch64/aarch64-elf.h"
1193        tm_file="${tm_file} vx-common.h vxworks.h aarch64/aarch64-vxworks.h"
1194        tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-vxworks"
1195        ;;
1196alpha*-*-linux*)
1197	tm_file="elfos.h ${tm_file} alpha/elf.h alpha/linux.h alpha/linux-elf.h glibc-stdint.h"
1198	tmake_file="${tmake_file} alpha/t-linux alpha/t-alpha"
1199	extra_options="${extra_options} alpha/elf.opt"
1200	;;
1201alpha*-*-netbsd*)
1202	tm_file="elfos.h ${tm_file} ${nbsd_tm_file} alpha/elf.h alpha/netbsd.h"
1203	tmake_file="${tmake_file} alpha/t-alpha"
1204	extra_options="${extra_options} netbsd.opt netbsd-elf.opt \
1205		       alpha/elf.opt"
1206	;;
1207alpha*-*-openbsd*)
1208	tm_defines="${tm_defines} OBSD_HAS_DECLARE_FUNCTION_NAME OBSD_HAS_DECLARE_FUNCTION_SIZE OBSD_HAS_DECLARE_OBJECT"
1209	tm_file="elfos.h alpha/alpha.h alpha/elf.h openbsd.h openbsd-stdint.h alpha/openbsd.h openbsd-libpthread.h"
1210	tmake_file="${tmake_file} alpha/t-alpha"
1211	extra_options="${extra_options} openbsd.opt alpha/elf.opt"
1212	# default x-alpha is only appropriate for dec-osf.
1213	;;
1214alpha*-dec-*vms*)
1215	tm_file="${tm_file} vms/vms.h alpha/vms.h"
1216	tmake_file="${tmake_file} alpha/t-vms alpha/t-alpha"
1217	;;
1218arc*-*-elf*)
1219	tm_file="arc/arc-arch.h dbxelf.h elfos.h newlib-stdint.h arc/elf.h ${tm_file}"
1220	tmake_file="arc/t-multilib arc/t-arc"
1221	extra_gcc_objs="driver-arc.o"
1222	if test "x$with_cpu" != x; then
1223		tm_defines="${tm_defines} TARGET_CPU_BUILD=PROCESSOR_$with_cpu"
1224	fi
1225	if test x${with_endian} = x; then
1226		case ${target} in
1227		arc*be-*-* | arc*eb-*-*)	with_endian=big ;;
1228		*)				with_endian=little ;;
1229		esac
1230	fi
1231	case ${with_endian} in
1232	big|little)		;;
1233	*)	echo "with_endian=${with_endian} not supported."; exit 1 ;;
1234	esac
1235	case ${with_endian} in
1236	big*)	tm_file="arc/big.h ${tm_file}"
1237	esac
1238	;;
1239arc*-*-linux*)
1240	tm_file="arc/arc-arch.h dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arc/linux.h ${tm_file}"
1241	tmake_file="${tmake_file} arc/t-multilib-linux arc/t-arc"
1242	extra_gcc_objs="driver-arc.o"
1243	if test "x$with_cpu" != x; then
1244		tm_defines="${tm_defines} TARGET_CPU_BUILD=PROCESSOR_$with_cpu"
1245	fi
1246	if test x${with_endian} = x; then
1247		case ${target} in
1248		arc*be-*-* | arc*eb-*-*)	with_endian=big ;;
1249		*)				with_endian=little ;;
1250		esac
1251	fi
1252	case ${with_endian} in
1253	big|little)		;;
1254	*)	echo "with_endian=${with_endian} not supported."; exit 1 ;;
1255	esac
1256	case ${with_endian} in
1257	big*)	tm_file="arc/big.h ${tm_file}"
1258	esac
1259	# Force .init_array support.  The configure script cannot always
1260	# automatically detect that GAS supports it, yet we require it.
1261	gcc_cv_initfini_array=yes
1262	;;
1263arm-wrs-vxworks7*)
1264	# We only support VxWorks 7 now on ARM, post SR600.  Pre SR600
1265	# VxWorks 7 was transitory and major versions prior to 7 were based
1266	# on long deprecated ABI, not supported at all any more regardless
1267	# of VxWorks.
1268	extra_options="${extra_options} arm/vxworks.opt"
1269	tmake_file="${tmake_file} arm/t-arm arm/t-vxworks arm/t-bpabi"
1270	tm_file="elfos.h arm/elf.h arm/bpabi.h arm/aout.h ${tm_file}"
1271	tm_file="${tm_file} vx-common.h vxworks.h arm/vxworks.h"
1272	target_cpu_cname="generic-armv7-a"
1273	need_64bit_hwint=yes
1274	;;
1275arm*-*-freebsd*)                # ARM FreeBSD EABI
1276	tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h"
1277	case $target in
1278	arm*b-*-freebsd*)
1279	    tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1280	    ;;
1281	esac
1282	tmake_file="${tmake_file} arm/t-arm arm/t-bpabi"
1283	tm_file="${tm_file} arm/bpabi.h arm/freebsd.h arm/aout.h arm/arm.h"
1284	case $target in
1285	armv6*-*-freebsd*)
1286	    target_cpu_cname="arm1176jzf-s"
1287            if test $fbsd_major -ge 11; then
1288               tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
1289            fi
1290	    ;;
1291	armv7*-*-freebsd*)
1292	    target_cpu_cname="generic-armv7-a"
1293	    tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
1294	    ;;
1295	*)
1296	    target_cpu_cname="arm9"
1297	    ;;
1298	esac
1299	with_tls=${with_tls:-gnu}
1300	;;
1301arm*-*-netbsdelf*)
1302	tmake_file="${tmake_file} arm/t-arm"
1303	tm_file="dbxelf.h elfos.h ${nbsd_tm_file} arm/elf.h"
1304	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
1305	case ${target} in
1306	arm*eb-*) tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" ;;
1307	esac
1308	case ${target} in
1309	arm*-*-netbsdelf-*eabi*)
1310	    tm_file="${tm_file} arm/netbsd-elf.h arm/bpabi.h arm/netbsd-eabi.h"
1311	    # GCC 7 vs NetBSD/eabi -> avoid arm unwinder
1312	    #tmake_file="$tmake_file arm/t-bpabi"
1313	    tmake_file="$tmake_file arm/t-netbsdeabi"
1314	    # The EABI requires the use of __cxa_atexit.
1315	    default_use_cxa_atexit=yes
1316	    ;;
1317	*)
1318	    tm_file="$tm_file arm/netbsd-elf.h arm/bpabi.h"
1319	    #tmake_file="$tmake_file arm/t-bpabi arm/t-netbsdeabi"
1320	    tmake_file="$tmake_file arm/t-netbsd"
1321	    ;;
1322	esac
1323	tm_file="${tm_file} arm/aout.h arm/arm.h"
1324	case ${target} in
1325	arm*-*-netbsdelf-*eabihf*)
1326	    tm_defines="${tm_defines} TARGET_DEFAULT_FLOAT_ABI=ARM_FLOAT_ABI_HARD"
1327	    ;;
1328	esac
1329	case ${target} in
1330	armv4*) with_cpu=${with_cpu:-strongarm};;
1331	armv6*) with_cpu=${with_cpu:-arm1176jzf-s};;
1332	armv7*) with_cpu=${with_cpu:-cortex-a8};;
1333	arm*eabihf*) with_cpu=${with_cpu:-arm10e};;
1334	arm*) with_cpu=${with_cpu:-arm9e};;
1335	esac
1336	target_cpu_cname="$with_cpu"
1337	;;
1338arm*-*-linux-* | arm*-*-uclinuxfdpiceabi)
1339	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
1340	extra_options="${extra_options} linux-android.opt"
1341	case $target in
1342	arm*b-*-linux*)
1343	    tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1344	    ;;
1345	esac
1346	tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
1347	tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h arm/arm.h"
1348	case $target in
1349	arm*-*-uclinuxfdpiceabi)
1350	    tm_file="$tm_file arm/uclinuxfdpiceabi.h"
1351	    ;;
1352	esac
1353	# Generation of floating-point instructions requires at least ARMv5te.
1354	if [ "$with_float" = "hard" -o "$with_float" = "softfp" ] ; then
1355	    target_cpu_cname="arm10e"
1356	else
1357	    target_cpu_cname="arm10tdmi"
1358	fi
1359	# Define multilib configuration for arm-linux-androideabi.
1360	case ${target} in
1361	*-androideabi)
1362	    tmake_file="$tmake_file arm/t-linux-androideabi"
1363	    ;;
1364	esac
1365	# The EABI requires the use of __cxa_atexit.
1366	default_use_cxa_atexit=yes
1367	with_tls=${with_tls:-gnu}
1368	;;
1369arm*-*-uclinux*eabi*)		# ARM ucLinux
1370	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/linux-gas.h arm/uclinux-elf.h glibc-stdint.h"
1371	tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi"
1372	tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h arm/aout.h arm/arm.h"
1373	target_cpu_cname="arm7tdmi"
1374	# The EABI requires the use of __cxa_atexit.
1375	default_use_cxa_atexit=yes
1376	;;
1377arm*-*-phoenix*)
1378	tm_file="elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
1379	tm_file="${tm_file} newlib-stdint.h phoenix.h"
1380	tm_file="${tm_file} arm/aout.h arm/arm.h"
1381	tmake_file="${tmake_file} arm/t-arm arm/t-bpabi arm/t-phoenix"
1382	target_cpu_cname="arm7tdmi"
1383	;;
1384arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems* | arm*-*-fuchsia*)
1385	case ${target} in
1386	arm*eb-*-eabi*)
1387	  tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
1388	esac
1389	default_use_cxa_atexit=yes
1390	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/bpabi.h"
1391	tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf"
1392	target_cpu_cname="arm7tdmi"
1393	case ${target} in
1394	arm*-*-eabi*)
1395	  tm_file="$tm_file newlib-stdint.h"
1396	  tmake_file="${tmake_file} arm/t-bpabi"
1397	  use_gcc_stdint=wrap
1398	  ;;
1399	arm*-*-fuchsia*)
1400	  tm_file="${tm_file} fuchsia.h arm/fuchsia-elf.h glibc-stdint.h"
1401	  tmake_file="${tmake_file} arm/t-bpabi arm/t-fuchsia"
1402	  target_cpu_cname="generic-armv7-a"
1403	  ;;
1404	arm*-*-rtems*)
1405	  tm_file="${tm_file} arm/rtems.h rtems.h newlib-stdint.h"
1406	  tmake_file="${tmake_file} arm/t-bpabi arm/t-rtems"
1407	  ;;
1408	arm*-*-symbianelf*)
1409	  tm_file="${tm_file} arm/symbian.h"
1410	  # We do not include t-bpabi for Symbian OS because the system
1411	  # provides its own implementation of the BPABI functions.
1412	  tmake_file="${tmake_file} arm/t-symbian"
1413	  target_cpu_cname="arm10tdmi"
1414	  ;;
1415	esac
1416	tm_file="${tm_file} arm/aout.h arm/arm.h"
1417	;;
1418avr-*-*)
1419	tm_file="elfos.h avr/elf.h avr/avr-arch.h avr/avr.h avr/specs.h dbxelf.h avr/avr-stdint.h"
1420	if test x${with_avrlibc} != xno; then
1421	    tm_file="${tm_file} ${cpu_type}/avrlibc.h"
1422	    tm_defines="${tm_defines} WITH_AVRLIBC"
1423	fi
1424	# Work out avr_double_comparison which is 2 or 3 and is used in
1425	# target hook FLOAT_LIB_COMPARE_RETURNS_BOOL to determine whether
1426	# DFmode comparisons return 3-state or 2-state results.
1427	case y${with_double_comparison} in
1428	    y | ytristate)
1429		avr_double_comparison=3
1430		;;
1431	    ybool | ylibf7)
1432		avr_double_comparison=2
1433		;;
1434	    *)
1435		echo "Error: --with-double-comparison= can only be used with: 'tristate', 'bool', 'libf7'" 1>&2
1436		exit 1
1437		;;
1438	esac
1439	case "y${with_libf7}" in
1440	    yno)
1441		# avr_double_comparison as set above.
1442		;;
1443	    ylibgcc)
1444		avr_double_comparison=2
1445		tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
1446		;;
1447	    y | yyes | ymath-symbols)
1448		avr_double_comparison=2
1449		tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
1450		tm_defines="${tm_defines} WITH_LIBF7_MATH"
1451		tm_defines="${tm_defines} WITH_LIBF7_MATH_SYMBOLS"
1452		;;
1453	    ymath)
1454		avr_double_comparison=2
1455		tm_defines="${tm_defines} WITH_LIBF7_LIBGCC"
1456		tm_defines="${tm_defines} WITH_LIBF7_MATH"
1457		;;
1458	    *)
1459		echo "Error: --with-libf7=${with_libf7} but can only be used with: 'libgcc', 'math', 'math-symbols', 'yes', 'no'" 1>&2
1460		exit 1
1461		;;
1462	esac
1463	tm_defines="${tm_defines} WITH_DOUBLE_COMPARISON=${avr_double_comparison}"
1464	case y${with_double} in
1465	    y32)
1466		avr_double=32
1467		tm_defines="${tm_defines} HAVE_DOUBLE32"
1468		;;
1469	    y64)
1470		avr_double=64
1471		tm_defines="${tm_defines} HAVE_DOUBLE64"
1472		;;
1473	    y64,32)
1474		avr_double=64
1475		avr_double_multilib=1
1476		tm_defines="${tm_defines} HAVE_DOUBLE32"
1477		tm_defines="${tm_defines} HAVE_DOUBLE64"
1478		tm_defines="${tm_defines} HAVE_DOUBLE_MULTILIB"
1479		;;
1480	    y | y32,64)
1481		avr_double=32
1482		avr_double_multilib=1
1483		tm_defines="${tm_defines} HAVE_DOUBLE32"
1484		tm_defines="${tm_defines} HAVE_DOUBLE64"
1485		tm_defines="${tm_defines} HAVE_DOUBLE_MULTILIB"
1486		;;
1487	    *)
1488		echo "Error: --with-double= can only be used with: '32', '32,64', '64,32', '64'" 1>&2
1489		exit 1
1490		;;
1491	esac
1492	case y${with_long_double} in
1493	    y32)
1494		avr_long_double=32
1495		tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
1496		;;
1497	    y64)
1498		avr_long_double=64
1499		tm_defines="${tm_defines} HAVE_LONG_DOUBLE64"
1500		;;
1501	    y | y64,32)
1502		avr_long_double=64
1503		avr_long_double_multilib=1
1504		tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
1505		tm_defines="${tm_defines} HAVE_LONG_DOUBLE64"
1506		tm_defines="${tm_defines} HAVE_LONG_DOUBLE_MULTILIB"
1507		;;
1508	    y32,64)
1509		avr_long_double=32
1510		avr_long_double_multilib=1
1511		tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
1512		tm_defines="${tm_defines} HAVE_LONG_DOUBLE64"
1513		tm_defines="${tm_defines} HAVE_LONG_DOUBLE_MULTILIB"
1514		;;
1515	    ydouble)
1516		avr_long_double=${avr_double}
1517		tm_defines="${tm_defines} HAVE_LONG_DOUBLE_IS_DOUBLE"
1518		if test y${avr_double_multilib} = y1; then
1519		    tm_defines="${tm_defines} HAVE_LONG_DOUBLE32"
1520		    tm_defines="${tm_defines} HAVE_LONG_DOUBLE64"
1521		else
1522		    tm_defines="${tm_defines} HAVE_LONG_DOUBLE${avr_long_double}"
1523		fi
1524		;;
1525	    *)
1526		echo "Error: --with-long_double= can only be used with: '32', '32,64', '64,32', '64', 'double'" 1>&2
1527		exit 1
1528		;;
1529	esac
1530	if test ${avr_long_double}x${avr_long_double_multilib}y${avr_double_multilib}z = 32xy1z; then
1531	    if test y${with_long_double} != ydouble; then
1532		echo "Error: --with-double=${with_double} requests a multilib for double, but long double is always 32 bits wide due to --with-long-double=${with_long_double}" 1>&2
1533		exit 1
1534	    fi
1535	fi
1536	if test ${avr_double}x${avr_long_double_multilib}y${avr_double_multilib}z = 64x1yz; then
1537	    echo "Error: --with-long-double=${with_long_double} requests a multilib for long double, but double is always 64 bits wide due to --with-double=64" 1>&2
1538	    exit 1
1539	fi
1540	if test y${avr_double}${avr_long_double} = y6432; then
1541	    echo "Error: double default of 64 bits from --with-double=${with_double} conflicts with default of 32 bits for long double from --with-long-double=${with_long_double}" 1>&2
1542	    exit 1
1543	fi
1544	tm_defines="${tm_defines} WITH_DOUBLE${avr_double}"
1545	tm_defines="${tm_defines} WITH_LONG_DOUBLE${avr_long_double}"
1546	tmake_file="${tmake_file} avr/t-avr avr/t-multilib"
1547	use_gcc_stdint=wrap
1548	extra_gcc_objs="driver-avr.o avr-devices.o"
1549	extra_objs="avr-devices.o avr-log.o"
1550	;;
1551bfin*-elf*)
1552	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h"
1553	tmake_file=bfin/t-bfin-elf
1554	use_collect2=no
1555	;;
1556bfin*-uclinux*)
1557	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/uclinux.h"
1558	tmake_file=bfin/t-bfin-uclinux
1559	use_collect2=no
1560	;;
1561bfin*-linux-uclibc*)
1562	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
1563	tmake_file="${tmake_file} bfin/t-bfin-linux"
1564	use_collect2=no
1565	;;
1566bfin*-rtems*)
1567	tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h bfin/rtems.h rtems.h newlib-stdint.h"
1568	tmake_file="${tmake_file} bfin/t-rtems"
1569	;;
1570bfin*-*)
1571	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h bfin/elf.h"
1572	use_collect2=no
1573	use_gcc_stdint=wrap
1574	;;
1575bpf-*-*)
1576        tm_file="elfos.h ${tm_file}"
1577        tmake_file="${tmake_file} bpf/t-bpf"
1578        use_collect2=no
1579        extra_headers="bpf-helpers.h"
1580        use_gcc_stdint=provide
1581        extra_objs="coreout.o"
1582        target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/coreout.cc"
1583        ;;
1584cr16-*-elf)
1585        tm_file="elfos.h ${tm_file} newlib-stdint.h"
1586        tmake_file="${tmake_file} cr16/t-cr16 "
1587        use_collect2=no
1588        ;;
1589cris-*-elf | cris-*-none)
1590	tm_file="elfos.h newlib-stdint.h ${tm_file}"
1591	tmake_file="cris/t-cris cris/t-elfmulti"
1592	gas=yes
1593	extra_options="${extra_options} cris/elf.opt"
1594	use_gcc_stdint=wrap
1595	;;
1596csky-*-*)
1597	if test x${with_endian} != x; then
1598	    case ${with_endian} in
1599		big|little)		;;
1600		*)
1601		    echo "with_endian=${with_endian} not supported."
1602		    exit 1
1603		    ;;
1604	    esac
1605	fi
1606	if test x${with_float} != x; then
1607	    case ${with_float} in
1608		soft | hard) ;;
1609		*) echo
1610		    "Unknown floating point type used in --with-float=$with_float"
1611		    exit 1
1612		    ;;
1613	    esac
1614	fi
1615	tm_file="csky/csky.h"
1616	md_file="csky/csky.md"
1617	out_file="csky/csky.cc"
1618	tm_p_file="${tm_p_file} csky/csky-protos.h"
1619	extra_options="${extra_options} csky/csky_tables.opt"
1620
1621	if test x${enable_tpf_debug} = xyes; then
1622	    tm_defines="${tm_defines} ENABLE_TPF_DEBUG"
1623	fi
1624
1625	case ${target} in
1626	    csky-*-elf*)
1627		tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} csky/csky-elf.h"
1628		tmake_file="csky/t-csky csky/t-csky-elf"
1629		default_use_cxa_atexit=no
1630		use_gcc_stdint=wrap
1631		;;
1632	    csky-*-linux*)
1633		tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} csky/csky-linux-elf.h"
1634		tmake_file="${tmake_file} csky/t-csky csky/t-csky-linux"
1635
1636		case ${target} in
1637		    csky-*-linux-gnu*)
1638			tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
1639			# Force .init_array support.  The configure script cannot always
1640			# automatically detect that GAS supports it, yet we require it.
1641			gcc_cv_initfini_array=yes
1642			;;
1643		    csky-*-linux-uclibc*)
1644			tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
1645			default_use_cxa_atexit=no
1646			;;
1647		    *)
1648			echo "Unknown target $target"
1649			exit 1
1650			;;
1651		esac
1652		;;
1653	    *)
1654		echo "Unknown target $target"
1655		exit 1
1656		;;
1657	esac
1658	;;
1659epiphany-*-elf | epiphany-*-rtems*)
1660	tm_file="dbxelf.h elfos.h ${tm_file}"
1661	tmake_file="${tmake_file} epiphany/t-epiphany"
1662	case ${target} in
1663	epiphany-*-rtems*)
1664	  tm_file="${tm_file} epiphany/rtems.h rtems.h newlib-stdint.h"
1665	  ;;
1666	*)
1667	  tm_file="${tm_file} newlib-stdint.h"
1668	  ;;
1669	esac
1670	extra_options="${extra_options} fused-madd.opt"
1671	extra_objs="${extra_objs} mode-switch-use.o resolve-sw-modes.o"
1672	tm_defines="${tm_defines} EPIPHANY_STACK_OFFSET=${with_stack_offset:-8}"
1673	extra_headers="epiphany_intrinsics.h"
1674	;;
1675fr30-*-elf)
1676	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
1677	;;
1678frv-*-elf)
1679	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
1680	tmake_file=frv/t-frv
1681	;;
1682frv-*-*linux*)
1683	tm_file="dbxelf.h elfos.h ${tm_file} \
1684	         gnu-user.h linux.h glibc-stdint.h frv/linux.h"
1685	tmake_file="${tmake_file} frv/t-frv frv/t-linux"
1686	;;
1687ft32-*-elf)
1688	gas=yes
1689	gnu_ld=yes
1690	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
1691	tmake_file="${tmake_file} ft32/t-ft32"
1692	;;
1693amdgcn-*-amdhsa)
1694	tm_file="elfos.h gcn/gcn-hsa.h gcn/gcn.h newlib-stdint.h"
1695	tmake_file="gcn/t-gcn-hsa"
1696	native_system_header_dir=/include
1697	extra_modes=gcn/gcn-modes.def
1698	extra_objs="${extra_objs} gcn-tree.o"
1699	extra_gcc_objs="driver-gcn.o"
1700	case "$host" in
1701	x86_64*-*-linux-gnu )
1702		if test "$ac_cv_search_dlopen" != no; then
1703			extra_programs="${extra_programs} gcn-run\$(exeext)"
1704		fi
1705		;;
1706	esac
1707	if test x$enable_as_accelerator = xyes; then
1708		extra_programs="${extra_programs} mkoffload\$(exeext)"
1709		tm_file="${tm_file} gcn/offload.h"
1710	fi
1711	# Force .init_array support.
1712	gcc_cv_initfini_array=yes
1713	thread_file=gcn
1714	;;
1715moxie-*-elf)
1716	gas=yes
1717	gnu_ld=yes
1718	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
1719	tmake_file="${tmake_file} moxie/t-moxie"
1720	;;
1721moxie-*-uclinux*)
1722	gas=yes
1723	gnu_ld=yes
1724	tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h moxie/uclinux.h"
1725	tmake_file="${tmake_file} moxie/t-moxie"
1726	;;
1727moxie-*-rtems*)
1728	tmake_file="${tmake_file} moxie/t-moxie"
1729	tm_file="moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h newlib-stdint.h"
1730	;;
1731moxie-*-moxiebox*)
1732	gas=yes
1733	gnu_ld=yes
1734	tm_file="${tm_file} dbxelf.h elfos.h moxie/moxiebox.h newlib-stdint.h"
1735	tmake_file="${tmake_file} moxie/t-moxiebox"
1736	;;
1737h8300-*-elf*)
1738	tmake_file="h8300/t-h8300"
1739	tm_file="h8300/h8300.h elfos.h newlib-stdint.h h8300/elf.h"
1740	;;
1741h8300-*-linux*)
1742	tmake_file="${tmake_file} h8300/t-h8300 h8300/t-linux"
1743	tm_file="h8300/h8300.h elfos.h gnu-user.h linux.h glibc-stdint.h h8300/linux.h"
1744	;;
1745hppa*64*-*-linux*)
1746	target_cpu_default="MASK_PA_11|MASK_PA_20"
1747	tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h gnu-user.h linux.h \
1748		 glibc-stdint.h pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h \
1749		 pa/pa64-linux.h"
1750	tmake_file="${tmake_file} pa/t-pa pa/t-linux"
1751	d_target_objs="${d_target_objs} pa-d.o"
1752	gas=yes gnu_ld=yes
1753	;;
1754hppa*-*-linux*)
1755	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS|MASK_CALLER_COPIES"
1756	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h pa/pa-linux.h \
1757		 pa/pa32-regs.h pa/pa32-linux.h"
1758	tmake_file="${tmake_file} pa/t-pa pa/t-linux"
1759	d_target_objs="${d_target_objs} pa-d.o"
1760	;;
1761hppa*-*-openbsd*)
1762	target_cpu_default="MASK_PA_11"
1763	tm_file="${tm_file} dbxelf.h elfos.h openbsd.h openbsd-stdint.h openbsd-libpthread.h \
1764		 pa/pa-openbsd.h pa/pa32-regs.h pa/pa32-openbsd.h"
1765	extra_options="${extra_options} openbsd.opt"
1766	tmake_file="pa/t-pa"
1767	d_target_objs="${d_target_objs} pa-d.o"
1768	gas=yes
1769	gnu_ld=yes
1770	;;
1771hppa*-*-netbsd*)
1772	target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS"
1773	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} \
1774		 pa/pa-netbsd.h pa/pa32-regs.h pa/pa32-netbsd.h"
1775	tmake_file="${tmake_file}"
1776	tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
1777	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
1778	;;
1779hppa[12]*-*-hpux10*)
1780	case ${target} in
1781	hppa1.1-*-* | hppa2*-*-*)
1782		target_cpu_default="MASK_PA_11"
1783		;;
1784	esac
1785	tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \
1786		 pa/pa-hpux.h pa/pa-hpux10.h"
1787	extra_options="${extra_options} pa/pa-hpux.opt pa/pa-hpux10.opt"
1788	case ${target} in
1789	*-*-hpux10.[1-9]*)
1790		tm_file="${tm_file} pa/pa-hpux1010.h"
1791		extra_options="${extra_options} pa/pa-hpux1010.opt"
1792		;;
1793	esac
1794	use_gcc_stdint=provide
1795	tm_file="${tm_file} hpux-stdint.h"
1796	tmake_file="pa/t-pa t-slibgcc"
1797	d_target_objs="${d_target_objs} pa-d.o"
1798	case ${enable_threads} in
1799	  "")
1800	    if test x$have_pthread_h = xyes ; then
1801	      tmake_file="${tmake_file} pa/t-dce-thr"
1802	    fi
1803	    ;;
1804	  yes | dce)
1805	    tmake_file="${tmake_file} pa/t-dce-thr"
1806	    ;;
1807	esac
1808	use_collect2=yes
1809	gas=yes
1810	if test "x$with_dwarf2" != x; then
1811		echo "Warning: dwarf2 debug format is not supported for this target, --with-dwarf2 ignored" 1>&2
1812		dwarf2=no
1813	fi
1814	;;
1815hppa*64*-*-hpux11*)
1816	target_cpu_default="MASK_PA_11|MASK_PA_20"
1817	if test x$gnu_ld = xyes
1818	then
1819		target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
1820	fi
1821	tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h \
1822		 pa/pa64-regs.h pa/pa-hpux.h pa/pa-hpux1010.h \
1823		 pa/pa-hpux11.h"
1824	case ${target} in
1825	*-*-hpux11.[12]*)
1826		tm_file="${tm_file} pa/pa-hpux1111.h pa/pa-64.h pa/pa64-hpux.h"
1827		extra_options="${extra_options} pa/pa-hpux1111.opt"
1828		;;
1829	*-*-hpux11.[3-9]*)
1830		tm_file="${tm_file} pa/pa-hpux1131.h pa/pa-64.h pa/pa64-hpux.h"
1831		extra_options="${extra_options} pa/pa-hpux1131.opt"
1832		;;
1833	*)
1834		tm_file="${tm_file} pa/pa-64.h pa/pa64-hpux.h"
1835		;;
1836	esac
1837	extra_options="${extra_options} pa/pa-hpux.opt \
1838		       pa/pa-hpux1010.opt pa/pa64-hpux.opt hpux11.opt"
1839	tmake_file="pa/t-pa t-slibgcc"
1840	d_target_objs="${d_target_objs} pa-d.o"
1841	case x${enable_threads} in
1842	x | xyes | xposix )
1843		thread_file=posix
1844		;;
1845	esac
1846	gas=yes
1847	case ${target} in
1848	  *-*-hpux11.[01]*)
1849		use_gcc_stdint=provide
1850		tm_file="${tm_file} hpux-stdint.h"
1851		;;
1852	  *-*-hpux11.[23]*)
1853		use_gcc_stdint=wrap
1854		tm_file="${tm_file} hpux-stdint.h"
1855		;;
1856	esac
1857	;;
1858hppa[12]*-*-hpux11*)
1859	case ${target} in
1860	hppa1.1-*-* | hppa2*-*-*)
1861		target_cpu_default="MASK_PA_11"
1862		;;
1863	esac
1864	tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \
1865		 pa/pa-hpux.h pa/pa-hpux1010.h pa/pa-hpux11.h"
1866	extra_options="${extra_options} pa/pa-hpux.opt pa/pa-hpux1010.opt \
1867		       hpux11.opt"
1868	case ${target} in
1869	*-*-hpux11.[12]*)
1870		tm_file="${tm_file} pa/pa-hpux1111.h"
1871		extra_options="${extra_options} pa/pa-hpux1111.opt"
1872		;;
1873	*-*-hpux11.[3-9]*)
1874		tm_file="${tm_file} pa/pa-hpux1131.h"
1875		extra_options="${extra_options} pa/pa-hpux1131.opt"
1876		;;
1877	esac
1878	tmake_file="pa/t-pa t-slibgcc"
1879	d_target_objs="${d_target_objs} pa-d.o"
1880	case x${enable_threads} in
1881	x | xyes | xposix )
1882		thread_file=posix
1883		;;
1884	esac
1885	use_collect2=yes
1886	gas=yes
1887	case ${target} in
1888	  *-*-hpux11.[01]*)
1889		use_gcc_stdint=provide
1890		tm_file="${tm_file} hpux-stdint.h"
1891		;;
1892	  *-*-hpux11.[23]*)
1893		use_gcc_stdint=wrap
1894		tm_file="${tm_file} hpux-stdint.h"
1895		;;
1896	esac
1897	if test "x$with_dwarf2" != x; then
1898		echo "Warning: dwarf2 debug format is not supported for this target, --with-dwarf2 ignored" 1>&2
1899		dwarf2=no
1900	fi
1901	;;
1902i[34567]86-*-darwin1[89]* | i[34567]86-*-darwin2*)
1903	echo "Error: 32bit target is not supported after Darwin17" 1>&2
1904	;;
1905i[34567]86-*-darwin*)
1906	need_64bit_isa=yes
1907	# Baseline choice for a machine that allows m64 support.
1908	with_cpu=${with_cpu:-core2}
1909	tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch t-slibgcc"
1910	tm_file="${cpu_type}/darwin32-biarch.h ${tm_file} "
1911	;;
1912x86_64-*-darwin1[89]* | x86_64-*-darwin2*)
1913	# Only 64b from now
1914	tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=(OPTION_MASK_ISA_64BIT|OPTION_MASK_ABI_64)"
1915	tm_defines="${tm_defines} TARGET_BI_ARCH=0"
1916	with_cpu=${with_cpu:-core2}
1917	tmake_file="${tmake_file} t-slibgcc"
1918	;;
1919x86_64-*-darwin*)
1920	with_cpu=${with_cpu:-core2}
1921	tmake_file="${tmake_file} ${cpu_type}/t-darwin64-biarch t-slibgcc"
1922	tm_file="${cpu_type}/darwin64-biarch.h ${tm_file} "
1923	;;
1924i[34567]86-*-elfiamcu)
1925	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/iamcu.h"
1926	;;
1927i[34567]86-*-elf*)
1928	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
1929	;;
1930x86_64-*-elf*)
1931	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
1932	;;
1933x86_64-*-rtems*)
1934	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h rtems.h"
1935	;;
1936i[34567]86-*-rdos*)
1937    tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/rdos.h"
1938    ;;
1939x86_64-*-rdos*)
1940    tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rdos.h i386/rdos64.h"
1941    tmake_file="i386/t-i386elf t-svr4"
1942    ;;
1943i[34567]86-*-dragonfly*)
1944	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
1945	tmake_file="${tmake_file} i386/t-crtstuff"
1946	;;
1947x86_64-*-dragonfly*)
1948	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h"
1949	tmake_file="${tmake_file} i386/t-crtstuff"
1950	;;
1951i[34567]86-*-freebsd*)
1952	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
1953	;;
1954x86_64-*-freebsd*)
1955	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
1956	;;
1957i[34567]86-*-netbsdelf*)
1958	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/netbsd-elf.h"
1959	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
1960	;;
1961x86_64-*-netbsd*)
1962	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${nbsd_tm_file} i386/x86-64.h i386/netbsd64.h"
1963	tmake_file="${tmake_file} i386/t-netbsd64"
1964	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
1965	;;
1966i[34567]86-*-openbsd*)
1967	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
1968	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h"
1969	extra_options="${extra_options} openbsd.opt"
1970	gas=yes
1971	gnu_ld=yes
1972	;;
1973x86_64-*-openbsd*)
1974	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
1975	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h"
1976	extra_options="${extra_options} openbsd.opt"
1977	gas=yes
1978	gnu_ld=yes
1979	;;
1980i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
1981			# Intel 80386's running GNU/*
1982			# with ELF format using glibc 2
1983	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h"
1984	case ${target} in
1985	i[34567]86-*-linux*)
1986		tm_file="${tm_file} linux.h linux-android.h"
1987		extra_options="${extra_options} linux-android.opt"
1988		if test x$enable_targets = xall; then
1989			tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
1990			tm_defines="${tm_defines} TARGET_BI_ARCH=1"
1991			tmake_file="${tmake_file} i386/t-linux64"
1992			x86_multilibs="${with_multilib_list}"
1993			if test "$x86_multilibs" = "default"; then
1994				x86_multilibs="m64,m32"
1995			fi
1996			x86_multilibs=`echo $x86_multilibs | sed -e 's/,/ /g'`
1997			for x86_multilib in ${x86_multilibs}; do
1998				case ${x86_multilib} in
1999				m32 | m64 | mx32)
2000					TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${x86_multilib}"
2001					;;
2002				*)
2003					echo "--with-multilib-list=${x86_with_multilib} not supported."
2004					exit 1
2005				esac
2006			done
2007			TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
2008			need_64bit_isa=yes
2009			if test x$with_cpu = x; then
2010				if test x$with_cpu_64 = x; then
2011					with_cpu_64=generic
2012				fi
2013			else
2014				case " $x86_cpus $x86_archs $x86_64_archs " in
2015				*" $with_cpu "*)
2016					;;
2017				*)
2018					echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
2019					echo "$x86_cpus $x86_archs $x86_64_archs " 1>&2
2020					exit 1
2021					;;
2022				esac
2023			fi
2024		else
2025			tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h i386/linux-common.h i386/linux.h"
2026		fi
2027		;;
2028	i[34567]86-*-kfreebsd*-gnu)
2029		tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kfreebsd-gnu.h i386/kfreebsd-gnu.h"
2030		;;
2031	i[34567]86-*-kopensolaris*-gnu)
2032		tm_file="${tm_file} i386/gnu-user-common.h i386/gnu-user.h kopensolaris-gnu.h i386/kopensolaris-gnu.h"
2033		;;
2034	i[34567]86-*-gnu*)
2035		tm_file="$tm_file i386/gnu-user-common.h i386/gnu-user.h gnu.h i386/gnu.h"
2036		;;
2037	esac
2038	;;
2039x86_64-*-linux* | x86_64-*-kfreebsd*-gnu)
2040	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h gnu-user.h glibc-stdint.h \
2041		 i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h"
2042	case ${target} in
2043	x86_64-*-linux*)
2044		tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
2045		extra_options="${extra_options} linux-android.opt"
2046	  	;;
2047	x86_64-*-kfreebsd*-gnu)
2048		tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"
2049		;;
2050	esac
2051	tmake_file="${tmake_file} i386/t-linux64"
2052	x86_multilibs="${with_multilib_list}"
2053	if test "$x86_multilibs" = "default"; then
2054		case ${with_abi} in
2055		x32 | mx32)
2056			x86_multilibs="mx32"
2057			;;
2058		*)
2059			x86_multilibs="m64,m32"
2060			;;
2061		esac
2062	fi
2063	x86_multilibs=`echo $x86_multilibs | sed -e 's/,/ /g'`
2064	for x86_multilib in ${x86_multilibs}; do
2065		case ${x86_multilib} in
2066		m32 | m64 | mx32)
2067			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${x86_multilib}"
2068			;;
2069		*)
2070			echo "--with-multilib-list=${x86_with_multilib} not supported."
2071			exit 1
2072		esac
2073	done
2074	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
2075	;;
2076i[34567]86-pc-msdosdjgpp*)
2077	xm_file=i386/xm-djgpp.h
2078	tm_file="dbxcoff.h ${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/djgpp.h i386/djgpp-stdint.h"
2079	native_system_header_dir=/dev/env/DJDIR/include
2080	extra_options="${extra_options} i386/djgpp.opt"
2081	gnu_ld=yes
2082	gas=yes
2083	use_gcc_stdint=wrap
2084	;;
2085i[34567]86-*-lynxos*)
2086	xm_defines=POSIX
2087	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/lynx.h lynx.h"
2088	tmake_file="${tmake_file} t-lynx"
2089	extra_options="${extra_options} lynx.opt"
2090	thread_file=lynx
2091	gnu_ld=yes
2092	gas=yes
2093	;;
2094i[34567]86-*-nto-qnx*)
2095	tm_file="${tm_file} i386/att.h dbxelf.h tm-dwarf2.h elfos.h i386/unix.h i386/nto.h"
2096	extra_options="${extra_options} i386/nto.opt"
2097	gnu_ld=yes
2098	gas=yes
2099	;;
2100i[34567]86-*-rtems*)
2101	tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/rtemself.h rtems.h newlib-stdint.h"
2102	tmake_file="${tmake_file} i386/t-rtems"
2103	;;
2104i[34567]86-*-solaris2* | x86_64-*-solaris2*)
2105	# Set default arch_32 to pentium4, tune_32 to generic like the other
2106	# i386 targets, although config.guess defaults to i386-pc-solaris2*.
2107	with_arch_32=${with_arch_32:-pentium4}
2108	with_tune_32=${with_tune_32:-generic}
2109	tm_file="${tm_file} i386/unix.h i386/att.h ${sol2_tm_file_head} i386/x86-64.h ${sol2_tm_file_tail}"
2110	tm_defines="${tm_defines} TARGET_BI_ARCH=1"
2111	tmake_file="$tmake_file i386/t-sol2"
2112	need_64bit_isa=yes
2113	if test x$with_cpu = x; then
2114		if test x$with_cpu_64 = x; then
2115			with_cpu_64=generic
2116		fi
2117	else
2118		case " $x86_cpus $x86_archs $x86_64_archs " in
2119		*" $with_cpu "*)
2120			;;
2121		*)
2122			echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
2123			echo "$x86_cpus $x86_archs $x86_64_archs" 1>&2
2124			exit 1
2125			;;
2126		esac
2127	fi
2128	;;
2129i[4567]86-wrs-vxworks*|x86_64-wrs-vxworks7*)
2130	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h"
2131	case ${target} in
2132	  x86_64-*)
2133	    need_64bit_isa=yes
2134	    tm_file="${tm_file} i386/x86-64.h"
2135	    ;;
2136	esac
2137	tm_file="${tm_file} vx-common.h"
2138	case ${target} in
2139	  *-vxworksae*)
2140	    tm_file="${tm_file} vxworksae.h i386/vxworks.h i386/vxworksae.h"
2141	    tmake_file="${tmake_file} i386/t-vxworks i386/t-vxworksae"
2142	    ;;
2143	  *)
2144	    tm_file="${tm_file} vxworks.h i386/vxworks.h"
2145	    tmake_file="${tmake_file} i386/t-vxworks"
2146	    ;;
2147	esac
2148	;;
2149i[34567]86-*-cygwin*)
2150	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-stdint.h"
2151	xm_file=i386/xm-cygwin.h
2152	tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
2153	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
2154	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
2155	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
2156	c_target_objs="${c_target_objs} msformat-c.o"
2157	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
2158	d_target_objs="${d_target_objs} winnt-d.o"
2159	target_has_targetdm="yes"
2160	if test x$enable_threads = xyes; then
2161		thread_file='posix'
2162	fi
2163	default_use_cxa_atexit=yes
2164	use_gcc_stdint=wrap
2165	;;
2166x86_64-*-cygwin*)
2167	need_64bit_isa=yes
2168	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h i386/cygwin.h i386/cygwin-w64.h i386/cygwin-stdint.h"
2169	xm_file=i386/xm-cygwin.h
2170	tmake_file="${tmake_file} i386/t-cygming t-slibgcc i386/t-cygwin-w64"
2171	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
2172	extra_options="${extra_options} i386/cygming.opt i386/cygwin.opt"
2173	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
2174	c_target_objs="${c_target_objs} msformat-c.o"
2175	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
2176	d_target_objs="${d_target_objs} winnt-d.o"
2177	target_has_targetdm="yes"
2178	if test x$enable_threads = xyes; then
2179		thread_file='posix'
2180	fi
2181	default_use_cxa_atexit=yes
2182	use_gcc_stdint=wrap
2183	tm_defines="${tm_defines} TARGET_CYGWIN64=1"
2184	;;
2185i[34567]86-*-mingw* | x86_64-*-mingw*)
2186	tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h"
2187	xm_file=i386/xm-mingw32.h
2188	c_target_objs="${c_target_objs} winnt-c.o"
2189	cxx_target_objs="${cxx_target_objs} winnt-c.o"
2190	d_target_objs="${d_target_objs} winnt-d.o"
2191	target_has_targetcm="yes"
2192	target_has_targetdm="yes"
2193	case ${target} in
2194		x86_64-*-* | *-w64-*)
2195			need_64bit_isa=yes
2196			;;
2197		*)
2198			;;
2199	esac
2200	if test x$enable_threads = xposix ; then
2201		tm_file="${tm_file} i386/mingw-pthread.h"
2202	fi
2203	tm_file="${tm_file} i386/mingw32.h"
2204	# This makes the logic if mingw's or the w64 feature set has to be used
2205	case ${target} in
2206		*-w64-*)
2207			user_headers_inc_next_post="${user_headers_inc_next_post} float.h"
2208			user_headers_inc_next_pre="${user_headers_inc_next_pre} stddef.h stdarg.h"
2209			tm_file="${tm_file} i386/mingw-w64.h"
2210			if test x$enable_targets = xall; then
2211				tm_defines="${tm_defines} TARGET_BI_ARCH=1"
2212				if test x$with_cpu = x; then
2213					if test x$with_cpu_64 = x; then
2214						with_cpu_64=generic
2215					fi
2216				else
2217					case " $x86_cpus $x86_archs $x86_64_archs " in
2218					*" $with_cpu "*)
2219						;;
2220					*)
2221						echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
2222						echo "$x86_cpus $x86_archs $x86_64_archs" 1>&2
2223						exit 1
2224						;;
2225					esac
2226				fi
2227			fi
2228			;;
2229		*)
2230			;;
2231	esac
2232	tm_file="${tm_file} i386/mingw-stdint.h"
2233	tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
2234        case ${target} in
2235               x86_64-w64-*)
2236               		tmake_file="${tmake_file} i386/t-mingw-w64"
2237			;;
2238	       i[34567]86-w64-*)
2239			tmake_file="${tmake_file} i386/t-mingw-w32"
2240			;;
2241	esac
2242        native_system_header_dir=/mingw/include
2243	target_gtfiles="$target_gtfiles \$(srcdir)/config/i386/winnt.cc"
2244	extra_options="${extra_options} i386/cygming.opt i386/mingw.opt"
2245	case ${target} in
2246		*-w64-*)
2247			extra_options="${extra_options} i386/mingw-w64.opt"
2248			;;
2249		*)
2250			;;
2251	esac
2252	extra_objs="${extra_objs} winnt.o winnt-stubs.o"
2253	c_target_objs="${c_target_objs} msformat-c.o"
2254	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
2255	gas=yes
2256	gnu_ld=yes
2257	default_use_cxa_atexit=yes
2258	use_gcc_stdint=wrap
2259	case ${enable_threads} in
2260	  "" | yes | win32)
2261	    thread_file='win32'
2262	    ;;
2263	  posix)
2264	    thread_file='posix'
2265	    ;;
2266	esac
2267	case ${target} in
2268 		*mingw32crt*)
2269 			tm_file="${tm_file} i386/crtdll.h"
2270 			;;
2271		*mingw32msv* | *mingw*)
2272			;;
2273	esac
2274	;;
2275x86_64-*-fuchsia*)
2276	tmake_file="${tmake_file} i386/t-x86_64-elf"
2277	tm_file="${tm_file} i386/unix.h i386/att.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h fuchsia.h"
2278	;;
2279ia64*-*-elf*)
2280	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h ia64/sysv4.h ia64/elf.h"
2281	tmake_file="ia64/t-ia64"
2282	target_cpu_default="0"
2283	if test x$gas = xyes
2284	then
2285		target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
2286	fi
2287	if test x$gnu_ld = xyes
2288	then
2289		target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
2290	fi
2291	;;
2292ia64*-*-netbsd*)
2293	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} ia64/sysv4.h ia64/netbsd.h"
2294	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
2295	tmake_file="${tmake_file} ia64/t-ia64"
2296	if test x$with_system_libunwind != xyes ; then
2297		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
2298	fi
2299	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
2300	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2301	;;
2302ia64*-*-freebsd*)
2303	tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
2304	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
2305	tmake_file="${tmake_file} ia64/t-ia64"
2306	;;
2307ia64*-*-linux*)
2308	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ia64/sysv4.h ia64/linux.h"
2309	tmake_file="${tmake_file} ia64/t-ia64 ia64/t-linux t-libunwind"
2310	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
2311	;;
2312ia64*-*-hpux*)
2313	tm_file="${tm_file} dbxelf.h elfos.h ia64/sysv4.h ia64/hpux.h"
2314	tmake_file="ia64/t-ia64 ia64/t-hpux t-slibgcc"
2315	target_cpu_default="MASK_GNU_AS"
2316	case x$enable_threads in
2317	x | xyes | xposix )
2318		thread_file=posix
2319		;;
2320	esac
2321	use_collect2=no
2322	c_target_objs="ia64-c.o"
2323	cxx_target_objs="ia64-c.o"
2324	extra_options="${extra_options} ia64/ilp32.opt hpux11.opt"
2325	use_gcc_stdint=wrap
2326	tm_file="${tm_file} hpux-stdint.h"
2327	case ${target} in
2328	*-*-hpux11.3*)
2329		tm_file="${tm_file} ia64/hpux-unix2003.h"
2330		;;
2331	esac
2332	;;
2333ia64-hp-*vms*)
2334	tm_file="${tm_file} elfos.h ia64/sysv4.h vms/vms.h ia64/vms.h"
2335	tmake_file="${tmake_file} ia64/t-ia64"
2336	target_cpu_default="0"
2337	if test x$gas = xyes
2338	then
2339		target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
2340	fi
2341	extra_options="${extra_options} ia64/vms.opt"
2342	;;
2343iq2000*-*-elf*)
2344        tm_file="elfos.h newlib-stdint.h iq2000/iq2000.h"
2345        out_file=iq2000/iq2000.cc
2346        md_file=iq2000/iq2000.md
2347        ;;
2348lm32-*-elf*)
2349        tm_file="dbxelf.h elfos.h ${tm_file} newlib-stdint.h"
2350	tmake_file="${tmake_file} lm32/t-lm32"
2351        ;;
2352lm32-*-rtems*)
2353	tm_file="dbxelf.h elfos.h ${tm_file} lm32/rtems.h rtems.h newlib-stdint.h"
2354	tmake_file="${tmake_file} lm32/t-lm32"
2355	tmake_file="${tmake_file} lm32/t-rtems"
2356         ;;
2357lm32-*-uclinux*)
2358        tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h lm32/uclinux-elf.h"
2359	tmake_file="${tmake_file} lm32/t-lm32"
2360        ;;
2361m32r-*-elf*)
2362	tm_file="elfos.h newlib-stdint.h ${tm_file}"
2363 	;;
2364m32rle-*-elf*)
2365	tm_file="elfos.h newlib-stdint.h m32r/little.h ${tm_file}"
2366	;;
2367m68k-*-elf* | fido-*-elf*)
2368	case ${target} in
2369	fido-*-elf*)
2370		# Check that $with_cpu makes sense.
2371		case $with_cpu in
2372		"" | "fidoa")
2373			;;
2374		*)
2375			echo "Cannot accept --with-cpu=$with_cpu"
2376			exit 1
2377			;;
2378		esac
2379		with_cpu=fidoa
2380		;;
2381	*)
2382		default_m68k_cpu=68020
2383		default_cf_cpu=5206
2384		;;
2385	esac
2386	tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h newlib-stdint.h m68k/m68kemb.h m68k/m68020-elf.h"
2387	tm_defines="${tm_defines} MOTOROLA=1"
2388	tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-m68kelf"
2389	# Add multilibs for targets other than fido.
2390	case ${target} in
2391	fido-*-elf*)
2392		;;
2393	*)
2394		tmake_file="$tmake_file m68k/t-mlibs"
2395		;;
2396	esac
2397	;;
2398m68010-*-netbsdelf* | m68k-*-netbsdelf* | m5407-*-netbsdelf*)
2399	default_m68k_cpu=68020
2400	case ${target} in
2401	m5407*)
2402		with_arch=${with_arch:-cf}
2403		target_cpu_default="mcf5475"
2404#	        target="`echo ${target} | sed 's/m68kcf/m68k/'`"
2405		;;
2406	m68010*)
2407		target_cpu_default="m68010"
2408		tmake_file="${tmake_file} m68k/t-m68kelf m68k/t-m68010-netbsd"
2409		default_m68k_cpu=68010
2410		tmake_file="${tmake_file} m68k/t-floatlib"
2411		;;
2412	*)
2413		with_arch=${with_arch:-m68k}
2414		tmake_file="${tmake_file} m68k/t-floatlib"
2415		;;
2416	esac
2417	default_cf_cpu=5475
2418	tm_file="${tm_file} dbxelf.h elfos.h ${nbsd_tm_file} m68k/netbsd-elf.h"
2419	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2420	tm_defines="${tm_defines} MOTOROLA=1 CHAR_FAST8=1 SHORT_FAST16=1"
2421	;;
2422m68k-*-uclinux*)		# Motorola m68k/ColdFire running uClinux
2423				# with uClibc, using the new GNU/Linux-style
2424				# ABI.
2425	default_m68k_cpu=68020
2426	default_cf_cpu=5206
2427	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h"
2428	extra_options="${extra_options} m68k/uclinux.opt"
2429 	tm_defines="${tm_defines} MOTOROLA=1"
2430	tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs"
2431	;;
2432m68k-*-linux*)			# Motorola m68k's running GNU/Linux
2433				# with ELF format using glibc 2
2434				# aka the GNU/Linux C library 6.
2435	default_m68k_cpu=68020
2436	default_cf_cpu=5475
2437	with_arch=${with_arch:-m68k}
2438	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h m68k/linux.h ./sysroot-suffix.h"
2439	extra_options="${extra_options} m68k/ieee.opt"
2440	tm_defines="${tm_defines} MOTOROLA=1"
2441	tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux m68k/t-mlibs"
2442	;;
2443m68k-*-rtems*)
2444	default_m68k_cpu=68020
2445	default_cf_cpu=5206
2446	tmake_file="${tmake_file} m68k/t-floatlib m68k/t-m68kbare m68k/t-crtstuff m68k/t-rtems m68k/t-mlibs"
2447	tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h newlib-stdint.h"
2448	tm_defines="${tm_defines} MOTOROLA=1"
2449	;;
2450mcore-*-elf)
2451	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} mcore/mcore-elf.h"
2452	tmake_file=mcore/t-mcore
2453	inhibit_libc=true
2454	;;
2455microblaze*-linux*)
2456	case $target in
2457		microblazeel-*)
2458			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
2459			;;
2460		microblaze-*)
2461			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
2462			;;
2463	esac
2464	tm_file="${tm_file} dbxelf.h gnu-user.h linux.h microblaze/linux.h"
2465	tm_file="${tm_file} glibc-stdint.h"
2466	c_target_objs="${c_target_objs} microblaze-c.o"
2467	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
2468	tmake_file="${tmake_file} microblaze/t-microblaze"
2469	tmake_file="${tmake_file} microblaze/t-microblaze-linux"
2470	;;
2471microblaze*-*-rtems*)
2472	case $target in
2473		microblazeel-*)
2474			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
2475			;;
2476		microblaze-*)
2477			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
2478			;;
2479	esac
2480	tm_file="${tm_file} dbxelf.h"
2481	tm_file="${tm_file} microblaze/rtems.h rtems.h newlib-stdint.h"
2482	c_target_objs="${c_target_objs} microblaze-c.o"
2483	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
2484	tmake_file="${tmake_file} microblaze/t-microblaze"
2485	tmake_file="${tmake_file} microblaze/t-rtems"
2486        ;;
2487microblaze*-*-elf)
2488	case $target in
2489		microblazeel-*)
2490			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=0"
2491			;;
2492		microblaze-*)
2493			tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=4321"
2494			;;
2495	esac
2496	tm_file="${tm_file} dbxelf.h newlib-stdint.h"
2497	c_target_objs="${c_target_objs} microblaze-c.o"
2498	cxx_target_objs="${cxx_target_objs} microblaze-c.o"
2499	tmake_file="${tmake_file} microblaze/t-microblaze"
2500        ;;
2501riscv*-*-linux*)
2502	tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h"
2503	case "x${enable_multilib}" in
2504	xno) ;;
2505	xyes) tmake_file="${tmake_file} riscv/t-linux-multilib" ;;
2506	*) echo "Unknown value for enable_multilib"; exit 1
2507	esac
2508	tmake_file="${tmake_file} riscv/t-riscv riscv/t-linux"
2509	gnu_ld=yes
2510	gas=yes
2511	case $target in
2512	riscv32be-*|riscv64be-*)
2513		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
2514		;;
2515	esac
2516	# Force .init_array support.  The configure script cannot always
2517	# automatically detect that GAS supports it, yet we require it.
2518	gcc_cv_initfini_array=yes
2519	;;
2520riscv*-*-elf* | riscv*-*-rtems*)
2521	tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
2522	case ${target} in
2523	*-*-rtems*)
2524	  tm_file="${tm_file} riscv/rtems.h rtems.h"
2525	  tmake_file="${tmake_file} riscv/t-rtems"
2526	  ;;
2527	*)
2528	  if test "x${with_multilib_generator}" == xdefault; then
2529		  case "x${enable_multilib}" in
2530		  xno) ;;
2531		  xyes) tmake_file="${tmake_file} riscv/t-elf-multilib" ;;
2532		  *) echo "Unknown value for enable_multilib"; exit 1
2533		  esac
2534	  fi
2535	esac
2536	tmake_file="${tmake_file} riscv/t-riscv"
2537	gnu_ld=yes
2538	gas=yes
2539	case $target in
2540	riscv32be-*|riscv64be-*)
2541		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
2542		;;
2543	esac
2544	# Force .init_array support.  The configure script cannot always
2545	# automatically detect that GAS supports it, yet we require it.
2546	gcc_cv_initfini_array=yes
2547	;;
2548riscv*-*-freebsd*)
2549	tm_file="${tm_file} elfos.h ${fbsd_tm_file} riscv/freebsd.h"
2550	tmake_file="${tmake_file} riscv/t-riscv"
2551	gnu_ld=yes
2552	gas=yes
2553	case $target in
2554	riscv32be-*|riscv64be-*)
2555		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
2556		;;
2557	esac
2558	# Force .init_array support.  The configure script cannot always
2559	# automatically detect that GAS supports it, yet we require it.
2560	gcc_cv_initfini_array=yes
2561	;;
2562riscv*-*-netbsd*)			# NetBSD RISC-V
2563	tm_file="elfos.h ${tm_file} ${nbsd_tm_file} riscv/netbsd.h"
2564	tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
2565	case ${target} in
2566	  riscv32*) tm_defines="${tm_defines} TARGET_64BIT_DEFAULT=0" ;;
2567	  *) tmake_file="${tmake_file} riscv/t-netbsd64" ;;
2568	esac
2569	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2570	tmake_file="${tmake_file} riscv/t-riscv"
2571	gnu_ld=yes
2572	gas=yes
2573	gcc_cv_initfini_array=yes
2574	;;
2575
2576loongarch*-*-linux*)
2577	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}"
2578	tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h"
2579	extra_options="${extra_options} linux-android.opt"
2580	tmake_file="${tmake_file} loongarch/t-linux"
2581	gnu_ld=yes
2582	gas=yes
2583
2584	# Force .init_array support.  The configure script cannot always
2585	# automatically detect that GAS supports it, yet we require it.
2586	gcc_cv_initfini_array=yes
2587	;;
2588
2589mipsn64*-*-netbsd*)			# NetBSD/mips64, either endian.
2590	target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI"
2591	tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h"
2592	tmake_file="${tmake_file} mips/t-netbsd64"
2593	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_64"
2594	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2595	;;
2596mips64*-*-netbsd*)			# NetBSD/mips64, either endian.
2597	target_cpu_default="MASK_ABICALLS|MASK_FLOAT64|MASK_SOFT_FLOAT_ABI"
2598	tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h mips/netbsd64.h"
2599	tmake_file="${tmake_file} mips/t-netbsd64"
2600	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_N32"
2601	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2602	;;
2603
2604mips*-*-netbsd*)			# NetBSD/mips, either endian.
2605	target_cpu_default="MASK_ABICALLS"
2606	tm_file="elfos.h ${tm_file} mips/elf.h ${nbsd_tm_file} mips/netbsd.h"
2607	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
2608	;;
2609mips*-img-linux*)
2610	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h mips/mti-linux.h"
2611	extra_options="${extra_options} linux-android.opt"
2612	tmake_file="${tmake_file} mips/t-img-linux"
2613	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6 MIPS_ABI_DEFAULT=ABI_32"
2614	with_arch_32="mips32r6"
2615	with_arch_64="mips64r6"
2616	gnu_ld=yes
2617	gas=yes
2618	;;
2619mips*-mti-linux*)
2620	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h mips/mti-linux.h"
2621	extra_options="${extra_options} linux-android.opt"
2622	tmake_file="${tmake_file} mips/t-mti-linux"
2623	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2 MIPS_ABI_DEFAULT=ABI_32"
2624	with_arch_32="mips32r2"
2625	with_arch_64="mips64r2"
2626	gnu_ld=yes
2627	gas=yes
2628	;;
2629mips*-*-linux*)				# Linux MIPS, either endian.
2630	tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h"
2631	extra_options="${extra_options} linux-android.opt"
2632	case ${target} in
2633		mipsisa32r6*)
2634			default_mips_arch=mips32r6
2635			;;
2636		mipsisa32r2*)
2637			default_mips_arch=mips32r2
2638			;;
2639		mipsisa32*)
2640			default_mips_arch=mips32
2641			;;
2642		mips64el-st-linux-gnu)
2643			default_mips_abi=n32
2644			tm_file="${tm_file} mips/st.h"
2645			tmake_file="${tmake_file} mips/t-st"
2646			enable_mips_multilibs="yes"
2647			;;
2648		mips64octeon*-*-linux*)
2649			default_mips_abi=n32
2650			tm_defines="${tm_defines} MIPS_CPU_STRING_DEFAULT=\\\"octeon\\\""
2651			target_cpu_default=MASK_SOFT_FLOAT_ABI
2652			enable_mips_multilibs="yes"
2653			;;
2654		mipsisa64r6*-*-linux-gnuabi64)
2655			default_mips_abi=64
2656			default_mips_arch=mips64r6
2657			enable_mips_multilibs="yes"
2658			;;
2659		mipsisa64r6*-*-linux*)
2660			default_mips_abi=n32
2661			default_mips_arch=mips64r6
2662			enable_mips_multilibs="yes"
2663			;;
2664		mipsisa64r2*-*-linux-gnuabi64)
2665			default_mips_abi=64
2666			default_mips_arch=mips64r2
2667			enable_mips_multilibs="yes"
2668			;;
2669		mipsisa64r2*-*-linux*)
2670			default_mips_abi=n32
2671			default_mips_arch=mips64r2
2672			enable_mips_multilibs="yes"
2673			;;
2674		mips64*-*-linux-gnuabi64 | mipsisa64*-*-linux-gnuabi64)
2675			default_mips_abi=64
2676			enable_mips_multilibs="yes"
2677			;;
2678		mips64*-*-linux* | mipsisa64*-*-linux*)
2679			default_mips_abi=n32
2680			enable_mips_multilibs="yes"
2681			;;
2682	esac
2683	if test x$enable_targets = xall; then
2684		enable_mips_multilibs="yes"
2685	fi
2686	if test x$enable_mips_multilibs = xyes; then
2687		tmake_file="${tmake_file} mips/t-linux64"
2688	fi
2689	;;
2690mips*-mti-elf*)
2691	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h mips/sde.h mips/mti-elf.h"
2692	tmake_file="mips/t-mti-elf"
2693	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2 MIPS_ABI_DEFAULT=ABI_32"
2694	with_arch_32="mips32r2"
2695	with_arch_64="mips64r2"
2696	;;
2697mips*-img-elf*)
2698	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h mips/sde.h mips/mti-elf.h"
2699	tmake_file="mips/t-img-elf"
2700	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6 MIPS_ABI_DEFAULT=ABI_32"
2701	with_arch_32="mips32r6"
2702	with_arch_64="mips64r6"
2703	;;
2704mips*-sde-elf*)
2705	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h mips/sde.h"
2706	tmake_file="mips/t-sde"
2707	extra_options="${extra_options} mips/sde.opt"
2708	case "${with_newlib}" in
2709	  yes)
2710	    # newlib / libgloss.
2711	    ;;
2712	  *)
2713	    # MIPS toolkit libraries.
2714	    tm_file="$tm_file mips/sdemtk.h"
2715	    tmake_file="$tmake_file mips/t-sdemtk"
2716	    case ${enable_threads} in
2717	      "" | yes | mipssde)
2718		thread_file='mipssde'
2719		;;
2720	    esac
2721	    ;;
2722	esac
2723	case ${target} in
2724	  mipsisa32r6*)
2725	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6 MIPS_ABI_DEFAULT=ABI_32"
2726	    ;;
2727	  mipsisa32r2*)
2728	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2 MIPS_ABI_DEFAULT=ABI_32"
2729	    ;;
2730	  mipsisa32*)
2731	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32 MIPS_ABI_DEFAULT=ABI_32"
2732	    ;;
2733	  mipsisa64r6*)
2734	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R6 MIPS_ABI_DEFAULT=ABI_N32"
2735	    ;;
2736	  mipsisa64r2*)
2737	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R2 MIPS_ABI_DEFAULT=ABI_N32"
2738	    ;;
2739	  mipsisa64*)
2740	    tm_defines="MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64 MIPS_ABI_DEFAULT=ABI_N32"
2741	    ;;
2742	esac
2743	;;
2744mipsisa32-*-elf* | mipsisa32el-*-elf* | \
2745mipsisa32r2-*-elf* | mipsisa32r2el-*-elf* | \
2746mipsisa32r6-*-elf* | mipsisa32r6el-*-elf* | \
2747mipsisa64-*-elf* | mipsisa64el-*-elf* | \
2748mipsisa64r2-*-elf* | mipsisa64r2el-*-elf* | \
2749mipsisa64r6-*-elf* | mipsisa64r6el-*-elf*)
2750	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
2751	tmake_file="mips/t-isa3264"
2752	case ${target} in
2753	  mipsisa32r6*)
2754	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6"
2755	    ;;
2756	  mipsisa32r2*)
2757	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2"
2758	    ;;
2759	  mipsisa32*)
2760	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32"
2761	    ;;
2762	  mipsisa64r6*)
2763	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R6"
2764	    ;;
2765	  mipsisa64r2*)
2766	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R2"
2767	    ;;
2768	  mipsisa64*)
2769	    tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64"
2770	    ;;
2771	esac
2772	case ${target} in
2773	  mipsisa32*-*-elfoabi*)
2774	    tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_32"
2775	    tm_file="${tm_file} mips/elfoabi.h"
2776	    ;;
2777	  mipsisa64*-*-elfoabi*)
2778	    tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_O64"
2779	    tm_file="${tm_file} mips/elfoabi.h"
2780	    ;;
2781	  *-*-elf*)
2782	    tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_EABI"
2783	    ;;
2784	esac
2785	;;
2786mipsisa64sr71k-*-elf*)
2787        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
2788        tmake_file=mips/t-sr71k
2789	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI"
2790        ;;
2791mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
2792	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
2793	tmake_file="mips/t-elf mips/t-sb1"
2794	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64"
2795	;;
2796mips-*-elf* | mipsel-*-elf* | mipsr5900-*-elf* | mipsr5900el-*-elf*)
2797	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
2798	tmake_file="mips/t-elf"
2799	;;
2800mips64r5900-*-elf* | mips64r5900el-*-elf*)
2801	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/n32-elf.h"
2802	tmake_file="mips/t-elf"
2803	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3 MIPS_ABI_DEFAULT=ABI_N32"
2804	;;
2805mips64-*-elf* | mips64el-*-elf*)
2806	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h"
2807	tmake_file="mips/t-elf"
2808	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3 MIPS_ABI_DEFAULT=ABI_O64"
2809	;;
2810mips64vr-*-elf* | mips64vrel-*-elf*)
2811        tm_file="elfos.h newlib-stdint.h ${tm_file} mips/vr.h mips/elf.h"
2812        tmake_file=mips/t-vr
2813	tm_defines="${tm_defines} MIPS_ABI_DEFAULT=ABI_EABI"
2814        ;;
2815mips64orion-*-elf* | mips64orionel-*-elf*)
2816	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elforion.h mips/elf.h"
2817	tmake_file="mips/t-elf"
2818	tm_defines="${tm_defines} MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3 MIPS_ABI_DEFAULT=ABI_O64"
2819	;;
2820mips*-*-rtems*)
2821	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/elf.h mips/rtems.h rtems.h"
2822	tmake_file="${tmake_file} mips/t-elf mips/t-rtems"
2823	;;
2824mips-wrs-vxworks)
2825	tm_file="elfos.h ${tm_file} mips/elf.h vx-common.h vxworks.h mips/vxworks.h"
2826	tmake_file="${tmake_file} mips/t-vxworks"
2827	;;
2828mipstx39-*-elf* | mipstx39el-*-elf*)
2829	tm_file="elfos.h newlib-stdint.h ${tm_file} mips/r3900.h mips/elf.h"
2830	tmake_file="mips/t-r3900"
2831	;;
2832mmix-knuth-mmixware)
2833	tm_file="${tm_file} newlib-stdint.h"
2834	use_gcc_stdint=wrap
2835	;;
2836mn10300-*-*)
2837	tm_file="elfos.h newlib-stdint.h ${tm_file}"
2838	use_collect2=no
2839	use_gcc_stdint=wrap
2840	;;
2841msp430-*-*)
2842	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
2843	c_target_objs="msp430-c.o"
2844	cxx_target_objs="msp430-c.o"
2845	tmake_file="${tmake_file} msp430/t-msp430"
2846	extra_objs="${extra_objs} msp430-devices.o"
2847	extra_gcc_objs="driver-msp430.o msp430-devices.o"
2848	# Enable .init_array unless it has been explicitly disabled.
2849	# The MSP430 EABI mandates the use of .init_array, and the Newlib CRT
2850	# code since mid-2019 expects it.
2851	if test x${disable_initfini_array} != xyes; then
2852		gcc_cv_initfini_array=yes
2853	fi
2854	case ${target} in
2855	  msp430-*-elfbare)
2856	    # __cxa_atexit increases code size, and we don't need to support
2857	    # dynamic shared objects on MSP430, so regular Newlib atexit is a
2858	    # fine replacement as it also supports registration of more than 32
2859	    # functions.
2860	    default_use_cxa_atexit=no
2861	    # This target does not match the generic *-*-elf case above which
2862	    # sets use_gcc_stdint=wrap, so explicitly set it here.
2863	    use_gcc_stdint=wrap
2864	    ;;
2865	esac
2866	;;
2867nds32*-*-*)
2868	target_cpu_default="0"
2869	tm_defines="${tm_defines}"
2870	case ${target} in
2871	  nds32le*-*-*)
2872	    ;;
2873	  nds32be-*-*)
2874	    target_cpu_default="${target_cpu_default}|MASK_BIG_ENDIAN"
2875	    tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
2876	    ;;
2877	esac
2878	case ${target} in
2879	  nds32*-*-elf*)
2880	    tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} nds32/elf.h nds32/nds32_intrinsic.h"
2881	    tmake_file="nds32/t-nds32 nds32/t-elf"
2882	    ;;
2883	  nds32*-*-linux*)
2884	    tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h nds32/linux.h nds32/nds32_intrinsic.h"
2885	    tmake_file="${tmake_file} nds32/t-nds32 nds32/t-linux"
2886	    gcc_cv_initfini_array=yes
2887	    ;;
2888	esac
2889
2890	# Handle --enable-default-relax setting.
2891	if test x${enable_default_relax} = xyes; then
2892		tm_defines="${tm_defines} TARGET_DEFAULT_RELAX=1"
2893	fi
2894	# Handle --with-ext-dsp
2895	if test x${with_ext_dsp} = xyes; then
2896		tm_defines="${tm_defines} TARGET_DEFAULT_EXT_DSP=1"
2897	fi
2898	;;
2899nios2-*-*)
2900	tm_file="elfos.h ${tm_file}"
2901        tmake_file="${tmake_file} nios2/t-nios2"
2902        case ${target} in
2903        nios2-*-linux*)
2904                tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h nios2/linux.h "
2905                ;;
2906	nios2-*-elf*)
2907		tm_file="${tm_file} newlib-stdint.h nios2/elf.h"
2908		extra_options="${extra_options} nios2/elf.opt"
2909		;;
2910	nios2-*-rtems*)
2911		tm_file="${tm_file} newlib-stdint.h nios2/rtems.h rtems.h"
2912		tmake_file="${tmake_file} t-rtems nios2/t-rtems"
2913		;;
2914        esac
2915	;;
2916nvptx-*)
2917	tm_file="${tm_file} newlib-stdint.h"
2918	use_gcc_stdint=wrap
2919	tmake_file="nvptx/t-nvptx"
2920	if test x$enable_as_accelerator = xyes; then
2921		extra_programs="${extra_programs} mkoffload\$(exeext)"
2922		tm_file="${tm_file} nvptx/offload.h"
2923	fi
2924	;;
2925or1k*-*-*)
2926	tm_file="elfos.h ${tm_file}"
2927	tmake_file="${tmake_file} or1k/t-or1k"
2928	# Force .init_array support.  The configure script cannot always
2929	# automatically detect that GAS supports it, yet we require it.
2930	gcc_cv_initfini_array=yes
2931
2932	# Handle --with-multilib-list=...
2933	or1k_multilibs="${with_multilib_list}"
2934	if test "$or1k_multilibs" = "default"; then
2935		or1k_multilibs="mcmov,msoft-mul,msoft-div"
2936	fi
2937	or1k_multilibs=`echo $or1k_multilibs | sed -e 's/,/ /g'`
2938	for or1k_multilib in ${or1k_multilibs}; do
2939		case ${or1k_multilib} in
2940		mcmov | msext | msfimm | \
2941		mror | mrori | \
2942		mhard-float | mdouble-float | munordered-float | msoft-float | \
2943		mhard-div | mhard-mul | \
2944		msoft-div | msoft-mul )
2945			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG},${or1k_multilib}"
2946			;;
2947		*)
2948			echo "--with-multilib-list=${with_multilib_list} not supported."
2949			exit 1
2950		esac
2951	done
2952	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'`
2953
2954	case ${target} in
2955	or1k*-*-linux*)
2956		tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h"
2957		tm_file="${tm_file} or1k/linux.h"
2958		;;
2959	or1k*-*-elf*)
2960		tm_file="${tm_file} newlib-stdint.h or1k/elf.h"
2961		extra_options="${extra_options} or1k/elf.opt"
2962		;;
2963	or1k*-*-rtems*)
2964		tm_file="${tm_file} newlib-stdint.h or1k/rtems.h rtems.h"
2965		tmake_file="${tmake_file} or1k/t-rtems"
2966		;;
2967	esac
2968	;;
2969pdp11-*-*)
2970	tm_file="${tm_file} newlib-stdint.h"
2971	use_gcc_stdint=wrap
2972	;;
2973# port not yet contributed
2974#powerpc-*-openbsd*)
2975#	tmake_file="${tmake_file} rs6000/t-fprules"
2976#	extra_headers=
2977#	;;
2978powerpc-*-darwin*)
2979	extra_options="${extra_options} ${cpu_type}/darwin.opt"
2980	case ${target} in
2981	  *-darwin1[0-9]* | *-darwin9*)
2982	    tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch"
2983	    tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h"
2984	    ;;
2985	  *-darwin8*)
2986	    tmake_file="${tmake_file} ${cpu_type}/t-darwin32-biarch"
2987	    tm_file="${tm_file} ${cpu_type}/darwin32-biarch.h"
2988	    ;;
2989	  *-darwin7*)
2990	    tm_file="${tm_file} ${cpu_type}/darwin7.h"
2991	    ;;
2992	  *-darwin[456]*)
2993	    # Earlier - ingle arch, with 32b only
2994	    # OS X 10.0, the first edition is Darwin4
2995	    ;;
2996	esac
2997	tmake_file="${tmake_file} t-slibgcc"
2998	;;
2999powerpc64-*-darwin*)
3000	extra_options="${extra_options} ${cpu_type}/darwin.opt"
3001	tmake_file="${tmake_file} ${cpu_type}/t-darwin64-biarch t-slibgcc"
3002	tm_file="${tm_file} ${cpu_type}/darwin64-biarch.h"
3003	;;
3004powerpc*-*-freebsd*)
3005	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${fbsd_tm_file} rs6000/sysv4.h"
3006	extra_options="${extra_options} rs6000/sysv4.opt"
3007	tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
3008	case ${target} in
3009	    powerpc*le-*-*)
3010		tm_file="${tm_file} rs6000/sysv4le.h" ;;
3011	esac
3012	case ${target} in
3013	     powerpc64*)
3014	    	tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h"
3015		tmake_file="${tmake_file} rs6000/t-freebsd64"
3016		extra_options="${extra_options} rs6000/linux64.opt"
3017		if test $fbsd_major -ge 13; then
3018		    tm_defines="${tm_defines} TARGET_FREEBSD32_SECURE_PLT=1"
3019		fi
3020		;;
3021	     *)
3022		if test $fbsd_major -ge 13; then
3023		    tm_file="rs6000/secureplt.h ${tm_file}"
3024		fi
3025	        tm_file="${tm_file} rs6000/freebsd.h"
3026		;;
3027	esac
3028	;;
3029powerpc*-*-netbsd*)
3030	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${nbsd_tm_file} freebsd-spec.h"
3031	case ${target} in
3032	    powerpc64*)
3033		tm_file="rs6000/biarch64.h ${tm_file}"
3034		tm_file="${tm_file} rs6000/sysv4.h rs6000/default64.h rs6000/netbsd64.h"
3035		tmake_file="${tmake_file} rs6000/t-netbsd64"
3036		;;
3037	    *)
3038		tm_file="${tm_file} rs6000/sysv4.h rs6000/netbsd.h"
3039		tmake_file="${tmake_file} rs6000/t-netbsd"
3040		;;
3041	esac
3042	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
3043	extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"
3044	if test x${enable_secureplt} != xno; then
3045	    tm_file="rs6000/secureplt.h ${tm_file}"
3046	fi
3047	;;
3048powerpc-*-eabisimaltivec*)
3049	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h rs6000/eabialtivec.h"
3050	extra_options="${extra_options} rs6000/sysv4.opt"
3051	tmake_file="rs6000/t-fprules rs6000/t-ppcendian rs6000/t-ppccomm"
3052	use_gcc_stdint=wrap
3053	;;
3054powerpc-*-eabisim*)
3055	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabisim.h"
3056	extra_options="${extra_options} rs6000/sysv4.opt"
3057	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3058	use_gcc_stdint=wrap
3059	;;
3060powerpc-*-elf*)
3061	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h"
3062	extra_options="${extra_options} rs6000/sysv4.opt"
3063	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3064	;;
3065powerpc-*-eabialtivec*)
3066	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/eabialtivec.h"
3067	extra_options="${extra_options} rs6000/sysv4.opt"
3068	tmake_file="rs6000/t-fprules rs6000/t-ppcendian rs6000/t-ppccomm"
3069	use_gcc_stdint=wrap
3070	;;
3071powerpc-*-eabi*)
3072	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h"
3073	extra_options="${extra_options} rs6000/sysv4.opt"
3074	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3075	use_gcc_stdint=wrap
3076	;;
3077powerpc-*-rtems*)
3078	tm_file="rs6000/biarch64.h ${tm_file} dbxelf.h elfos.h gnu-user.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/rtems.h rtems.h"
3079	extra_options="${extra_options} rs6000/sysv4.opt rs6000/linux64.opt"
3080	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
3081	;;
3082powerpc*-*-linux*)
3083	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h freebsd-spec.h rs6000/sysv4.h"
3084	extra_options="${extra_options} rs6000/sysv4.opt"
3085	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm"
3086	extra_objs="$extra_objs rs6000-linux.o"
3087	case ${target} in
3088	    powerpc*le-*-*)
3089		tm_file="${tm_file} rs6000/sysv4le.h" ;;
3090	esac
3091	case ${target}:${with_cpu} in
3092	    powerpc64*: | powerpc64*:native) cpu_is_64bit=yes ;;
3093	esac
3094	maybe_biarch=${cpu_is_64bit}
3095	case ${enable_targets} in
3096	    *powerpc64*) maybe_biarch=yes ;;
3097	    all) maybe_biarch=yes ;;
3098	esac
3099	case ${target}:${enable_targets}:${maybe_biarch} in
3100	    powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \
3101	    | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \
3102	    | powerpcle-*:*powerpc64le*:yes)
3103		if test x$cpu_is_64bit = xyes; then
3104		    tm_file="${tm_file} rs6000/default64.h"
3105		fi
3106		tm_file="rs6000/biarch64.h ${tm_file} rs6000/linux64.h glibc-stdint.h"
3107		tmake_file="$tmake_file rs6000/t-linux64"
3108		case ${target} in
3109		    powerpc*le-*-*)
3110			tmake_file="$tmake_file rs6000/t-linux64le"
3111			case ${enable_targets} in
3112			    all | *powerpc64-* | *powerpc-*)
3113				tmake_file="$tmake_file rs6000/t-linux64lebe" ;;
3114			esac ;;
3115		    *)
3116			case ${enable_targets} in
3117			    all | *powerpc64le-* | *powerpcle-*)
3118				tmake_file="$tmake_file rs6000/t-linux64bele" ;;
3119			esac ;;
3120		esac
3121		extra_options="${extra_options} rs6000/linux64.opt"
3122		;;
3123	    powerpc64*)
3124		tm_file="${tm_file} rs6000/default64.h rs6000/linux64.h glibc-stdint.h"
3125		extra_options="${extra_options} rs6000/linux64.opt"
3126		tmake_file="${tmake_file} rs6000/t-linux"
3127		;;
3128	    *)
3129		tm_file="${tm_file} rs6000/linux.h glibc-stdint.h"
3130		tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-linux"
3131		;;
3132	esac
3133	case ${target} in
3134	    powerpc*-*-linux*ppc476*)
3135		tm_file="${tm_file} rs6000/476.h"
3136		extra_options="${extra_options} rs6000/476.opt" ;;
3137	    powerpc*-*-linux*altivec*)
3138		tm_file="${tm_file} rs6000/linuxaltivec.h" ;;
3139	esac
3140	case ${target} in
3141	    *-linux*-musl*)
3142		enable_secureplt=yes ;;
3143	esac
3144	if test x${enable_secureplt} = xyes; then
3145		tm_file="rs6000/secureplt.h ${tm_file}"
3146	fi
3147	;;
3148powerpc*-wrs-vxworks7r*)
3149
3150	# Wind River 7 post SR0600 is mostly like Linux so we setup
3151	# our config in a very similar fashion and adjust to a few
3152	# specificities.
3153
3154	# The system compiler is configured with secureplt by default.
3155	tm_file="${tm_file} rs6000/secureplt.h"
3156
3157	tm_file="${tm_file} elfos.h gnu-user.h linux.h freebsd-spec.h"
3158	tm_file="${tm_file} rs6000/sysv4.h rs6000/biarch64.h rs6000/default64.h rs6000/linux64.h"
3159	tm_file="${tm_file} vx-common.h vxworks.h rs6000/vxworks.h"
3160
3161	extra_options="${extra_options} rs6000/sysv4.opt linux.opt rs6000/linux64.opt"
3162
3163	tmake_file="${tmake_file} t-linux rs6000/t-linux64 rs6000/t-fprules rs6000/t-ppccomm"
3164	tmake_file="${tmake_file} rs6000/t-vxworks"
3165
3166	tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
3167	extra_objs="$extra_objs linux.o rs6000-linux.o"
3168	;;
3169powerpc-wrs-vxworks*)
3170	tm_file="${tm_file} elfos.h gnu-user.h freebsd-spec.h rs6000/sysv4.h"
3171	tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm rs6000/t-vxworks"
3172	extra_options="${extra_options} rs6000/sysv4.opt"
3173	extra_headers="${extra_headers} ppc-asm.h"
3174	case ${target} in
3175          *-vxworksmils*)
3176            tm_file="${tm_file} vx-common.h vxworksae.h rs6000/vxworks.h rs6000/vxworksmils.h"
3177            tmake_file="${tmake_file} rs6000/t-vxworksmils"
3178            ;;
3179	  *-vxworksae*)
3180	    tm_file="${tm_file} vx-common.h vxworksae.h rs6000/vxworks.h rs6000/vxworksae.h"
3181	    tmake_file="${tmake_file} rs6000/t-vxworksae"
3182	    ;;
3183	  *-vxworks*)
3184	    tm_file="${tm_file} vx-common.h vxworks.h rs6000/vxworks.h"
3185	    ;;
3186	esac
3187	;;
3188powerpc-*-lynxos*)
3189	xm_defines=POSIX
3190	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h rs6000/sysv4.h rs6000/lynx.h lynx.h"
3191	tmake_file="t-lynx rs6000/t-lynx"
3192	extra_options="${extra_options} rs6000/sysv4.opt lynx.opt"
3193	thread_file=lynx
3194	gnu_ld=yes
3195	gas=yes
3196	;;
3197powerpcle-*-elf*)
3198	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h"
3199	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3200	extra_options="${extra_options} rs6000/sysv4.opt"
3201	;;
3202powerpcle-*-eabisim*)
3203	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/eabisim.h"
3204	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3205	extra_options="${extra_options} rs6000/sysv4.opt"
3206	use_gcc_stdint=wrap
3207	;;
3208powerpcle-*-eabi*)
3209	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h"
3210	tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm"
3211	extra_options="${extra_options} rs6000/sysv4.opt"
3212	use_gcc_stdint=wrap
3213	;;
3214pru*-*-*)
3215	tm_file="elfos.h newlib-stdint.h ${tm_file}"
3216	tmake_file="${tmake_file} pru/t-pru"
3217	extra_objs="pru-pragma.o pru-passes.o"
3218	use_gcc_stdint=wrap
3219	;;
3220rs6000-ibm-aix7.1.* | powerpc-ibm-aix7.1.*)
3221	tmake_file="rs6000/t-aix52 t-slibgcc"
3222	if test x$cpu_is_64bit = xyes; then
3223	    tm_file="${tm_file} rs6000/biarch64.h"
3224	    tmake_file="rs6000/t-aix64 t-slibgcc"
3225	fi
3226	tm_file="${tm_file} rs6000/aix.h rs6000/aix71.h rs6000/xcoff.h rs6000/aix-stdint.h"
3227	extra_options="${extra_options} rs6000/aix64.opt"
3228	use_collect2=yes
3229	thread_file='aix'
3230	use_gcc_stdint=wrap
3231	default_use_cxa_atexit=yes
3232	;;
3233rs6000-ibm-aix7.2.* | powerpc-ibm-aix7.2.*)
3234	tmake_file="rs6000/t-aix52 t-slibgcc"
3235	if test x$cpu_is_64bit = xyes; then
3236	    tm_file="${tm_file} rs6000/biarch64.h"
3237	    tmake_file="rs6000/t-aix64 t-slibgcc"
3238	fi
3239	tm_file="${tm_file} rs6000/aix.h rs6000/aix72.h rs6000/xcoff.h rs6000/aix-stdint.h"
3240	extra_options="${extra_options} rs6000/aix64.opt"
3241	use_collect2=yes
3242	thread_file='aix'
3243	use_gcc_stdint=wrap
3244	default_use_cxa_atexit=yes
3245	;;
3246rs6000-ibm-aix[789].* | powerpc-ibm-aix[789].*)
3247	tmake_file="rs6000/t-aix52 t-slibgcc"
3248	if test x$cpu_is_64bit = xyes; then
3249	    tm_file="${tm_file} rs6000/biarch64.h"
3250	    tmake_file="rs6000/t-aix64 t-slibgcc"
3251	fi
3252	tm_file="${tm_file} rs6000/aix.h rs6000/aix73.h rs6000/xcoff.h rs6000/aix-stdint.h"
3253	extra_options="${extra_options} rs6000/aix64.opt"
3254	use_collect2=yes
3255	thread_file='aix'
3256	use_gcc_stdint=wrap
3257	default_use_cxa_atexit=yes
3258	;;
3259rl78-*-elf*)
3260	tm_file="elfos.h newlib-stdint.h ${tm_file}"
3261	target_has_targetm_common=no
3262	c_target_objs="rl78-c.o"
3263	cxx_target_objs="rl78-c.o"
3264	tmake_file="${tmake_file} rl78/t-rl78"
3265	;;
3266rx-*-elf*)
3267	tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
3268	tmake_file="${tmake_file} rx/t-rx"
3269	extra_options="${extra_options} rx/elf.opt"
3270	;;
3271rx-*-linux*)
3272	tm_file="elfos.h linux.h glibc-stdint.h rx/linux.h ../../libgcc/config/rx/rx-abi.h"
3273	tmake_file="${tmake_file} rx/t-linux"
3274	;;
3275s390-*-linux*)
3276	tm_file="s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
3277	c_target_objs="${c_target_objs} s390-c.o"
3278	cxx_target_objs="${cxx_target_objs} s390-c.o"
3279	if test x$enable_targets = xall; then
3280		tmake_file="${tmake_file} s390/t-linux64"
3281	fi
3282	tmake_file="${tmake_file} s390/t-s390"
3283	;;
3284s390x-*-linux*)
3285	tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h s390/linux.h"
3286	tm_p_file="linux-protos.h s390/s390-protos.h"
3287	c_target_objs="${c_target_objs} s390-c.o"
3288	cxx_target_objs="${cxx_target_objs} s390-c.o"
3289	md_file=s390/s390.md
3290	extra_modes=s390/s390-modes.def
3291	out_file=s390/s390.cc
3292	tmake_file="${tmake_file} s390/t-linux64 s390/t-s390"
3293	;;
3294s390x-ibm-tpf*)
3295	tm_file="s390/s390x.h s390/s390.h dbxelf.h elfos.h glibc-stdint.h s390/tpf.h"
3296	tm_p_file=s390/s390-protos.h
3297	c_target_objs="${c_target_objs} s390-c.o"
3298	cxx_target_objs="${cxx_target_objs} s390-c.o"
3299	md_file=s390/s390.md
3300	extra_modes=s390/s390-modes.def
3301	out_file=s390/s390.cc
3302	thread_file='tpf'
3303	extra_options="${extra_options} s390/tpf.opt"
3304	tmake_file="${tmake_file} s390/t-s390"
3305	;;
3306sh-*-elf* | sh[12346l]*-*-elf* | \
3307  sh-*-linux* | sh[2346lbe]*-*-linux* | \
3308  sh-*-netbsdelf* | shl*-*-netbsdelf*)
3309	tmake_file="${tmake_file} sh/t-sh sh/t-elf"
3310	if test x${with_endian} = x; then
3311		case ${target} in
3312		sh[1234]*be-*-* | sh[1234]*eb-*-*) with_endian=big ;;
3313		shbe-*-* | sheb-*-*)		   with_endian=big,little ;;
3314		sh[1234]l* | sh[34]*-*-linux*)	   with_endian=little ;;
3315		shl* | sh*-*-linux* | \
3316		  sh-superh-elf)		   with_endian=little,big ;;
3317		sh[1234]*-*-*)			   with_endian=big ;;
3318		*)				   with_endian=big,little ;;
3319		esac
3320	fi
3321	# TM_ENDIAN_CONFIG is used by t-sh to determine multilibs.
3322	#  First word : the default endian.
3323	#  Second word: the secondary endian (optional).
3324	case ${with_endian} in
3325	big)		TM_ENDIAN_CONFIG=mb ;;
3326	little)		TM_ENDIAN_CONFIG=ml ;;
3327	big,little)	TM_ENDIAN_CONFIG="mb ml" ;;
3328	little,big)	TM_ENDIAN_CONFIG="ml mb" ;;
3329	*)	echo "with_endian=${with_endian} not supported."; exit 1 ;;
3330	esac
3331	case ${with_endian} in
3332	little*)	tm_file="sh/little.h ${tm_file}" ;;
3333	esac
3334	tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h"
3335	case ${target} in
3336	sh*-*-linux*)	tmake_file="${tmake_file} sh/t-linux"
3337			if test x$enable_fdpic = xyes; then
3338				tm_defines="$tm_defines FDPIC_DEFAULT=1"
3339			fi
3340			tm_file="${tm_file} gnu-user.h linux.h glibc-stdint.h sh/linux.h" ;;
3341	sh*-*-netbsd*)
3342			tm_file="${tm_file} ${nbsd_tm_file} sh/netbsd-elf.h"
3343			extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
3344
3345			;;
3346	sh*-superh-elf)	if test x$with_libgloss != xno; then
3347                                with_libgloss=yes
3348                                tm_file="${tm_file} sh/newlib.h"
3349                        fi
3350			tm_file="${tm_file} sh/embed-elf.h"
3351			tm_file="${tm_file} sh/superh.h"
3352			extra_options="${extra_options} sh/superh.opt" ;;
3353	*)		if test x$with_newlib = xyes \
3354			   && test x$with_libgloss = xyes; then
3355				tm_file="${tm_file} sh/newlib.h"
3356			fi
3357			tm_file="${tm_file} sh/embed-elf.h" ;;
3358	esac
3359	case ${target} in
3360	*-*-netbsd)
3361		;;
3362	*-*-elf*)
3363		tm_file="${tm_file} newlib-stdint.h"
3364		;;
3365	esac
3366	# sed el/eb endian suffixes away to avoid confusion with sh[23]e
3367	case `echo ${target} | sed 's/e[lb]-/-/'` in
3368	sh4a_single_only*)	sh_cpu_target=sh4a-single-only ;;
3369	sh4a_single*)		sh_cpu_target=sh4a-single ;;
3370	sh4a_nofpu*)		sh_cpu_target=sh4a-nofpu ;;
3371	sh4al)			sh_cpu_target=sh4al ;;
3372	sh4a*)			sh_cpu_target=sh4a ;;
3373	sh4_single_only*)	sh_cpu_target=sh4-single-only ;;
3374	sh4_single*)		sh_cpu_target=sh4-single ;;
3375	sh4_nofpu*)		sh_cpu_target=sh4-nofpu ;;
3376	sh4* | sh-superh-*)	sh_cpu_target=sh4 ;;
3377	sh3e*)			sh_cpu_target=sh3e ;;
3378	sh*-*-netbsd* | sh3*)	sh_cpu_target=sh3 ;;
3379	sh2a_single_only*)	sh_cpu_target=sh2a-single-only ;;
3380	sh2a_single*)		sh_cpu_target=sh2a-single ;;
3381	sh2a_nofpu*)		sh_cpu_target=sh2a-nofpu ;;
3382	sh2a*)			sh_cpu_target=sh2a ;;
3383	sh2e*)			sh_cpu_target=sh2e ;;
3384	sh2*)			sh_cpu_target=sh2 ;;
3385	*)			sh_cpu_target=sh1 ;;
3386	esac
3387	# did the user say --without-fp ?
3388	if test x$with_fp = xno; then
3389		case ${sh_cpu_target} in
3390		sh4al | sh1)	;;
3391		sh4a* )		sh_cpu_target=sh4a-nofpu ;;
3392		sh4*)		sh_cpu_target=sh4-nofpu ;;
3393		sh3*)		sh_cpu_target=sh3 ;;
3394		sh2a*)		sh_cpu_target=sh2a-nofpu ;;
3395		sh2*)		sh_cpu_target=sh2 ;;
3396		*)	echo --without-fp not available for $target: ignored
3397		esac
3398		tm_defines="$tm_defines STRICT_NOFPU=1"
3399	fi
3400	sh_cpu_default="`echo $with_cpu|sed s/^m/sh/|tr A-Z_ a-z-`"
3401	case $sh_cpu_default in
3402	  sh2a-single-only | sh2a-single | sh2a-nofpu | sh2a | \
3403	  sh4a-single-only | sh4a-single | sh4a-nofpu | sh4a | sh4al | \
3404	  sh4-single-only | sh4-single | sh4-nofpu | sh4 | sh4-300 | \
3405	  sh3e | sh3 | sh2e | sh2 | sh1) ;;
3406	"")	sh_cpu_default=${sh_cpu_target} ;;
3407	*)	echo "with_cpu=$with_cpu not supported"; exit 1 ;;
3408	esac
3409	sh_multilibs=${with_multilib_list}
3410	if test "$sh_multilibs" = "default" ; then
3411		case ${target} in
3412		sh[1234]*)	sh_multilibs=${sh_cpu_target} ;;
3413		sh-superh-*)	sh_multilibs=m4,m4-single,m4-single-only,m4-nofpu ;;
3414		sh*-*-linux*)	sh_multilibs=m1,m2,m2a,m3e,m4 ;;
3415		sh*-*-netbsd*)	sh_multilibs=m3,m3e,m4 ;;
3416		*) sh_multilibs=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single ;;
3417		esac
3418		if test x$with_fp = xno; then
3419			sh_multilibs="`echo $sh_multilibs|sed -e s/m4/sh4-nofpu/ -e s/,m4-[^,]*//g -e s/,m[23]e// -e s/m2a,m2a-single/m2a-nofpu/ -e s/m5-..m....,//g`"
3420		fi
3421	fi
3422	target_cpu_default=SELECT_`echo ${sh_cpu_default}|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
3423	tm_defines=${tm_defines}' SH_MULTILIB_CPU_DEFAULT=\"'`echo $sh_cpu_default|sed s/sh/m/`'\"'
3424	tm_defines="$tm_defines SUPPORT_`echo $sh_cpu_default | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1"
3425	sh_multilibs=`echo $sh_multilibs | sed -e 's/,/ /g' -e 's/^[Ss][Hh]/m/' -e 's/ [Ss][Hh]/ m/g' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz-`
3426	for sh_multilib in ${sh_multilibs}; do
3427		case ${sh_multilib} in
3428		m1 | m2 | m2e | m3 | m3e | \
3429		m4 | m4-single | m4-single-only | m4-nofpu | m4-300 |\
3430		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al | \
3431		m2a | m2a-single | m2a-single-only | m2a-nofpu)
3432			# TM_MULTILIB_CONFIG is used by t-sh for the non-endian multilib definition
3433			# It is passed to MULTIILIB_OPTIONS verbatim.
3434			TM_MULTILIB_CONFIG="${TM_MULTILIB_CONFIG}/${sh_multilib}"
3435			tm_defines="$tm_defines SUPPORT_`echo $sh_multilib | sed 's/^m/sh/' | tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`=1"
3436			;;
3437		\!*)	# TM_MULTILIB_EXCEPTIONS_CONFIG is used by t-sh
3438			# It is passed the MULTILIB_EXCEPTIONS verbatim.
3439			TM_MULTILIB_EXCEPTIONS_CONFIG="${TM_MULTILIB_EXCEPTIONS_CONFIG} `echo $sh_multilib | sed 's/^!//'`" ;;
3440		*)
3441			echo "with_multilib_list=${sh_multilib} not supported."
3442			exit 1
3443			;;
3444		esac
3445	done
3446	TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's:^/::'`
3447	if test x${enable_incomplete_targets} = xyes ; then
3448		tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1"
3449	fi
3450	tm_file="$tm_file ./sysroot-suffix.h"
3451	tmake_file="$tmake_file t-sysroot-suffix"
3452	;;
3453sh-*-rtems*)
3454	tmake_file="${tmake_file} sh/t-sh sh/t-rtems"
3455	tm_file="${tm_file} dbxelf.h elfos.h sh/elf.h sh/embed-elf.h sh/rtemself.h rtems.h newlib-stdint.h"
3456	;;
3457sh-wrs-vxworks)
3458	tmake_file="$tmake_file sh/t-sh sh/t-vxworks"
3459	tm_file="${tm_file} elfos.h sh/elf.h sh/embed-elf.h vx-common.h vxworks.h sh/vxworks.h"
3460	;;
3461sparc-*-elf*)
3462	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp-elf.h"
3463	case ${target} in
3464	    *-leon-*)
3465		tmake_file="sparc/t-sparc sparc/t-leon"
3466		;;
3467	    *-leon[3-9]*)
3468		tmake_file="sparc/t-sparc sparc/t-leon3"
3469		;;
3470	    *)
3471		tmake_file="sparc/t-sparc sparc/t-elf"
3472		;;
3473	esac
3474	;;
3475sparc-*-rtems*)
3476	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
3477	tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems"
3478	;;
3479sparc-*-linux*)
3480	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/tso.h"
3481	extra_options="${extra_options} sparc/long-double-switch.opt"
3482	case ${target} in
3483	    *-leon-*)
3484		tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon"
3485		;;
3486	    *-leon[3-9]*)
3487		tmake_file="${tmake_file} sparc/t-sparc sparc/t-leon3"
3488		;;
3489	    *)
3490		tmake_file="${tmake_file} sparc/t-sparc"
3491		;;
3492	esac
3493	if test x$enable_targets = xall; then
3494		tm_file="sparc/biarch64.h ${tm_file} sparc/linux64.h"
3495		tmake_file="${tmake_file} sparc/t-linux64"
3496	else
3497		tm_file="${tm_file} sparc/linux.h"
3498		tmake_file="${tmake_file} sparc/t-linux"
3499	fi
3500	;;
3501sparc-*-netbsdelf*)
3502	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
3503	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
3504	extra_options="${extra_options} sparc/long-double-switch.opt"
3505	tmake_file="${tmake_file} sparc/t-sparc"
3506	;;
3507sparc*-*-solaris2*)
3508	tm_file="sparc/biarch64.h ${tm_file} ${sol2_tm_file} sparc/tso.h"
3509	case ${target} in
3510	    sparc64-*-* | sparcv9-*-*)
3511		tm_file="sparc/default64.h ${tm_file}"
3512		;;
3513	    *)
3514		test x$with_cpu != x || with_cpu=v9
3515		;;
3516	esac
3517	tmake_file="${tmake_file} sparc/t-sparc sparc/t-sol2"
3518	;;
3519sparc-wrs-vxworks)
3520	tm_file="${tm_file} elfos.h sparc/sysv4.h vx-common.h vxworks.h sparc/vxworks.h"
3521	tmake_file="${tmake_file} sparc/t-sparc sparc/t-vxworks"
3522	;;
3523sparc64-*-elf*)
3524	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h"
3525	extra_options="${extra_options}"
3526	tmake_file="${tmake_file} sparc/t-sparc"
3527	;;
3528sparc64-*-rtems*)
3529	tm_file="${tm_file} dbxelf.h elfos.h newlib-stdint.h sparc/sysv4.h sparc/sp64-elf.h sparc/rtemself.h rtems.h"
3530	extra_options="${extra_options}"
3531	tmake_file="${tmake_file} sparc/t-sparc sparc/t-rtems-64"
3532	;;
3533sparc64-*-linux*)
3534	tm_file="sparc/biarch64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h gnu-user.h linux.h glibc-stdint.h sparc/default64.h sparc/linux64.h sparc/tso.h"
3535	extra_options="${extra_options} sparc/long-double-switch.opt"
3536	tmake_file="${tmake_file} sparc/t-sparc sparc/t-linux64"
3537	;;
3538sparc64-*-freebsd*|ultrasparc-*-freebsd*)
3539	tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h"
3540	extra_options="${extra_options} sparc/long-double-switch.opt"
3541	case "x$with_cpu" in
3542		xultrasparc) ;;
3543		x) with_cpu=ultrasparc ;;
3544		*) echo "$with_cpu not supported for freebsd target"; exit 1 ;;
3545	esac
3546	tmake_file="${tmake_file} sparc/t-sparc"
3547	;;
3548sparc64-*-netbsd*)
3549	tm_file="sparc/biarch64.h ${tm_file}"
3550	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h ${nbsd_tm_file} sparc/netbsd-elf.h"
3551	tm_file="${tm_file} sparc/default64.h"
3552	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
3553	extra_options="${extra_options} sparc/long-double-switch.opt"
3554	tmake_file="${tmake_file} sparc/t-sparc sparc/t-netbsd64"
3555	with_cpu=ultrasparc
3556	;;
3557sparc64-*-openbsd*)
3558	tm_file="sparc/openbsd1-64.h ${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp64-elf.h"
3559	tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h sparc/openbsd64.h"
3560	extra_options="${extra_options} openbsd.opt"
3561	extra_options="${extra_options}"
3562	gas=yes gnu_ld=yes
3563	with_cpu=ultrasparc
3564	tmake_file="${tmake_file} sparc/t-sparc"
3565	;;
3566tic6x-*-elf)
3567	tm_file="elfos.h ${tm_file} c6x/elf-common.h c6x/elf.h"
3568	tm_file="${tm_file} dbxelf.h tm-dwarf2.h newlib-stdint.h"
3569	tmake_file="c6x/t-c6x c6x/t-c6x-elf"
3570	use_collect2=no
3571	;;
3572tic6x-*-uclinux)
3573	tm_file="elfos.h ${tm_file} gnu-user.h linux.h c6x/elf-common.h c6x/uclinux-elf.h"
3574	tm_file="${tm_file} dbxelf.h tm-dwarf2.h glibc-stdint.h"
3575	tm_file="${tm_file} ./sysroot-suffix.h"
3576	tmake_file="t-sysroot-suffix t-slibgcc"
3577	tmake_file="${tmake_file} c6x/t-c6x c6x/t-c6x-elf c6x/t-c6x-uclinux"
3578	use_collect2=no
3579	;;
3580tilegx*-*-linux*)
3581	tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilegx/linux.h ${tm_file}"
3582        tmake_file="${tmake_file} tilegx/t-tilegx"
3583	extra_objs="${extra_objs} mul-tables.o"
3584	c_target_objs="${c_target_objs} tilegx-c.o"
3585	cxx_target_objs="${cxx_target_objs} tilegx-c.o"
3586	extra_headers="feedback.h"
3587	case $target in
3588	tilegxbe-*)
3589		tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
3590 		;;
3591	esac
3592	;;
3593tilepro*-*-linux*)
3594	tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h tilepro/linux.h ${tm_file}"
3595        tmake_file="${tmake_file} tilepro/t-tilepro"
3596	extra_objs="${extra_objs} mul-tables.o"
3597	c_target_objs="${c_target_objs} tilepro-c.o"
3598	cxx_target_objs="${cxx_target_objs} tilepro-c.o"
3599	extra_headers="feedback.h"
3600	;;
3601v850-*-rtems*)
3602	target_cpu_default="TARGET_CPU_generic"
3603	tm_file="elfos.h v850/v850.h"
3604	tm_file="${tm_file} v850/rtems.h rtems.h newlib-stdint.h"
3605	tmake_file="${tmake_file} v850/t-v850"
3606	tmake_file="${tmake_file} v850/t-rtems"
3607	use_collect2=no
3608	c_target_objs="v850-c.o"
3609	cxx_target_objs="v850-c.o"
3610	;;
3611v850*-*-*)
3612	case ${target} in
3613	v850e3v5-*-*)
3614		target_cpu_default="TARGET_CPU_v850e3v5"
3615		;;
3616	v850e2v3-*-*)
3617		target_cpu_default="TARGET_CPU_v850e2v3"
3618		;;
3619	v850e2-*-*)
3620		target_cpu_default="TARGET_CPU_v850e2"
3621		;;
3622	v850e1-*-* | v850es-*-*)
3623		target_cpu_default="TARGET_CPU_v850e1"
3624		;;
3625	v850e-*-*)
3626		target_cpu_default="TARGET_CPU_v850e"
3627		;;
3628	v850-*-*)
3629		target_cpu_default="TARGET_CPU_generic"
3630		;;
3631	esac
3632	tm_file="elfos.h newlib-stdint.h v850/v850.h"
3633	use_collect2=no
3634	c_target_objs="v850-c.o"
3635	cxx_target_objs="v850-c.o"
3636	use_gcc_stdint=wrap
3637	;;
3638vax-*-linux*)
3639	tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h linux.h vax/elf.h vax/linux.h"
3640	extra_options="${extra_options} vax/elf.opt"
3641	;;
3642vax-*-netbsdelf*)
3643	tm_file="${tm_file} elfos.h ${nbsd_tm_file} vax/elf.h vax/netbsd-elf.h"
3644	extra_options="${extra_options} netbsd.opt netbsd-elf.opt vax/elf.opt"
3645	tm_defines="${tm_defines} CHAR_FAST8=1 SHORT_FAST16=1"
3646	;;
3647visium-*-elf*)
3648	tm_file="dbxelf.h elfos.h ${tm_file} visium/elf.h newlib-stdint.h"
3649	tmake_file="visium/t-visium visium/t-crtstuff"
3650	;;
3651xstormy16-*-elf)
3652	# For historical reasons, the target files omit the 'x'.
3653	tm_file="dbxelf.h elfos.h newlib-stdint.h stormy16/stormy16.h"
3654	tm_p_file=stormy16/stormy16-protos.h
3655	md_file=stormy16/stormy16.md
3656	out_file=stormy16/stormy16.cc
3657	extra_options=stormy16/stormy16.opt
3658	tmake_file="stormy16/t-stormy16"
3659	;;
3660xtensa*-*-elf*)
3661	tm_file="${tm_file} elfos.h newlib-stdint.h xtensa/elf.h"
3662	extra_options="${extra_options} xtensa/elf.opt"
3663	;;
3664xtensa*-*-linux*)
3665	tm_file="${tm_file} elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/linux.h"
3666	tmake_file="${tmake_file} xtensa/t-xtensa"
3667	;;
3668xtensa*-*-uclinux*)
3669	tm_file="${tm_file} elfos.h gnu-user.h linux.h glibc-stdint.h xtensa/uclinux.h"
3670	tmake_file="${tmake_file} xtensa/t-xtensa"
3671	extra_options="${extra_options} xtensa/uclinux.opt"
3672	;;
3673am33_2.0-*-linux*)
3674	tm_file="mn10300/mn10300.h elfos.h gnu-user.h linux.h glibc-stdint.h mn10300/linux.h"
3675	gas=yes gnu_ld=yes
3676	use_collect2=no
3677	;;
3678m32c-*-rtems*)
3679	tm_file="elfos.h ${tm_file} m32c/rtems.h rtems.h newlib-stdint.h"
3680	c_target_objs="m32c-pragma.o"
3681	cxx_target_objs="m32c-pragma.o"
3682 	;;
3683m32c-*-elf*)
3684	tm_file="elfos.h newlib-stdint.h ${tm_file}"
3685	c_target_objs="m32c-pragma.o"
3686	cxx_target_objs="m32c-pragma.o"
3687 	;;
3688*)
3689	echo "*** Configuration ${target} not supported" 1>&2
3690	exit 1
3691	;;
3692esac
3693
3694case ${target} in
3695i[34567]86-*-linux* | x86_64-*-linux*)
3696	tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386"
3697	;;
3698i[34567]86-*-* | x86_64-*-*)
3699	tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
3700	;;
3701powerpc*-*-* | rs6000-*-*)
3702	tm_file="${tm_file} ${cpu_type}/option-defaults.h"
3703esac
3704
3705# non-glibc systems
3706case ${target} in
3707*-linux-musl*)
3708	tmake_file="${tmake_file} t-musl"
3709	;;
3710*-linux-uclibc*)
3711	tmake_file="${tmake_file} t-uclibc"
3712	;;
3713esac
3714
3715# Assume the existence of indirect function support and allow the use of the
3716# resolver attribute.
3717case ${target} in
3718*-*-linux*android*|*-*-linux*uclibc*|*-*-linux*musl*)
3719        ;;
3720*-*-kfreebsd*-gnu | *-*-kopensolaris*-gnu)
3721        ;;
3722*-*-linux* | *-*-gnu*)
3723	case ${target} in
3724	aarch64*-* | arm*-* | i[34567]86-* | powerpc*-* | s390*-* | sparc*-* | x86_64-* | loongarch*-*)
3725		default_gnu_indirect_function=yes
3726		;;
3727	esac
3728	;;
3729esac
3730
3731# Build mkoffload tool
3732case ${target} in
3733*-intelmic-* | *-intelmicemul-*)
3734	tmake_file="${tmake_file} i386/t-intelmic"
3735	tm_file="${tm_file} i386/intelmic-offload.h"
3736	;;
3737esac
3738
3739if [ "$target_has_targetcm" = "no" ]; then
3740  c_target_objs="$c_target_objs default-c.o"
3741  cxx_target_objs="$cxx_target_objs default-c.o"
3742fi
3743
3744if [ "$common_out_file" = "" ]; then
3745  if [ "$target_has_targetm_common" = "yes" ]; then
3746    common_out_file="$cpu_type/$cpu_type-common.cc"
3747  else
3748    common_out_file="default-common.cc"
3749  fi
3750fi
3751
3752if [ "$target_has_targetdm" = "no" ]; then
3753  d_target_objs="$d_target_objs default-d.o"
3754fi
3755
3756# Support for --with-cpu and related options (and a few unrelated options,
3757# too).
3758case ${with_cpu} in
3759  yes | no)
3760    echo "--with-cpu must be passed a value" 1>&2
3761    exit 1
3762    ;;
3763esac
3764
3765# Set arch and cpu from ${target} and ${target_noncanonical}.  Set cpu
3766# to generic if there is no processor scheduler model for the target.
3767arch=
3768cpu=
3769arch_without_sse2=no
3770arch_without_64bit=no
3771case ${target} in
3772  i386-*-freebsd*)
3773    if test $fbsd_major -ge 6; then
3774      arch=i486
3775    else
3776      arch=i386
3777    fi
3778    cpu=generic
3779    arch_without_sse2=yes
3780    arch_without_64bit=yes
3781    ;;
3782  i386-*-netbsd*)
3783    arch=i486
3784    cpu=generic
3785    arch_without_sse2=yes
3786    arch_without_64bit=yes
3787    ;;
3788  i386-*-*)
3789    arch=i386
3790    cpu=i386
3791    arch_without_sse2=yes
3792    arch_without_64bit=yes
3793    ;;
3794  i486-*-*)
3795    arch=i486
3796    cpu=i486
3797    arch_without_sse2=yes
3798    arch_without_64bit=yes
3799    ;;
3800  i586-*-*)
3801    arch_without_sse2=yes
3802    arch_without_64bit=yes
3803    case ${target_noncanonical} in
3804      k6_2-*)
3805	arch=k6-2
3806	cpu=k6-2
3807	;;
3808      k6_3-*)
3809	arch=k6-3
3810	cpu=k6-3
3811	;;
3812      k6-*)
3813	arch=k6
3814	cpu=k6
3815	;;
3816      pentium_mmx-*|winchip_c6-*|winchip2-*|c3-*)
3817	arch=pentium-mmx
3818	cpu=pentium-mmx
3819	;;
3820      *)
3821	arch=pentium
3822	cpu=pentium
3823	;;
3824    esac
3825    ;;
3826  i686-*-* | i786-*-*)
3827    case ${target_noncanonical} in
3828      znver1-*)
3829	arch=znver1
3830	cpu=znver1
3831	;;
3832      znver2-*)
3833	arch=znver2
3834	cpu=znver2
3835	;;
3836      znver3-*)
3837	arch=znver3
3838	cpu=znver3
3839	;;
3840      znver4-*)
3841	arch=znver4
3842	cpu=znver4
3843	;;
3844      bdver4-*)
3845        arch=bdver4
3846        cpu=bdver4
3847        ;;
3848      bdver3-*)
3849        arch=bdver3
3850        cpu=bdver3
3851        ;;
3852      bdver2-*)
3853        arch=bdver2
3854        cpu=bdver2
3855        ;;
3856      bdver1-*)
3857	arch=bdver1
3858	cpu=bdver1
3859	;;
3860      btver1-*)
3861	arch=btver1
3862	cpu=btver1
3863	;;
3864      btver2-*)
3865	arch=btver2
3866	cpu=btver2
3867	;;
3868      amdfam10-*|barcelona-*)
3869	arch=amdfam10
3870	cpu=amdfam10
3871	;;
3872      k8_sse3-*|opteron_sse3-*|athlon64_sse3-*)
3873	arch=k8-sse3
3874	cpu=k8-sse3
3875	;;
3876      k8-*|opteron-*|athlon64-*|athlon_fx-*)
3877	arch=k8
3878	cpu=k8
3879	;;
3880      athlon_xp-*|athlon_mp-*|athlon_4-*)
3881	arch=athlon-4
3882	cpu=athlon-4
3883	arch_without_sse2=yes
3884	arch_without_64bit=yes
3885	;;
3886      athlon_tbird-*|athlon-*)
3887	arch=athlon
3888	cpu=athlon
3889	arch_without_sse2=yes
3890	;;
3891      geode-*)
3892	arch=geode
3893	cpu=geode
3894	arch_without_sse2=yes
3895	;;
3896      pentium2-*)
3897	arch=pentium2
3898	cpu=pentium2
3899	arch_without_sse2=yes
3900	;;
3901      pentium3-*|pentium3m-*)
3902	arch=pentium3
3903	cpu=pentium3
3904	arch_without_sse2=yes
3905	;;
3906      pentium4-*|pentium4m-*)
3907	arch=pentium4
3908	cpu=pentium4
3909	;;
3910      prescott-*)
3911	arch=prescott
3912	cpu=prescott
3913	;;
3914      nocona-*)
3915	arch=nocona
3916	cpu=nocona
3917	;;
3918      atom-*)
3919	arch=atom
3920	cpu=atom
3921	;;
3922      slm-*)
3923	arch=slm
3924	cpu=slm
3925	;;
3926      core2-*)
3927	arch=core2
3928	cpu=core2
3929	;;
3930      corei7-*)
3931	arch=corei7
3932	cpu=corei7
3933	;;
3934      corei7_avx-*)
3935	arch=corei7-avx
3936	cpu=corei7-avx
3937	;;
3938      pentium_m-*)
3939	arch=pentium-m
3940	cpu=pentium-m
3941	;;
3942      pentiumpro-*)
3943	arch=pentiumpro
3944	cpu=pentiumpro
3945	arch_without_sse2=yes
3946	;;
3947      *)
3948	arch=pentiumpro
3949	cpu=generic
3950	arch_without_sse2=yes
3951	arch_without_64bit=yes
3952	;;
3953    esac
3954    ;;
3955  x86_64-*-*)
3956    case ${target_noncanonical} in
3957      znver1-*)
3958	arch=znver1
3959	cpu=znver1
3960	;;
3961      znver2-*)
3962	arch=znver2
3963	cpu=znver2
3964	;;
3965      znver3-*)
3966	arch=znver3
3967	cpu=znver3
3968	;;
3969	  znver4-*)
3970	arch=znver4
3971	cpu=znver4
3972	;;
3973      bdver4-*)
3974        arch=bdver4
3975        cpu=bdver4
3976        ;;
3977      bdver3-*)
3978        arch=bdver3
3979        cpu=bdver3
3980        ;;
3981      bdver2-*)
3982        arch=bdver2
3983        cpu=bdver2
3984        ;;
3985      bdver1-*)
3986	arch=bdver1
3987	cpu=bdver1
3988	;;
3989      btver1-*)
3990	arch=btver1
3991	cpu=btver1
3992	;;
3993      btver2-*)
3994	arch=btver2
3995	cpu=btver2
3996	;;
3997      amdfam10-*|barcelona-*)
3998	arch=amdfam10
3999	cpu=amdfam10
4000	;;
4001      k8_sse3-*|opteron_sse3-*|athlon64_sse3-*)
4002	arch=k8-sse3
4003	cpu=k8-sse3
4004	;;
4005      k8-*|opteron-*|athlon_64-*)
4006	arch=k8
4007	cpu=k8
4008	;;
4009      nocona-*)
4010	arch=nocona
4011	cpu=nocona
4012	;;
4013      atom-*)
4014	arch=atom
4015	cpu=atom
4016	;;
4017      slm-*)
4018	arch=slm
4019	cpu=slm
4020	;;
4021      core2-*)
4022	arch=core2
4023	cpu=core2
4024	;;
4025      corei7-*)
4026	arch=corei7
4027	cpu=corei7
4028	;;
4029      *)
4030	arch=x86-64
4031	cpu=generic
4032	;;
4033    esac
4034    ;;
4035esac
4036
4037# If there is no $with_cpu option, try to infer one from ${target}.
4038# This block sets nothing except for with_cpu.
4039if test x$with_cpu = x ; then
4040  case ${target} in
4041    i[34567]86-*-elfiamcu)
4042      with_cpu=lakemont
4043      ;;
4044    i[34567]86-*-*|x86_64-*-*)
4045      with_cpu=$cpu
4046      ;;
4047    alphaev6[78]*-*-*)
4048      with_cpu=ev67
4049      ;;
4050    alphaev6*-*-*)
4051      with_cpu=ev6
4052      ;;
4053    alphapca56*-*-*)
4054      with_cpu=pca56
4055      ;;
4056    alphaev56*-*-*)
4057      with_cpu=ev56
4058      ;;
4059    alphaev5*-*-*)
4060      with_cpu=ev5
4061      ;;
4062    frv-*-*linux* | frv400-*-*linux*)
4063      with_cpu=fr400
4064      ;;
4065    frv550-*-*linux*)
4066      with_cpu=fr550
4067      ;;
4068    m5200-*-*|m5407-*-*)
4069      with_cpu=${default_cf_cpu}
4070      ;;
4071    m68k*-*-*)
4072      case "$with_arch" in
4073	"cf")
4074	  with_cpu=${default_cf_cpu}
4075	  ;;
4076	"" | "m68k")
4077	  with_cpu=m${default_m68k_cpu}
4078	  ;;
4079      esac
4080      ;;
4081    sparc*-*-*)
4082      case ${target} in
4083	*-leon-*)
4084	  with_cpu=leon
4085	  ;;
4086	*-leon[3-9]*)
4087	  with_cpu=leon3
4088	  ;;
4089	*-leon[3-9]v7*)
4090	  with_cpu=leon3v7
4091	  ;;
4092	*)
4093	  with_cpu="`echo ${target} | sed 's/-.*$//'`"
4094	  ;;
4095      esac
4096      ;;
4097    visium-*-*)
4098      with_cpu=gr5
4099      ;;
4100  esac
4101
4102  # Avoid overriding --with-cpu-32 and --with-cpu-64 values.
4103  case ${target} in
4104    i[34567]86-*-*|x86_64-*-*)
4105      if test x$with_cpu_32 != x || test x$with_cpu_64 != x; then
4106	if test x$with_cpu_32 = x; then
4107	  with_cpu_32=$with_cpu
4108	fi
4109	if test x$with_cpu_64 = x; then
4110	  with_cpu_64=$with_cpu
4111	fi
4112        with_cpu=
4113      fi
4114      ;;
4115  esac
4116fi
4117
4118# Support for --with-arch and related options (and a few unrelated options,
4119# too).
4120case ${with_arch} in
4121  yes | no)
4122    echo "--with-arch must be passed a value" 1>&2
4123    exit 1
4124    ;;
4125esac
4126
4127# If there is no $with_arch option, try to infer one from ${target}.
4128# This block sets nothing except for with_arch.
4129if test x$with_arch = x ; then
4130  case ${target} in
4131    i[34567]86-*-darwin*|x86_64-*-darwin*)
4132      # Default arch is set via TARGET_SUBTARGET32_ISA_DEFAULT
4133      # and TARGET_SUBTARGET64_ISA_DEFAULT in config/i386/darwin.h.
4134      ;;
4135    i[34567]86-*-elfiamcu)
4136      with_arch=lakemont
4137      ;;
4138    i[34567]86-*-*)
4139      # --with-fpmath sets the default ISA to SSE2, which is the same
4140      # ISA supported by Pentium 4.
4141      if test x$with_fpmath = x || test $arch_without_sse2 = no; then
4142	with_arch=$arch
4143      else
4144	with_arch=pentium4
4145      fi
4146      ;;
4147    x86_64-*-*)
4148      with_arch=$arch
4149      ;;
4150    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
4151      with_arch=r5900
4152      ;;
4153    mips*-*-vxworks)
4154      with_arch=mips2
4155      ;;
4156  esac
4157
4158  # Avoid overriding --with-arch-32 and --with-arch-64 values.
4159  case ${target} in
4160    i[34567]86-*-darwin*|x86_64-*-darwin*)
4161      # Default arch is set via TARGET_SUBTARGET32_ISA_DEFAULT
4162      # and TARGET_SUBTARGET64_ISA_DEFAULT in config/i386/darwin.h.
4163      ;;
4164    i[34567]86-*-*|x86_64-*-*)
4165      if test x$with_arch_32 != x || test x$with_arch_64 != x; then
4166	if test x$with_arch_32 = x; then
4167	  with_arch_32=$with_arch
4168	fi
4169	if test x$with_arch_64 = x; then
4170	  if test $arch_without_64bit = yes; then
4171	    # Set the default 64bit arch to x86-64 if the default arch
4172	    # doesn't support 64bit.
4173	    with_arch_64=x86-64
4174	  else
4175	    with_arch_64=$with_arch
4176	  fi
4177	fi
4178	with_arch=
4179      elif test $arch_without_64bit$need_64bit_isa = yesyes; then
4180	# Set the default 64bit arch to x86-64 if the default arch
4181	# doesn't support 64bit and we need 64bit ISA.
4182	with_arch_32=$with_arch
4183	with_arch_64=x86-64
4184	with_arch=
4185      fi
4186      ;;
4187  esac
4188fi
4189
4190# Infer a default setting for --with-float.
4191if test x$with_float = x; then
4192  case ${target} in
4193    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
4194      # The R5900 doesn't support 64-bit float.  32-bit float doesn't
4195      # comply with IEEE 754.
4196      with_float=soft
4197      ;;
4198  esac
4199fi
4200
4201# Infer a default setting for --with-fpu.
4202if test x$with_fpu = x; then
4203  case ${target} in
4204    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
4205      # The R5900 FPU only supports single precision.
4206      with_fpu=single
4207      ;;
4208  esac
4209fi
4210
4211# Support --with-fpmath.
4212if test x$with_fpmath != x; then
4213  case ${target} in
4214    i[34567]86-*-* | x86_64-*-*)
4215      case ${with_fpmath} in
4216      avx)
4217	tm_file="${tm_file} i386/avxmath.h"
4218	;;
4219      sse)
4220	tm_file="${tm_file} i386/ssemath.h"
4221	;;
4222      *)
4223	echo "Invalid --with-fpmath=$with_fpmath" 1>&2
4224	exit 1
4225	;;
4226      esac
4227      ;;
4228    *)
4229      echo "--with-fpmath isn't supported for $target." 1>&2
4230      exit 1
4231      ;;
4232  esac
4233fi
4234
4235# Similarly for --with-schedule.
4236if test x$with_schedule = x; then
4237	case ${target} in
4238	hppa1*)
4239		# Override default PA8000 scheduling model.
4240		with_schedule=7100LC
4241		;;
4242	esac
4243fi
4244
4245# Infer a default setting for --with-llsc.
4246if test x$with_llsc = x; then
4247  case ${target} in
4248    mips*-*-linux*)
4249      # The kernel emulates LL and SC where necessary.
4250      with_llsc=yes
4251      ;;
4252    mips64r5900-*-* | mips64r5900el-*-* | mipsr5900-*-* | mipsr5900el-*-*)
4253      # The R5900 doesn't support LL(D) and SC(D).
4254      with_llsc=no
4255      ;;
4256  esac
4257fi
4258
4259# Validate and mark as valid any --with options supported
4260# by this target.  In order to use a particular --with option
4261# you must list it in supported_defaults; validating the value
4262# is optional.  This case statement should set nothing besides
4263# supported_defaults.
4264
4265supported_defaults=
4266case "${target}" in
4267	aarch64*-*-*)
4268		supported_defaults="abi cpu cpu_64 arch arch_64 tune tune_64"
4269		if test x$with_cpu_64 != x && test x$with_cpu = x; then
4270			with_cpu=$with_cpu_64
4271		fi
4272		if test x$with_arch_64 != x && test x$with_arch = x; then
4273			with_arch=$with_arch_64
4274		fi
4275		if test x$with_tune_64 != x && test x$with_tune = x; then
4276			with_tune=$with_tune_64
4277		fi
4278		for which in cpu arch tune; do
4279			eval "val=\$with_$which"
4280			base_val=`echo $val | sed -e 's/\+.*//'`
4281			ext_val=`echo $val | sed -e 's/[a-z0-9.-]\+//'`
4282
4283			if [ $which = arch ]; then
4284			  def=aarch64-arches.def
4285			  pattern=AARCH64_ARCH
4286			else
4287			  def=aarch64-cores.def
4288			  pattern=AARCH64_CORE
4289			fi
4290
4291			ext_mask=AARCH64_CPU_DEFAULT_FLAGS
4292
4293			# Find the base CPU or ARCH id in aarch64-cores.def or
4294			# aarch64-arches.def
4295			if [ x"$base_val" = x ] \
4296			    || grep "^$pattern(\"$base_val\"," \
4297				    ${srcdir}/config/aarch64/$def \
4298				    > /dev/null; then
4299
4300			  if [ $which = arch ]; then
4301				base_id=`grep "^$pattern(\"$base_val\"," \
4302				  ${srcdir}/config/aarch64/$def | \
4303				  sed -e 's/^[^,]*,[ 	]*//' | \
4304				  sed -e 's/,.*$//'`
4305				# Extract the architecture flags from aarch64-arches.def
4306				ext_mask=`grep "^$pattern(\"$base_val\"," \
4307				   ${srcdir}/config/aarch64/$def | \
4308				   sed -e 's/)$//' | \
4309				   sed -e 's/^.*,//'`
4310			  else
4311				base_id=`grep "^$pattern(\"$base_val\"," \
4312				  ${srcdir}/config/aarch64/$def | \
4313				  sed -e 's/^[^,]*,[ 	]*//' | \
4314				  sed -e 's/,.*$//'`
4315			  fi
4316
4317			  # Disallow extensions in --with-tune=cortex-a53+crc.
4318			  if [ $which = tune ] && [ x"$ext_val" != x ]; then
4319			    echo "Architecture extensions not supported in --with-$which=$val" 1>&2
4320			    exit 1
4321			  fi
4322
4323			  # Use the pre-processor to strip flatten the options.
4324			  # This makes the format less rigid than if we use
4325			  # grep and sed directly here.
4326			  opt_macro="AARCH64_OPT_EXTENSION(A, B, C, D, E, F)=A, B, C, D, E, F"
4327			  options_parsed="`$ac_cv_prog_CPP -D"$opt_macro" -x c \
4328				${srcdir}/config/aarch64/aarch64-option-extensions.def`"
4329
4330			  # Match one element inside AARCH64_OPT_EXTENSION, we
4331			  # consume anything that's not a ,.
4332			  elem="[ 	]*\([^,]\+\)[ 	]*"
4333
4334			  # Repeat the pattern for the number of entries in the
4335			  # AARCH64_OPT_EXTENSION, currently 6 times.
4336			  sed_patt="^$elem,$elem,$elem,$elem,$elem,$elem"
4337
4338			  while [ x"$ext_val" != x ]
4339			  do
4340				ext_val=`echo $ext_val | sed -e 's/\+//'`
4341				ext=`echo $ext_val | sed -e 's/\+.*//'`
4342				base_ext=`echo $ext | sed -e 's/^no//'`
4343				opt_line=`echo -e "$options_parsed" | \
4344					grep "^\"$base_ext\""`
4345
4346				if [ x"$base_ext" = x ] \
4347				    || [[ -n $opt_line ]]; then
4348
4349				  # These regexp extract the elements based on
4350				  # their group match index in the regexp.
4351				  ext_canon=`echo -e "$opt_line" | \
4352					sed -e "s/$sed_patt/\2/"`
4353				  ext_on=`echo -e "$opt_line" | \
4354					sed -e "s/$sed_patt/\3/"`
4355				  ext_off=`echo -e "$opt_line" | \
4356					sed -e "s/$sed_patt/\4/"`
4357
4358				  if [ $ext = $base_ext ]; then
4359					# Adding extension
4360					ext_mask="("$ext_mask") | ("$ext_on" | "$ext_canon")"
4361				  else
4362					# Removing extension
4363					ext_mask="("$ext_mask") & ~("$ext_off" | "$ext_canon")"
4364				  fi
4365
4366				  true
4367				else
4368				  echo "Unknown extension used in --with-$which=$val" 1>&2
4369				  exit 1
4370				fi
4371				ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'`
4372			  done
4373
4374			  ext_mask="(("$ext_mask") << TARGET_CPU_NBITS)"
4375			  if [ x"$base_id" != x ]; then
4376				target_cpu_cname="TARGET_CPU_$base_id | $ext_mask"
4377			  fi
4378			  true
4379			else
4380			  # Allow --with-$which=native.
4381			  if [ "$val" = native ]; then
4382			    true
4383			  else
4384			    echo "Unknown $which used in --with-$which=$val" 1>&2
4385			    exit 1
4386			  fi
4387			fi
4388		done
4389		;;
4390
4391	alpha*-*-*)
4392		supported_defaults="cpu tune"
4393		for which in cpu tune; do
4394			eval "val=\$with_$which"
4395			case "$val" in
4396			"" \
4397			| ev4 | ev45 | 21064 | ev5 | 21164 | ev56 | 21164a \
4398			| pca56 | 21164PC | 21164pc | ev6 | 21264 | ev67 \
4399			| 21264a)
4400				;;
4401			*)
4402				echo "Unknown CPU used in --with-$which=$val" 1>&2
4403				exit 1
4404				;;
4405			esac
4406		done
4407		;;
4408
4409	arc*-*-*)
4410		supported_defaults="cpu fpu"
4411
4412		new_cpu=hs38_linux
4413		if [ x"$with_cpu" = x ] \
4414		    || grep -q -E "^ARC_CPU[[:blank:]]*\($with_cpu," \
4415		       ${srcdir}/config/arc/arc-cpus.def
4416		then
4417		 # Ok
4418		 new_cpu=$with_cpu
4419		else
4420		 echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
4421		 exit 1
4422		fi
4423
4424		# see if --with-fpu matches any of the supported FPUs
4425		case "$with_fpu" in
4426		"")
4427			# OK
4428			;;
4429		fpus | fpus_div | fpus_fma | fpus_all)
4430			# OK if em or hs
4431			flags_ok="[emhs]+"
4432			;;
4433		fpuda | fpuda_div | fpuda_fma | fpuda_all)
4434			# OK only em
4435			flags_ok="em"
4436			;;
4437		fpud | fpud_div | fpud_fma | fpud_all)
4438			# OK only hs
4439			flags_ok="hs"
4440			;;
4441		*)
4442			echo "Unknown floating point type used in "\
4443			     "--with-fpu=$with_fpu" 1>&2
4444			exit 1
4445			;;
4446		esac
4447
4448		if [ -n "$flags_ok" ] \
4449		   && ! grep -q -E "^ARC_CPU[[:blank:]]*\($new_cpu,[[:blank:]]*$flags_ok," \
4450		   ${srcdir}/config/arc/arc-cpus.def
4451		then
4452		   echo "Unknown floating point type used in "\
4453			 "--with-fpu=$with_fpu for cpu $new_cpu" 1>&2
4454			 exit 1
4455		fi
4456		;;
4457
4458	avr-*-*)
4459		# Handle --with-multilib-list.
4460		if test "x${with_multilib_list}" != xdefault; then
4461			TM_MULTILIB_CONFIG="${with_multilib_list}"
4462		fi
4463	;;
4464
4465    csky-*-*)
4466	supported_defaults="cpu endian float"
4467	;;
4468
4469	arm*-*-*)
4470		supported_defaults="arch cpu float tune fpu abi mode tls"
4471		for which in cpu tune arch; do
4472			# See if it matches a supported value
4473			eval "val=\$with_$which"
4474			if [ x"$val" != x ]; then
4475			  cpu=`awk -f ${srcdir}/config/arm/parsecpu.awk \
4476				-v cmd="chk$which $val" \
4477				${srcdir}/config/arm/arm-cpus.in`
4478			  if [ "$cpu" = "error" ]; then
4479			    echo "Unknown target in --with-$which=$val" 1>&2
4480			    exit 1
4481			  else
4482			    new_val=$cpu
4483			    eval "target_${which}_cname=$new_val"
4484			    echo "For $val real value is $new_val"
4485			  fi
4486			fi
4487		done
4488
4489		case "$with_float" in
4490		"" \
4491		| soft | hard | softfp)
4492			# OK
4493			;;
4494		*)
4495			echo "Unknown floating point type used in --with-float=$with_float" 1>&2
4496			exit 1
4497			;;
4498		esac
4499
4500		# see if --with-fpu matches any of the supported FPUs
4501		if [ x"$with_fpu" != x ] ; then
4502		  val=$with_fpu
4503		  fpu=`awk -f ${srcdir}/config/arm/parsecpu.awk \
4504			-v cmd="chkfpu $val" \
4505			${srcdir}/config/arm/arm-cpus.in`
4506		  if [ "$fpu" = "error" ]
4507		  then
4508		    echo "Unknown target in --with-fpu=$val" 1>&2
4509		    exit 1
4510		  fi
4511		fi
4512
4513		case "$with_abi" in
4514		"" \
4515		| apcs-gnu | atpcs | aapcs | iwmmxt | aapcs-linux )
4516			#OK
4517			;;
4518		*)
4519			echo "Unknown ABI used in --with-abi=$with_abi"
4520			exit 1
4521			;;
4522		esac
4523
4524		case "$with_mode" in
4525		"" \
4526		| arm | thumb )
4527			#OK
4528			;;
4529		*)
4530			echo "Unknown mode used in --with-mode=$with_mode"
4531			exit 1
4532			;;
4533		esac
4534
4535		case "$with_tls" in
4536		"" \
4537		| gnu | gnu2)
4538			# OK
4539			;;
4540		*)
4541			echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2
4542			exit 1
4543			;;
4544		esac
4545
4546		if test "x$with_arch" != x && test "x$with_cpu" != x; then
4547			echo "Switch \"--with-arch\" may not be used with switch \"--with-cpu\""  1>&2
4548			exit 1
4549		fi
4550
4551		if test "x$with_cpu" != x && test "x$with_tune" != x; then
4552			echo "Switch \"--with-tune\" may not be used with switch \"--with-cpu\""  1>&2
4553			exit 1
4554		fi
4555
4556		# Add extra multilibs
4557		if test "x$with_multilib_list" != x; then
4558			ml=
4559			arm_multilibs=`echo $with_multilib_list | sed -e 's/,/ /g'`
4560			if test "x${arm_multilibs}" != xdefault ; then
4561				for arm_multilib in ${arm_multilibs}; do
4562					case ${arm_multilib} in
4563					aprofile|rmprofile)
4564						tmake_profile_file="arm/t-multilib"
4565						;;
4566					@*)
4567						ml=`echo "X$arm_multilib" | sed '1s,^X@,,'`
4568						if test -f "${srcdir}/config/arm/${ml}"; then
4569							tmake_file="${tmake_file} arm/${ml}"
4570						else
4571							echo "Error: ${ml} does not exist in ${srcdir}/config/arm" >&2
4572							exit 1
4573						fi
4574						;;
4575					*)
4576						echo "Error: --with-multilib-list=${with_multilib_list} not supported." 1>&2
4577						exit 1
4578						;;
4579					esac
4580				done
4581			fi
4582
4583			if test "x${tmake_profile_file}" != x ; then
4584				# arm/t-aprofile and arm/t-rmprofile are only
4585				# designed to work without any with-cpu,
4586				# with-arch, with-mode, with-fpu or with-float
4587				# options.
4588				if test "x$with_arch" != x \
4589				    || test "x$with_cpu" != x \
4590				    || test "x$with_float" != x \
4591				    || test "x$with_fpu" != x \
4592				    || test "x$with_mode" != x ; then
4593				    echo "Error: You cannot use any of --with-arch/cpu/fpu/float/mode with --with-multilib-list=${with_multilib_list}" 1>&2
4594				    exit 1
4595				elif test "x$ml" != x ; then
4596				    echo "Error: You cannot use builtin multilib profiles along with custom ones" 1>&2
4597				    exit 1
4598				fi
4599				# But pass the default value for float-abi
4600				# through to the multilib selector
4601				with_float="soft"
4602				tmake_file="${tmake_file} ${tmake_profile_file}"
4603				TM_MULTILIB_CONFIG="$with_multilib_list"
4604			fi
4605		fi
4606		target_cpu_cname=${target_cpu_cname:-arm7tdmi}
4607		with_cpu=${with_cpu:-$target_cpu_cname}
4608		;;
4609
4610	fr*-*-*linux*)
4611		supported_defaults=cpu
4612		case "$with_cpu" in
4613		fr400) ;;
4614		fr550) ;;
4615		*)
4616			echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
4617			exit 1
4618			;;
4619		esac
4620		;;
4621
4622	fido-*-* | m68k*-*-* | m5200-*-* | m5407-*-*)
4623		supported_defaults="arch cpu"
4624		case "$with_arch" in
4625		"" | "m68k"| "cf")
4626			m68k_arch_family="$with_arch"
4627			;;
4628		*)
4629			echo "Invalid --with-arch=$with_arch" 1>&2
4630			exit 1
4631			;;
4632		esac
4633
4634		# We always have a $with_cpu setting here.
4635		case "$with_cpu" in
4636		"m68000" | "m68010" | "m68020" | "m68030" | "m68040" | "m68060")
4637			m68k_cpu_ident=$with_cpu
4638			;;
4639		"m68020-40")
4640			m68k_cpu_ident=m68020
4641			tm_defines="$tm_defines M68K_DEFAULT_TUNE=u68020_40"
4642			;;
4643		"m68020-60")
4644			m68k_cpu_ident=m68020
4645			tm_defines="$tm_defines M68K_DEFAULT_TUNE=u68020_60"
4646			;;
4647		*)
4648			# We need the C identifier rather than the string.
4649			m68k_cpu_ident=`awk -v arg="\"$with_cpu\"" \
4650			   'BEGIN { FS="[ \t]*[,()][ \t]*" }; \
4651			    $1 == "M68K_DEVICE" && $2 == arg { print $3 }' \
4652				 ${srcdir}/config/m68k/m68k-devices.def`
4653			if [ x"$m68k_cpu_ident" = x ] ; then
4654				echo "Unknown CPU used in --with-cpu=$with_cpu" 1>&2
4655				exit 1
4656			fi
4657			with_cpu="mcpu=$with_cpu"
4658			;;
4659		esac
4660		;;
4661
4662	amdgcn-*-*)
4663		supported_defaults="arch tune"
4664
4665		for which in arch tune; do
4666			eval "val=\$with_$which"
4667			case ${val} in
4668			"" | fiji | gfx900 | gfx906 )
4669				# OK
4670				;;
4671			*)
4672				echo "Unknown cpu used in --with-$which=$val." 1>&2
4673				exit 1
4674				;;
4675			esac
4676		done
4677		[ "x$with_arch" = x ] && with_arch=fiji
4678		;;
4679
4680	hppa*-*-*)
4681		supported_defaults="arch schedule"
4682
4683		case "$with_arch" in
4684		"" | 1.0 | 1.1 | 2.0)
4685			# OK
4686			;;
4687		*)
4688			echo "Unknown architecture used in --with-arch=$with_arch" 1>&2
4689			exit 1
4690			;;
4691		esac
4692
4693		case "$with_schedule" in
4694		"" | 700 | 7100 | 7100LC | 7200 | 7300 | 8000)
4695			# OK
4696			;;
4697		*)
4698			echo "Unknown processor used in --with-schedule=$with_schedule." 1>&2
4699			exit 1
4700			;;
4701		esac
4702		;;
4703
4704	i[34567]86-*-* | x86_64-*-*)
4705		supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
4706		for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
4707			eval "val=\$with_$which"
4708			case " $x86_archs " in
4709			*" ${val} "*)
4710				case "${target}" in
4711				  x86_64-*-*)
4712				      case "x$which" in
4713					*_32)
4714						;;
4715					*)
4716						echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2
4717						exit 1
4718						;;
4719				      esac
4720				      ;;
4721				esac
4722				# OK
4723				;;
4724			*)
4725				if test x${val} != x; then
4726					case " $x86_64_archs " in
4727					*" ${val} "*)
4728						# Disallow x86-64-v* for --with-cpu=/--with-tune=
4729						case "x$which$val" in
4730						xcpu*x86-64-v*|xtune*x86-64-v*)
4731							echo "Unknown CPU given in --with-$which=$val." 1>&2
4732							exit 1
4733							;;
4734						*)
4735							;;
4736						esac
4737						# OK
4738						;;
4739					*)
4740						# Allow $x86_cpus --with-cpu=/--with-tune=
4741						case "x$which" in
4742						xcpu*|xtune*)
4743							case " $x86_cpus " in
4744							*" ${val} "*)
4745								# OK
4746								;;
4747							*)
4748								echo "Unknown CPU given in --with-$which=$val." 1>&2
4749								exit 1
4750								;;
4751							esac
4752							;;
4753						*)
4754							echo "Unknown CPU given in --with-$which=$val." 1>&2
4755							exit 1
4756							;;
4757						esac
4758					;;
4759					esac
4760				fi
4761				;;
4762			esac
4763		done
4764		;;
4765
4766	riscv*-*-*)
4767		supported_defaults="abi arch tune riscv_attribute isa_spec"
4768
4769		case "${target}" in
4770		riscv-* | riscv32*) xlen=32 ;;
4771		riscv64*) xlen=64 ;;
4772		*) echo "Unsupported RISC-V target ${target}" 1>&2; exit 1 ;;
4773		esac
4774
4775		case "${with_isa_spec}" in
4776		""|default|20191213|201912)
4777			tm_defines="${tm_defines} TARGET_DEFAULT_ISA_SPEC=ISA_SPEC_CLASS_20191213"
4778			with_isa_spec=20191213
4779			;;
4780		2.2)
4781			tm_defines="${tm_defines} TARGET_DEFAULT_ISA_SPEC=ISA_SPEC_CLASS_2P2"
4782			;;
4783		20190608 | 201906)
4784			tm_defines="${tm_defines} TARGET_DEFAULT_ISA_SPEC=ISA_SPEC_CLASS_20190608"
4785			with_isa_spec=20190608
4786			;;
4787		*)
4788			echo "--with-isa-spec only accept 2.2, 20191213, 201912, 20190608 or 201906" 1>&2
4789			exit 1
4790		esac
4791
4792		case "${with_riscv_attribute}" in
4793		yes)
4794			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
4795			;;
4796		no)
4797			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=0"
4798			;;
4799		""|default)
4800			tm_defines="${tm_defines} TARGET_RISCV_ATTRIBUTE=1"
4801			;;
4802		*)
4803			echo "--with-riscv-attribute=${with_riscv_attribute} is not supported.  The argument must begin with yes, no or default." 1>&2
4804			exit 1
4805			;;
4806		esac
4807
4808
4809		# Infer arch from --with-arch, --target, and --with-abi.
4810		case "${with_arch}" in
4811		rv32e* | rv32i* | rv32g* | rv64i* | rv64g*)
4812			# OK.
4813			;;
4814		"")
4815			# Infer XLEN, but otherwise assume GC.
4816			case "${with_abi}" in
4817			ilp32e) with_arch="rv32e" ;;
4818			ilp32 | ilp32f | ilp32d) with_arch="rv32gc" ;;
4819			lp64 | lp64f | lp64d) with_arch="rv64gc" ;;
4820			*) with_arch="rv${xlen}gc" ;;
4821			esac
4822			;;
4823		*)
4824			echo "--with-arch=${with_arch} is not supported.  The argument must begin with rv32e, rv32i, rv32g, rv64i, or rv64g." 1>&2
4825			exit 1
4826			;;
4827		esac
4828		PYTHON=`which python || which python3 || which python2`
4829		if test "x${PYTHON}" != x; then
4830			with_arch=`${PYTHON} ${srcdir}/config/riscv/arch-canonicalize -misa-spec=${with_isa_spec} ${with_arch}`
4831		fi
4832		tm_defines="${tm_defines} TARGET_RISCV_DEFAULT_ARCH=${with_arch}"
4833
4834		# Make sure --with-abi is valid.  If it was not specified,
4835		# pick a default based on the ISA, preferring soft-float
4836		# unless the D extension is present.
4837		case "${with_abi}" in
4838		ilp32 | ilp32e | ilp32f | ilp32d | lp64 | lp64f | lp64d)
4839			;;
4840		"")
4841			case "${with_arch}" in
4842			rv32*d* | rv32g*) with_abi=ilp32d ;;
4843			rv32e*) with_abi=ilp32e ;;
4844			rv32*) with_abi=ilp32 ;;
4845			rv64*d* | rv64g*) with_abi=lp64d ;;
4846			rv64*) with_abi=lp64 ;;
4847			esac
4848			;;
4849		*)
4850			echo "--with-abi=${with_abi} is not supported" 1>&2
4851			exit 1
4852			;;
4853		esac
4854		tm_defines="${tm_defines} TARGET_RISCV_DEFAULT_ABI=${with_abi}"
4855
4856		# Make sure ABI and ISA are compatible.
4857		case "${with_abi},${with_arch}" in
4858		ilp32,rv32* | ilp32e,rv32e* \
4859		| ilp32f,rv32*f* | ilp32f,rv32g* \
4860		| ilp32d,rv32*d* | ilp32d,rv32g* \
4861		| lp64,rv64* \
4862		| lp64f,rv64*f* | lp64f,rv64g* \
4863		| lp64d,rv64*d* | lp64d,rv64g*)
4864			;;
4865		*)
4866			echo "--with-abi=${with_abi} is not supported for ISA ${with_arch}" 1>&2
4867			exit 1
4868			;;
4869		esac
4870		# Handle --with-multilib-generator.
4871		if test "x${with_multilib_generator}" != xdefault; then
4872			if test "x${with_multilib_list}" != xdefault; then
4873				echo "--with-multilib-list= can't used with --with-multilib-generator= at same time" 1>&2
4874				exit 1
4875			fi
4876			case "${target}" in
4877			riscv*-*-elf*)
4878				if ${srcdir}/config/riscv/multilib-generator \
4879					-misa-spec=${with_isa_spec} \
4880					`echo ${with_multilib_generator} | sed 's/;/ /g'`\
4881					> t-multilib-config;
4882				then
4883					tmake_file="${tmake_file} riscv/t-withmultilib-generator"
4884				else
4885					echo "invalid option for --with-multilib-generator" 1>&2
4886					exit 1
4887				fi
4888				;;
4889			*)
4890				echo "--with-multilib-generator= is not supported for ${target}, only supported for riscv*-*-elf*" 1>&2
4891				exit 1
4892				;;
4893			esac
4894		fi
4895
4896		# Handle --with-multilib-list.
4897		if test "x${with_multilib_list}" != xdefault; then
4898			tmake_file="${tmake_file} riscv/t-withmultilib"
4899
4900			case ${with_multilib_list} in
4901			ilp32 | ilp32f | ilp32d \
4902			| lp64 | lp64f | lp64d )
4903				TM_MULTILIB_CONFIG="${with_arch},${with_multilib_list}"
4904				;;
4905			*)
4906				echo "--with-multilib-list=${with_multilib_list} not supported."
4907				exit 1
4908			esac
4909		fi
4910		;;
4911
4912	mips*-*-*)
4913		supported_defaults="abi arch arch_32 arch_64 float fpu nan fp_32 odd_spreg_32 tune tune_32 tune_64 divide llsc mips-plt synci lxc1-sxc1 madd4"
4914
4915		case ${with_float} in
4916		"" | soft | hard)
4917			# OK
4918			;;
4919		*)
4920			echo "Unknown floating point type used in --with-float=$with_float" 1>&2
4921			exit 1
4922			;;
4923		esac
4924
4925		case ${with_fpu} in
4926		"" | single | double)
4927			# OK
4928			;;
4929		*)
4930			echo "Unknown fpu type used in --with-fpu=$with_fpu" 1>&2
4931			exit 1
4932			;;
4933		esac
4934
4935		case ${with_nan} in
4936		"" | 2008 | legacy)
4937			# OK
4938			;;
4939		*)
4940			echo "Unknown NaN encoding used in --with-nan=$with_nan" 1>&2
4941			exit 1
4942			;;
4943		esac
4944
4945		case ${with_fp_32} in
4946		"" | 32 | xx | 64)
4947			# OK
4948			;;
4949		*)
4950			echo "Unknown FP mode used in --with-fp-32=$with_fp_32" 1>&2
4951			exit 1
4952			;;
4953		esac
4954
4955		case ${with_odd_spreg_32} in
4956		yes)
4957			with_odd_spreg_32="odd-spreg"
4958			;;
4959		no)
4960			with_odd_spreg_32="no-odd-spreg"
4961			;;
4962		"")
4963			# OK
4964			;;
4965		*)
4966			echo "Unknown odd-spreg-32 type used in --with-odd-spreg-32=$with_odd_spreg_32" 1>&2
4967			exit 1
4968			;;
4969		esac
4970
4971		case ${with_abi} in
4972		"" | 32 | o64 | n32 | 64 | eabi)
4973			# OK
4974			;;
4975		*)
4976			echo "Unknown ABI used in --with-abi=$with_abi" 1>&2
4977			exit 1
4978			;;
4979		esac
4980
4981		case ${with_divide} in
4982		"" | breaks | traps)
4983			# OK
4984			;;
4985		*)
4986			echo "Unknown division check type use in --with-divide=$with_divide" 1>&2
4987			exit 1
4988			;;
4989		esac
4990
4991		case ${with_llsc} in
4992		yes)
4993			with_llsc=llsc
4994			;;
4995		no)
4996			with_llsc="no-llsc"
4997			;;
4998		"")
4999			# OK
5000			;;
5001		*)
5002			echo "Unknown llsc type used in --with-llsc" 1>&2
5003			exit 1
5004			;;
5005		esac
5006
5007		case ${with_mips_plt} in
5008		yes)
5009			with_mips_plt=plt
5010			;;
5011		no)
5012			with_mips_plt=no-plt
5013			;;
5014		"")
5015			;;
5016		*)
5017			echo "Unknown --with-mips-plt argument: $with_mips_plt" 1>&2
5018			exit 1
5019			;;
5020		esac
5021
5022		case ${with_synci} in
5023		yes)
5024			with_synci=synci
5025			;;
5026		no)
5027			with_synci=no-synci
5028			;;
5029		"")
5030			;;
5031		*)
5032			echo "Unknown synci type used in --with-synci" 1>&2
5033			exit 1
5034			;;
5035		esac
5036
5037		case ${with_lxc1_sxc1} in
5038		yes)
5039			with_lxc1_sxc1=lxc1-sxc1
5040			;;
5041		no)
5042			with_lxc1_sxc1=no-lxc1-sxc1
5043			;;
5044		"")
5045			;;
5046		*)
5047			echo "Unknown lxc1-sxc1 type used in --with-lxc1-sxc1" 1>&2
5048			exit 1
5049			;;
5050		esac
5051
5052		case ${with_madd4} in
5053		yes)
5054			with_madd4=madd4
5055			;;
5056		no)
5057			with_madd4=no-madd4
5058			;;
5059		"")
5060			;;
5061		*)
5062			echo "Unknown madd4 type used in --with-madd4" 1>&2
5063			exit 1
5064			;;
5065		esac
5066		;;
5067
5068	loongarch*-*-*)
5069		supported_defaults="abi arch tune fpu"
5070
5071		# Local variables
5072		unset \
5073			abi_pattern      abi_default    \
5074			abiext_pattern   abiext_default \
5075			arch_pattern     arch_default   \
5076			fpu_pattern      fpu_default    \
5077			tune_pattern     tune_default   \
5078			triplet_os       triplet_abi
5079
5080		# Infer ABI from the triplet.
5081		case ${target} in
5082		loongarch64-*-*-*f64)
5083			abi_pattern="lp64d"
5084			;;
5085		loongarch64-*-*-*f32)
5086			abi_pattern="lp64f"
5087			;;
5088		loongarch64-*-*-*sf)
5089			abi_pattern="lp64s"
5090			;;
5091		loongarch64-*-*-*)
5092			abi_pattern="lp64[dfs]"
5093			abi_default="lp64d"
5094			;;
5095		*)
5096			echo "Unsupported target ${target}." 1>&2
5097			exit 1
5098			;;
5099		esac
5100
5101		abiext_pattern="*"
5102		abiext_default="base"
5103
5104		# Get the canonical triplet (multiarch specifier).
5105		case ${target} in
5106		  *-linux-gnu*)  triplet_os="linux-gnu";;
5107		  *-linux-musl*) triplet_os="linux-musl";;
5108		  *)
5109			  echo "Unsupported target ${target}." 1>&2
5110			  exit 1
5111			  ;;
5112		esac
5113
5114		# Perform initial sanity checks on --with-* options.
5115		case ${with_arch} in
5116		"" | loongarch64 | la464) ;; # OK, append here.
5117		native)
5118			if test x${host} != x${target}; then
5119				echo "--with-arch=native is illegal for cross-compiler." 1>&2
5120				exit 1
5121			fi
5122			;;
5123		"")
5124			echo "Please set a default value for \${with_arch}" \
5125			     "according to your target triplet \"${target}\"." 1>&2
5126			exit 1
5127			;;
5128		*)
5129			echo "Unknown arch in --with-arch=$with_arch" 1>&2
5130			exit 1
5131			;;
5132		esac
5133
5134		case ${with_abi} in
5135		"" | lp64d | lp64f | lp64s) ;; # OK, append here.
5136		*)
5137			echo "Unsupported ABI given in --with-abi=$with_abi" 1>&2
5138			exit 1
5139			;;
5140		esac
5141
5142		case ${with_abiext} in
5143		"" | base) ;; # OK, append here.
5144		*)
5145			echo "Unsupported ABI extention type $with_abiext" 1>&2
5146			exit 1
5147			;;
5148		esac
5149
5150		case ${with_fpu} in
5151		"" | none | 32 | 64) ;; # OK, append here.
5152		0)
5153			# Convert "0" to "none" for upcoming checks.
5154			with_fpu="none"
5155			;;
5156		*)
5157			echo "Unknown fpu type in --with-fpu=$with_fpu" 1>&2
5158			exit 1
5159			;;
5160		esac
5161
5162
5163		# Set default value for with_abi.
5164		case ${with_abi} in
5165		"")
5166			if test x${abi_default} != x; then
5167				with_abi=${abi_default}
5168			else
5169				with_abi=${abi_pattern}
5170			fi
5171			;;
5172
5173		*)
5174			if echo "${with_abi}" | grep -E "^${abi_pattern}$" > /dev/null; then
5175				: # OK
5176			else
5177				echo "Incompatible options:" \
5178				"--with-abi=${with_abi} and --target=${target}." 1>&2
5179				exit 1
5180			fi
5181			;;
5182		esac
5183
5184		case ${with_abi} in
5185		  "lp64d") triplet_abi="";;
5186		  "lp64f") triplet_abi="f32";;
5187		  "lp64s") triplet_abi="sf";;
5188		esac
5189		la_canonical_triplet="loongarch64-${triplet_os}${triplet_abi}"
5190
5191		# Set default value for with_abiext (internal)
5192		case ${with_abiext} in
5193		"")
5194			if test x${abiext_default} != x; then
5195				with_abiext=${abiext_default}
5196			else
5197				with_abiext=${abiext_pattern}
5198			fi
5199			;;
5200
5201		*)
5202			if echo "${with_abiext}" | grep -E "^${abiext_pattern}$" > /dev/null; then
5203				: # OK
5204			else
5205				echo "The ABI extension type \"${with_abiext}\"" \
5206				"is incompatible with --target=${target}." 1>&2
5207				exit 1
5208			fi
5209
5210			;;
5211		esac
5212
5213		# Infer ISA-related default options from the ABI: pass 1
5214		case ${with_abi}/${with_abiext} in
5215		lp64*/base)
5216			# architectures that support lp64* ABI
5217			arch_pattern="native|loongarch64|la464"
5218			# default architecture for lp64* ABI
5219			arch_default="loongarch64"
5220			;;
5221		*)
5222			echo "Unsupported ABI type ${with_abi}/${with_abiext}." 1>&2
5223			exit 1
5224			;;
5225		esac
5226
5227		# Infer ISA-related default options from the ABI: pass 2
5228		case ${with_abi}/${with_abiext} in
5229		lp64d/base)
5230			fpu_pattern="64"
5231			;;
5232		lp64f/base)
5233			fpu_pattern="32|64"
5234			fpu_default="32"
5235			;;
5236		lp64s/base)
5237			fpu_pattern="none|32|64"
5238			fpu_default="none"
5239			;;
5240		*)
5241			echo "Unsupported ABI type ${with_abi}/${with_abiext}." 1>&2
5242			exit 1
5243			;;
5244		esac
5245
5246		## Set default value for with_arch.
5247		case ${with_arch} in
5248		"")
5249			if test x${arch_default} != x; then
5250				with_arch=${arch_default}
5251			else
5252				with_arch=${arch_pattern}
5253			fi
5254			;;
5255
5256		*)
5257			if echo "${with_arch}" | grep -E "^${arch_pattern}$" > /dev/null; then
5258				: # OK
5259			else
5260				echo "${with_abi}/${with_abiext} ABI cannot be implemented with" \
5261				"--with-arch=${with_arch}." 1>&2
5262				exit 1
5263			fi
5264			;;
5265		esac
5266
5267		## Set default value for with_fpu.
5268		case ${with_fpu} in
5269		"")
5270			if test x${fpu_default} != x; then
5271				with_fpu=${fpu_default}
5272			else
5273				with_fpu=${fpu_pattern}
5274			fi
5275			;;
5276
5277		*)
5278			if echo "${with_fpu}" | grep -E "^${fpu_pattern}$" > /dev/null; then
5279				: # OK
5280			else
5281				echo "${with_abi}/${with_abiext} ABI cannot be implemented with" \
5282				"--with-fpu=${with_fpu}." 1>&2
5283				exit 1
5284			fi
5285			;;
5286		esac
5287
5288
5289		# Infer default with_tune from with_arch: pass 1
5290		case ${with_arch} in
5291		native)
5292			tune_pattern="*"
5293			tune_default="native"
5294			;;
5295		loongarch64)
5296			tune_pattern="loongarch64|la464"
5297			tune_default="la464"
5298			;;
5299		*)
5300			# By default, $with_tune == $with_arch
5301			tune_pattern="$with_arch"
5302			;;
5303		esac
5304
5305		## Set default value for with_tune.
5306		case ${with_tune} in
5307		"")
5308			if test x${tune_default} != x; then
5309				with_tune=${tune_default}
5310			else
5311				with_tune=${tune_pattern}
5312			fi
5313			;;
5314
5315		*)
5316			if echo "${with_tune}" | grep -E "^${tune_pattern}$" > /dev/null; then
5317				: # OK
5318			else
5319				echo "Incompatible options: --with-tune=${with_tune}" \
5320				"and --with-arch=${with_arch}." 1>&2
5321				exit 1
5322			fi
5323			;;
5324		esac
5325
5326		# Handle --with-multilib-list.
5327		if test x"${with_multilib_list}" = x \
5328		   || test x"${with_multilib_list}" = xno \
5329		   || test x"${with_multilib_list}" = xdefault \
5330		   || test x"${enable_multilib}" != xyes; then
5331
5332			with_multilib_list="${with_abi}/${with_abiext}"
5333		fi
5334
5335		# Check if the configured default ABI combination is included in
5336		# ${with_multilib_list}.
5337		loongarch_multilib_list_sane=no
5338
5339		# This one goes to TM_MULTILIB_CONFIG, for use in t-linux.
5340		loongarch_multilib_list_make=""
5341
5342		# This one goes to tm_defines, for use in loongarch-driver.c.
5343		loongarch_multilib_list_c=""
5344
5345		# ${with_multilib_list} should not contain whitespaces,
5346		# consecutive commas or slashes.
5347		if echo "${with_multilib_list}" \
5348		| grep -E -e "[[:space:]]" -e '[,/][,/]' -e '[,/]$' -e '^[,/]' > /dev/null; then
5349			echo "Invalid argument to --with-multilib-list." 1>&2
5350			exit 1
5351		fi
5352
5353		unset component idx elem_abi_base elem_abi_ext elem_tmp
5354		for elem in $(echo "${with_multilib_list}" | tr ',' ' '); do
5355			idx=0
5356			while true; do
5357				idx=$((idx + 1))
5358				component=$(echo "${elem}" | awk -F'/' '{print $'"${idx}"'}')
5359
5360				case ${idx} in
5361				1)
5362					# Component 1: Base ABI type
5363					case ${component} in
5364					lp64d) elem_tmp="ABI_BASE_LP64D,";;
5365					lp64f) elem_tmp="ABI_BASE_LP64F,";;
5366					lp64s) elem_tmp="ABI_BASE_LP64S,";;
5367					*)
5368						echo "Unknown base ABI \"${component}\" in --with-multilib-list." 1>&2
5369						exit 1
5370						;;
5371					esac
5372					loongarch_multilib_list_c="${loongarch_multilib_list_c}${elem_tmp}"
5373					loongarch_multilib_list_make="${loongarch_multilib_list_make}mabi=${component}"
5374					elem_abi_base="${component}"
5375					;;
5376
5377				2)
5378					# Component 2: ABI extension type
5379					case ${component} in
5380					"" | base)
5381						component="base"
5382						elem_tmp="ABI_EXT_BASE,"
5383						;;
5384					*)
5385						echo "Unknown ABI extension \"${component}\" in --with-multilib-list." 1>&2
5386						exit 1
5387						;;
5388					esac
5389					loongarch_multilib_list_c="${loongarch_multilib_list_c}${elem_tmp}"
5390					loongarch_multilib_list_make="${loongarch_multilib_list_make}" # Add nothing for now.
5391					elem_abi_ext="${component}"
5392					;;
5393
5394				*)
5395					# Component 3 and on: optional stuff
5396					case ${component} in
5397					"")
5398						# End of component list.
5399						break
5400						;;
5401					*)
5402						echo "Unknown ABI \"${elem}\" in --with-multilib-list." 1>&2
5403						exit 1
5404						;;
5405					esac
5406					;;
5407				esac
5408			done
5409
5410			if test x${elem_abi_base} = x${with_abi} \
5411			&& test x${elem_abi_ext} = x${with_abiext}; then
5412				loongarch_multilib_list_sane=yes
5413			fi
5414			loongarch_multilib_list_make="${loongarch_multilib_list_make},"
5415		done
5416
5417		# Check if the default ABI combination is in the default list.
5418		if test x${loongarch_multilib_list_sane} = xno; then
5419			if test x${with_abiext} = xbase; then
5420				with_abiext=""
5421			else
5422				with_abiext="/${with_abiext}"
5423			fi
5424
5425			echo "Default ABI combination (${with_abi}${with_abiext})" \
5426			"not found in --with-multilib-list." 1>&2
5427			exit 1
5428		fi
5429
5430		# Remove the excessive appending comma.
5431		loongarch_multilib_list_c=${loongarch_multilib_list_c%,}
5432		loongarch_multilib_list_make=${loongarch_multilib_list_make%,}
5433		;;
5434
5435	nds32*-*-*)
5436		supported_defaults="arch cpu nds32_lib float fpu_config"
5437
5438		# process --with-arch
5439		case "${with_arch}" in
5440		"" | v3 )
5441			tm_defines="${tm_defines} TARGET_ARCH_DEFAULT=0"
5442			;;
5443		v2 | v2j | v3m)
5444			# OK
5445			tm_defines="${tm_defines} TARGET_ARCH_DEFAULT=0"
5446			;;
5447		v3f)
5448			tm_defines="${tm_defines} TARGET_ARCH_DEFAULT=1"
5449			;;
5450		v3s)
5451			tm_defines="${tm_defines} TARGET_ARCH_DEFAULT=2"
5452
5453			;;
5454		*)
5455			echo "Cannot accept --with-arch=$with_arch, available values are: v2 v2j v3 v3m v3f v3s" 1>&2
5456			exit 1
5457			;;
5458		esac
5459
5460		case "${with_cpu}" in
5461		"")
5462			with_cpu=n9
5463			;;
5464		n6 | n7 |n8 | e8 | s8 | n9 | n10 | d10 | n12 | n13 | n15)
5465			# OK
5466			;;
5467		*)
5468			echo "Cannot accept --with-cpu=$with_cpu, available values are: n6 n7 n8 e8 s8 n9 n10 d10 n12 n13 n15" 1>&2
5469			exit 1
5470			;;
5471		esac
5472
5473		# process --with-nds32-lib
5474		case "${with_nds32_lib}" in
5475		"")
5476			case ${target} in
5477			*-*-*uclibc*)
5478				with_nds32_lib=ulibc
5479				;;
5480			*-*-linux*)
5481				with_nds32_lib=glibc
5482				;;
5483			*)
5484				with_nds32_lib=newlib
5485				tm_defines="${tm_defines} TARGET_DEFAULT_CTOR_DTOR=1"
5486				;;
5487			esac
5488			;;
5489		newlib)
5490			# OK
5491			tm_defines="${tm_defines} TARGET_DEFAULT_CTOR_DTOR=1"
5492			;;
5493		mculib)
5494			# OK
5495			# for the arch=v3f or arch=v3s under mculib toolchain,
5496			# we would like to set -fno-math-errno as default
5497			case "${with_arch}" in
5498			v3f | v3s)
5499				tm_defines="${tm_defines} TARGET_DEFAULT_NO_MATH_ERRNO=1"
5500				;;
5501			esac
5502			;;
5503		glibc | uclibc)
5504			# OK
5505			;;
5506		*)
5507			echo "Cannot accept --with-nds32-lib=$with_nds32_lib, available values are: newlib mculib glibc uclibc" 1>&2
5508			exit 1
5509			;;
5510		esac
5511
5512		# process --with-float
5513		case "${with_float}" in
5514		"" | soft | hard)
5515			# OK
5516			;;
5517		*)
5518			echo "Cannot accept --with-float=$with_float, available values are: soft hard" 1>&2
5519			exit 1
5520			;;
5521		esac
5522
5523		# process --with-config-fpu
5524		case "${with_config_fpu}" in
5525		"" | 0 | 1 | 2 | 3)
5526			# OK
5527			;;
5528		*)
5529			echo "Cannot accept --with-config-fpu=$with_config_fpu, available values from 0 to 7" 1>&2
5530			exit 1
5531			;;
5532		esac
5533
5534
5535		;;
5536	nios2*-*-*)
5537		supported_defaults="arch"
5538			case "$with_arch" in
5539			"" | r1 | r2)
5540				# OK
5541				;;
5542			*)
5543				echo "Unknown arch used in --with-arch=$with_arch" 1>&2
5544				exit 1
5545				;;
5546			esac
5547		;;
5548
5549	powerpc*-*-* | rs6000-*-*)
5550		supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64 advance_toolchain"
5551
5552		for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
5553			eval "val=\$with_$which"
5554			case ${val} in
5555			default32 | default64)
5556				case $which in
5557				cpu | tune)
5558					;;
5559				*)
5560					echo "$val only valid for --with-cpu and --with-tune." 1>&2
5561					exit 1
5562					;;
5563				esac
5564				with_which="with_$which"
5565				eval $with_which=
5566				;;
5567			405cr)
5568				tm_defines="${tm_defines} CONFIG_PPC405CR"
5569				eval "with_$which=405"
5570				;;
5571			"" | common | native \
5572			| power[3456789] | power10 | power5+ | power6x \
5573			| powerpc | powerpc64 | powerpc64le \
5574			| rs64 \
5575			| 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
5576			| 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
5577			| 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
5578			| a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \
5579			| titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)
5580				# OK
5581				;;
5582			*)
5583				echo "Unknown cpu used in --with-$which=$val." 1>&2
5584				exit 1
5585				;;
5586			esac
5587		done
5588
5589		case "$with_abi" in
5590		"" | elfv1 | elfv2 )
5591			#OK
5592			;;
5593		*)
5594			echo "Unknown ABI used in --with-abi=$with_abi"
5595			exit 1
5596			;;
5597		esac
5598
5599		if test "x$with_advance_toolchain" != x; then
5600		    if test -d "/opt/$with_advance_toolchain/." -a \
5601			-d "/opt/$with_advance_toolchain/bin/." -a \
5602			-d "/opt/$with_advance_toolchain/include/."; then
5603
5604			tm_file="$tm_file ./advance-toolchain.h"
5605			(at="/opt/$with_advance_toolchain"
5606			 echo "/* Use Advance Toolchain $at */"
5607			 echo
5608			 echo "#undef  LINK_OS_NEW_DTAGS_SPEC"
5609			 echo "#define LINK_OS_NEW_DTAGS_SPEC" \
5610			      "\"--enable-new-dtags\""
5611			 echo
5612			 echo "#undef  DYNAMIC_LINKER_PREFIX"
5613			 echo "#define DYNAMIC_LINKER_PREFIX \"$at\""
5614			 echo
5615			 echo "#undef  MD_EXEC_PREFIX"
5616			 echo "#define MD_EXEC_PREFIX \"$at/bin/\""
5617			 echo
5618			 echo "#undef  MD_STARTFILE_PREFIX"
5619			 echo "#define MD_STARTFILE_PREFIX \"$prefix/lib/\""
5620			 echo
5621			 echo "#undef  MD_STARTFILE_PREFIX_1"
5622			 echo "#define MD_STARTFILE_PREFIX_1 \"$at/lib/\"") \
5623			    > advance-toolchain.h
5624		    else
5625			echo "Unknown advance-toolchain $with_advance_toolchain"
5626			exit 1
5627		    fi
5628		fi
5629
5630		# Set up the default long double format if the user changed it.
5631		if test x$with_long_double_format = xieee; then
5632		    tm_defines="${tm_defines} TARGET_IEEEQUAD_DEFAULT=1"
5633
5634		elif test x$with_long_double_format = xibm; then
5635		    tm_defines="${tm_defines} TARGET_IEEEQUAD_DEFAULT=0"
5636		fi
5637		;;
5638
5639	s390*-*-*)
5640		supported_defaults="arch mode tune"
5641
5642		for which in arch tune; do
5643			eval "val=\$with_$which"
5644			case ${val} in
5645			"" | native | z900 | z990 | z9-109 | z9-ec | z10 | z196 | zEC12 | z13 | z14 | z15 | z16 | arch5 | arch6 | arch7 | arch8 | arch9 | arch10 | arch11 | arch12 | arch13 | arch14 )
5646				# OK
5647				;;
5648			*)
5649				echo "Unknown cpu used in --with-$which=$val." 1>&2
5650				exit 1
5651				;;
5652			esac
5653		done
5654
5655		case ${with_mode} in
5656		"" | esa | zarch)
5657			# OK
5658			;;
5659		*)
5660			echo "Unknown architecture mode used in --with-mode=$with_mode." 1>&2
5661			exit 1
5662			;;
5663		esac
5664		;;
5665
5666	sh[123456ble]*-*-* | sh-*-*)
5667		supported_defaults="cpu"
5668		case "`echo $with_cpu | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ_ abcdefghijklmnopqrstuvwxyz- | sed s/sh/m/`" in
5669		"" | m1 | m2 | m2e | m3 | m3e | m4 | m4-single | m4-single-only | m4-nofpu )
5670			# OK
5671			;;
5672		m2a | m2a-single | m2a-single-only | m2a-nofpu)
5673			;;
5674		m4a | m4a-single | m4a-single-only | m4a-nofpu | m4al)
5675		        ;;
5676		*)
5677			echo "Unknown CPU used in --with-cpu=$with_cpu, known values:"  1>&2
5678			echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
5679			echo "m4a m4a-single m4a-single-only m4a-nofpu m4al" 1>&2
5680			echo "m2a m2a-single m2a-single-only m2a-nofpu" 1>&2
5681			exit 1
5682			;;
5683		esac
5684		;;
5685	sparc*-*-*)
5686		supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
5687
5688		for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
5689			eval "val=\$with_$which"
5690			case ${val} in
5691			"" | sparc | sparcv9 | sparc64 \
5692			| v7 | cypress \
5693			| v8 | supersparc | hypersparc | leon | leon3 | leon3v7 \
5694			| sparclite | f930 | f934 | sparclite86x \
5695			| sparclet | tsc701 \
5696			| v9 | ultrasparc | ultrasparc3 | niagara | niagara2 \
5697			| niagara3 | niagara4 | niagara7 | m8)
5698				# OK
5699				;;
5700			*)
5701				echo "Unknown cpu used in --with-$which=$val" 1>&2
5702				exit 1
5703				;;
5704			esac
5705		done
5706
5707		case ${with_float} in
5708		"" | soft | hard)
5709			# OK
5710			;;
5711		*)
5712			echo "Unknown floating point type used in --with-float=$with_float" 1>&2
5713			exit 1
5714			;;
5715		esac
5716		;;
5717
5718	tic6x-*-*)
5719		supported_defaults="arch"
5720
5721		case ${with_arch} in
5722		"" | c62x | c64x | c64x+ | c67x | c67x+ | c674x)
5723			# OK
5724			;;
5725		*)
5726			echo "Unknown arch used in --with-arch=$with_arch." 1>&2
5727			exit 1
5728			;;
5729		esac
5730		;;
5731
5732	v850*-*-*)
5733		supported_defaults=cpu
5734		case ${with_cpu} in
5735		"" | v850e | v850e1 | v850e2 | v850es | v850e2v3 | v850e3v5)
5736			# OK
5737			;;
5738		*)
5739			echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
5740			exit 1
5741			;;
5742		esac
5743		;;
5744	visium-*-*)
5745		supported_defaults="cpu"
5746		case $with_cpu in
5747		  "" | gr5 | gr6)
5748			;;
5749		  *)    echo "Unknown cpu used in --with-cpu=$with_cpu" 1>&2
5750			exit 1
5751			;;
5752		esac
5753		;;
5754esac
5755
5756# Targets for which there is at least one VxWorks port should include
5757# vxworks-dummy.h to allow safe references to various TARGET_VXWORKS kinds
5758# of markers from other files in the port, including the vxworks*.h files to
5759# distinguish VxWorks variants such as VxWorks 7 or 64).
5760
5761case ${target} in
5762arm*-*-* | i[34567]86-*-* | mips*-*-* | powerpc*-*-* | sh*-*-* \
5763| sparc*-*-* | x86_64-*-*)
5764	tm_file="vxworks-dummy.h ${tm_file}"
5765	;;
5766esac
5767
5768# Set some miscellaneous flags for particular targets.
5769target_cpu_default2=
5770case ${target} in
5771	aarch64*-*-*)
5772		if test x"$target_cpu_cname" != x
5773		then
5774			target_cpu_default2=$target_cpu_cname
5775		fi
5776		;;
5777
5778	arm*-*-*)
5779		if test x$with_cpu = x
5780		then
5781			echo "Don't know the target cpu" 1>&2
5782			exit 1
5783		else
5784			target_cpu_default2="\\\"$with_cpu\\\""
5785		fi
5786		;;
5787
5788	hppa*-*-*)
5789		if test x$gas = xyes
5790		then
5791			target_cpu_default2="MASK_GAS"
5792		fi
5793		;;
5794
5795	fido*-*-* | m68k*-*-*)
5796		target_cpu_default2=$m68k_cpu_ident
5797		tmake_file="m68k/t-opts $tmake_file"
5798		if [ x"$m68k_arch_family" != x ]; then
5799		        tmake_file="m68k/t-$m68k_arch_family $tmake_file"
5800		fi
5801		;;
5802
5803	i[34567]86-*-darwin* | x86_64-*-darwin*)
5804		;;
5805	i[34567]86-*-linux* | x86_64-*-linux*)
5806		extra_objs="${extra_objs} gnu-property.o"
5807		tmake_file="$tmake_file i386/t-linux i386/t-gnu-property"
5808		;;
5809	i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu)
5810		tmake_file="$tmake_file i386/t-kfreebsd"
5811		;;
5812	i[34567]86-*-gnu*)
5813		tmake_file="$tmake_file i386/t-gnu"
5814		;;
5815	i[34567]86-*-msdosdjgpp*)
5816		tmake_file="${tmake_file} i386/t-djgpp"
5817		;;
5818	i[34567]86-*-solaris2* | x86_64-*-solaris2*)
5819		;;
5820	i[34567]86-*-cygwin* | x86_64-*-cygwin*)
5821		;;
5822	i[34567]86-*-mingw* | x86_64-*-mingw*)
5823		;;
5824	i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
5825		;;
5826	i[34567]86-*-freebsd*)
5827		;;
5828	x86_64-*-freebsd*)
5829		tmake_file="${tmake_file} i386/t-freebsd64"
5830		;;
5831	ia64*-*-linux*)
5832		;;
5833
5834	mips*-*-*)
5835		if test x$gnu_ld = xyes
5836		then
5837			target_cpu_default2="MASK_SPLIT_ADDRESSES"
5838		fi
5839		case ${target} in
5840			mips*el-*-*)
5841				tm_defines="TARGET_ENDIAN_DEFAULT=0 $tm_defines"
5842				;;
5843		esac
5844		if test x$with_arch != x; then
5845			default_mips_arch=$with_arch
5846		fi
5847		if test x$with_abi != x; then
5848			default_mips_abi=$with_abi
5849		fi
5850		case ${default_mips_arch} in
5851		    mips1)    tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS1" ;;
5852		    mips2)    tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS2" ;;
5853		    mips3)    tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS3" ;;
5854		    mips4)    tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS4" ;;
5855		    mips32)   tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32" ;;
5856		    mips32r2) tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R2" ;;
5857		    mips32r6) tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS32R6" ;;
5858		    mips64)   tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64" ;;
5859		    mips64r2) tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R2" ;;
5860		    mips64r6) tm_defines="$tm_defines MIPS_ISA_DEFAULT=MIPS_ISA_MIPS64R6" ;;
5861		esac
5862		case ${default_mips_abi} in
5863		    32)   tm_defines="$tm_defines MIPS_ABI_DEFAULT=ABI_32" ;;
5864		    o64)  tm_defines="$tm_defines MIPS_ABI_DEFAULT=ABI_O64" ;;
5865		    n32)  tm_defines="$tm_defines MIPS_ABI_DEFAULT=ABI_N32" ;;
5866		    64)   tm_defines="$tm_defines MIPS_ABI_DEFAULT=ABI_64" ;;
5867		    eabi) tm_defines="$tm_defines MIPS_ABI_DEFAULT=ABI_EABI" ;;
5868		esac
5869		tmake_file="mips/t-mips $tmake_file"
5870		;;
5871
5872	loongarch*-*-*)
5873		# Export canonical triplet.
5874		tm_defines="${tm_defines} LA_MULTIARCH_TRIPLET=${la_canonical_triplet}"
5875
5876		# Define macro LA_DISABLE_MULTILIB if --disable-multilib
5877		tm_defines="${tm_defines} TM_MULTILIB_LIST=${loongarch_multilib_list_c}"
5878		if test x$enable_multilib = xyes; then
5879			TM_MULTILIB_CONFIG="${loongarch_multilib_list_make}"
5880		else
5881			tm_defines="${tm_defines} LA_DISABLE_MULTILIB"
5882		fi
5883
5884		# Let --with- flags initialize the enum variables from loongarch.opt.
5885		# See macro definitions from loongarch-opts.h and loongarch-cpu.h.
5886		case ${with_arch} in
5887		native)		tm_defines="${tm_defines} DEFAULT_CPU_ARCH=CPU_NATIVE" ;;
5888		la464)		tm_defines="${tm_defines} DEFAULT_CPU_ARCH=CPU_LA464" ;;
5889		loongarch64)	tm_defines="${tm_defines} DEFAULT_CPU_ARCH=CPU_LOONGARCH64" ;;
5890		esac
5891
5892		case ${with_tune} in
5893		native)		tm_defines="${tm_defines} DEFAULT_CPU_TUNE=CPU_NATIVE" ;;
5894		la464)		tm_defines="${tm_defines} DEFAULT_CPU_TUNE=CPU_LA464" ;;
5895		loongarch64)	tm_defines="${tm_defines} DEFAULT_CPU_TUNE=CPU_LOONGARCH64" ;;
5896		esac
5897
5898		case ${with_abi} in
5899		lp64d)     tm_defines="${tm_defines} DEFAULT_ABI_BASE=ABI_BASE_LP64D" ;;
5900		lp64f)     tm_defines="${tm_defines} DEFAULT_ABI_BASE=ABI_BASE_LP64F" ;;
5901		lp64s)     tm_defines="${tm_defines} DEFAULT_ABI_BASE=ABI_BASE_LP64S" ;;
5902		esac
5903
5904		case ${with_abiext} in
5905		base)      tm_defines="${tm_defines} DEFAULT_ABI_EXT=ABI_EXT_BASE" ;;
5906		esac
5907
5908		case ${with_fpu} in
5909		none)    tm_defines="$tm_defines DEFAULT_ISA_EXT_FPU=ISA_EXT_NOFPU" ;;
5910		32)      tm_defines="$tm_defines DEFAULT_ISA_EXT_FPU=ISA_EXT_FPU32" ;;
5911		64)      tm_defines="$tm_defines DEFAULT_ISA_EXT_FPU=ISA_EXT_FPU64" ;;
5912		esac
5913
5914		tmake_file="loongarch/t-loongarch $tmake_file"
5915		;;
5916
5917	powerpc*-*-* | rs6000-*-*)
5918		# FIXME: The PowerPC port uses the value set at compile time,
5919		# although it's only cosmetic.
5920		if test "x$with_cpu" != x
5921		then
5922			target_cpu_default2="\\\"$with_cpu\\\""
5923		fi
5924		out_file="${cpu_type}/${cpu_type}.cc"
5925		c_target_objs="${c_target_objs} ${cpu_type}-c.o"
5926		cxx_target_objs="${cxx_target_objs} ${cpu_type}-c.o"
5927		d_target_objs="${d_target_objs} ${cpu_type}-d.o"
5928		tmake_file="${cpu_type}/t-${cpu_type} ${tmake_file}"
5929		;;
5930
5931	sh[123456ble]*-*-* | sh-*-*)
5932		c_target_objs="${c_target_objs} sh-c.o"
5933		cxx_target_objs="${cxx_target_objs} sh-c.o"
5934		;;
5935
5936	sparc*-*-*)
5937		# Some standard aliases.
5938		case x$with_cpu in
5939		xsparc)
5940			with_cpu=v7
5941			;;
5942		xsparcv9 | xsparc64)
5943			with_cpu=v9
5944			;;
5945		esac
5946
5947		if test x$with_tune = x ; then
5948		      case ${target} in
5949		      *-leon-*)
5950			  with_tune=leon
5951			  ;;
5952		      *-leon[3-9]*)
5953			  with_tune=leon3
5954			  ;;
5955		      esac
5956		fi
5957
5958		# The SPARC port checks this value at compile-time.
5959		target_cpu_default2="TARGET_CPU_$with_cpu"
5960		;;
5961
5962	v850*-*-*)
5963		case "x$with_cpu" in
5964		x)
5965			;;
5966		xv850e | xv850e1 | xv850e2 | xv850e2v3 | xv850e3v5)
5967			target_cpu_default2="TARGET_CPU_$with_cpu"
5968			;;
5969		xv850es)
5970			target_cpu_default2="TARGET_CPU_v850e1"
5971			;;
5972		esac
5973		;;
5974	visium-*-*)
5975		target_cpu_default2="TARGET_CPU_$with_cpu"
5976		;;
5977esac
5978
5979t=
5980all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu nan fp_32 odd_spreg_32 divide llsc mips-plt synci tls lxc1-sxc1 madd4 isa_spec"
5981for option in $all_defaults
5982do
5983	eval "val=\$with_"`echo $option | sed s/-/_/g`
5984	if test -n "$val"; then
5985		case " $supported_defaults " in
5986		*" $option "*)
5987			;;
5988		*)
5989			echo "This target does not support --with-$option." 2>&1
5990			echo "Valid --with options are: $supported_defaults" 2>&1
5991			exit 1
5992			;;
5993		esac
5994
5995		if test "x$t" = x
5996		then
5997			t="{ \"$option\", \"$val\" }"
5998		else
5999			t="${t}, { \"$option\", \"$val\" }"
6000		fi
6001	fi
6002done
6003
6004if test "x$t" = x
6005then
6006	configure_default_options="{ { NULL, NULL} }"
6007else
6008	configure_default_options="{ ${t} }"
6009fi
6010
6011if test "$target_cpu_default2" != ""
6012then
6013	if test "$target_cpu_default" != ""
6014	then
6015		target_cpu_default="(${target_cpu_default}|${target_cpu_default2})"
6016	else
6017		target_cpu_default=$target_cpu_default2
6018	fi
6019fi
6020
6021case ${target} in
6022i[34567]86-*-* | x86_64-*-*)
6023	if test x$enable_as_accelerator = xyes; then
6024		extra_programs="mkoffload\$(exeext)"
6025	fi
6026	;;
6027esac
6028