1# gas target specific configuration file.  This is a -*- sh -*- file.
2#
3#   Copyright (C) 2012-2022 Free Software Foundation, Inc.
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
9# 
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14# 
15# You should have received a copy of the GNU General Public License
16# along with this program; see the file COPYING3.  If not see
17# <http://www.gnu.org/licenses/>.
18#
19
20# This is invoked by configure.  Putting it in a separate shell file
21# lets us skip running autoconf when modifying target specific
22# information.
23
24# Input shell variables:
25#   targ	a configuration target name, such as i686-pc-linux-gnu.
26
27# Output shell variables:
28#   cpu_type	canonical gas cpu type; identifies the config/tc-* files
29#   fmt		output format; identifies the config/obj-* files
30#   em		emulation; identifies the config/te-* files
31
32# Optional output shell variables; these are not always set:
33#   arch	the default architecture; sets DEFAULT_ARCH on some systems
34#   endian	"big" or "little"; used on bi-endian systems
35
36cpu_type=
37fmt=
38em=generic
39bfd_gas=no
40arch=
41endian=
42
43eval `echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'`
44
45# Check for architecture variants.  Set cpu_type and, optionally,
46# endian and arch.
47# Note: This table is alpha-sorted, please try to keep it that way.
48case ${cpu} in
49  aarch64)		cpu_type=aarch64 endian=little arch=aarch64;;
50  aarch64_be)		cpu_type=aarch64 endian=big arch=aarch64;;
51  alpha*)		cpu_type=alpha ;;
52  am33_2.0)		cpu_type=mn10300 endian=little ;;
53  arc*eb)		cpu_type=arc endian=big ;;
54  arm*be|arm*b)		cpu_type=arm endian=big ;;
55  arm*)			cpu_type=arm endian=little ;;
56  bfin*)		cpu_type=bfin endian=little ;;
57  c4x*)			cpu_type=tic4x ;;
58  cr16*)		cpu_type=cr16 endian=little ;;
59  crisv32)		cpu_type=cris arch=crisv32 ;;
60  crx*)			cpu_type=crx endian=little ;;
61  epiphany*)		cpu_type=epiphany endian=little ;;
62  fido)			cpu_type=m68k ;;
63  hppa*)		cpu_type=hppa ;;
64  i[3-7]86)		cpu_type=i386 arch=i386;;
65  ia16)			cpu_type=i386 arch=i386;;
66  ia64)			cpu_type=ia64 ;;
67  ip2k)			cpu_type=ip2k endian=big ;;
68  iq2000)		cpu_type=iq2000 endian=big ;;
69  lm32)			cpu_type=lm32 ;;
70  loongarch32)		cpu_type=loongarch arch=loongarch32;;
71  loongarch64)		cpu_type=loongarch arch=loongarch64;;
72  m32c)			cpu_type=m32c endian=little ;;
73  m32r)			cpu_type=m32r endian=big ;;
74  m32rle)		cpu_type=m32r endian=little ;;
75  m5200|m5407)		cpu_type=m68k ;;
76  m68008)		cpu_type=m68k ;;
77  m680[012346]0)	cpu_type=m68k ;;
78  m6811|m6812|m68hc12)	cpu_type=m68hc11 ;;
79  m683??)		cpu_type=m68k ;;
80  s12z)               cpu_type=s12z ;;
81  mep)			cpu_type=mep endian=little ;;
82  microblazeel*)	cpu_type=microblaze endian=little;;
83  microblaze*)		cpu_type=microblaze endian=big;;
84  mips*el)		cpu_type=mips endian=little ;;
85  mips*)		cpu_type=mips endian=big ;;
86  mt)			cpu_type=mt endian=big ;;
87  nds32be)		cpu_type=nds32 endian=big ;;
88  nds32le)		cpu_type=nds32 endian=little ;;
89  or1k* | or1knd*)	cpu_type=or1k endian=big ;;
90  pjl*)			cpu_type=pj endian=little ;;
91  pj*)			cpu_type=pj endian=big ;;
92  powerpc*le*)		cpu_type=ppc endian=little ;;
93  powerpc*)		cpu_type=ppc endian=big ;;
94  riscv64be*)		cpu_type=riscv endian=big arch=riscv64 ;;
95  riscv64*)		cpu_type=riscv endian=little arch=riscv64 ;;
96  riscv32be*|riscvbe*)	cpu_type=riscv endian=big arch=riscv32 ;;
97  riscv32* | riscv*)	cpu_type=riscv endian=little arch=riscv32 ;;
98  rs6000*)		cpu_type=ppc ;;
99  rl78*)		cpu_type=rl78 ;;
100  rx)			cpu_type=rx ;;
101  s390x*)		cpu_type=s390 arch=s390x ;;
102  s390*)		cpu_type=s390 arch=s390 ;;
103  score*l)		cpu_type=score endian=little ;;
104  score*)		cpu_type=score endian=big ;;
105  sh*le)		cpu_type=sh endian=little ;;
106  sh*)			cpu_type=sh endian=big ;;
107  sparc64* | sparcv9*)	cpu_type=sparc arch=v9-64 ;;
108  sparc86x*)		cpu_type=sparc arch=sparc86x  ;;
109  sparclet*)		cpu_type=sparc arch=sparclet ;;
110  sparclite*)		cpu_type=sparc arch=sparclite ;;
111  sparc*)		cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
112  tilegx*be)		cpu_type=tilegx endian=big ;;
113  tilegx*)		cpu_type=tilegx endian=little ;;
114  v850*)		cpu_type=v850 ;;
115  visium)		cpu_type=visium endian=big ;;
116  wasm32)               cpu_type=wasm32 endian=little ;;
117  x86_64*)		cpu_type=i386 arch=x86_64;;
118  xgate)		cpu_type=xgate ;;
119  xtensa*)		cpu_type=xtensa arch=xtensa ;;
120  *)			cpu_type=${cpu} ;;
121esac
122
123
124# Assign object format.  Set fmt, em, and bfd_gas.
125generic_target=${cpu_type}-$vendor-$os
126# Note: This table is alpha-sorted, please try to keep it that way.
127case ${generic_target} in
128  aarch64*-*-elf*)			fmt=elf;;
129  aarch64*-*-fuchsia*)			fmt=elf;;
130  aarch64*-*-haiku*)			fmt=elf em=haiku ;;
131  aarch64*-*-genode*)			fmt=elf;;
132  aarch64*-*-linux*)			fmt=elf em=linux
133    case ${cpu}-${os} in
134      aarch64*-linux-gnu_ilp32)		arch=aarch64:32 ;;
135    esac ;;
136  aarch64*-*-netbsd*)			fmt=elf em=nbsd;;
137
138  alpha-*-*vms*)			fmt=evax ;;
139  alpha-*-osf*)				fmt=ecoff ;;
140  alpha-*-linux*ecoff*)			fmt=ecoff ;;
141  alpha-*-linux-*)			fmt=elf em=linux ;;
142  alpha-*-netbsd* | alpha-*-openbsd*)	fmt=elf em=nbsd ;;
143
144  arc-*-elf*)				fmt=elf ;;
145  arc*-*-linux*)			fmt=elf bfd_gas=yes ;;
146
147  arm-*-phoenix*)			fmt=elf ;;
148  arm-*-elf)				fmt=elf ;;
149  arm-*-eabi* | arm-*-rtems* | arm-*-genode*)	fmt=elf em=armeabi ;;
150  arm-*-kaos*)				fmt=elf ;;
151  arm-*-conix*)				fmt=elf ;;
152  arm-*-freebsd[89].* | armeb-*-freebsd[89].*)
153					fmt=elf  em=freebsd ;;
154  arm-*-freebsd* | armeb-*-freebsd*)	fmt=elf  em=armfbsdeabi ;;
155  arm*-*-freebsd*)			fmt=elf  em=armfbsdvfp ;;
156  arm-*-linux-*eabi*)			fmt=elf  em=armlinuxeabi ;;
157  arm-*-linux-*)			fmt=elf  em=linux ;;
158  arm-*-uclinux*eabi*)			fmt=elf  em=armlinuxeabi ;;
159  arm-*-uclinux*)			fmt=elf  em=linux ;;
160  arm-*-nacl*)				fmt=elf  em=nacl ;;
161  arm-*-netbsd*)			fmt=elf  em=nbsd ;;
162  arm-*-nto*)				fmt=elf ;;
163  arm-wince-pe | arm-*-wince | arm*-*-mingw32ce* | arm*-*-cegcc*)
164					fmt=coff em=wince-pe ;;
165  arm-*-pe)				fmt=coff em=pe ;;
166  arm-*-fuchsia*)			fmt=elf ;;
167  arm-*-haiku*)				fmt=elf em=haiku ;;
168
169  avr-*-*)				fmt=elf bfd_gas=yes ;;
170
171  bfin-*-linux-uclibc)			fmt=fdpicelf em=linux ;;
172  bfin-*-uclinux*)			fmt=elf em=linux ;;
173  bfin-*elf)				fmt=elf ;;
174
175  cr16-*-elf*)				fmt=elf ;;
176
177  cris-*-linux-* | crisv32-*-linux-*)
178					fmt=multi em=linux ;;
179  cris-*-* | crisv32-*-*)		fmt=multi ;;
180
181  crx-*-elf*)				fmt=elf ;;
182
183  csky-*-elf*abiv1)			fmt=elf em=csky_abiv1 ;;
184  csky-*-elf*)				fmt=elf em=csky_abiv2 ;;
185  csky-*-linux*abiv1)			fmt=elf em=csky_abiv1_linux ;;
186  csky-*-linux*)			fmt=elf em=csky_abiv2_linux ;;
187
188  d10v-*-*)				fmt=elf ;;
189  d30v-*-*)				fmt=elf ;;
190  dlx-*-*)				fmt=elf ;;
191
192  bpf-*-*)				fmt=elf ;;
193  epiphany-*-*)				fmt=elf ;;
194
195  fr30-*-*)				fmt=elf ;;
196  frv-*-*linux*)			fmt=elf em=linux;;
197  frv-*-*)				fmt=elf ;;
198
199  ft32-*-*)				fmt=elf ;;
200
201  hppa-*-linux*)
202    case ${cpu} in
203      hppa*64*)				fmt=elf em=hppalinux64 ;;
204      hppa*)				fmt=elf em=linux ;;
205    esac ;;
206  hppa-*-*elf*)				fmt=elf em=hppa ;;
207  hppa-*-lites*)			fmt=elf em=hppa ;;
208  hppa-*-netbsd*)			fmt=elf em=nbsd ;;
209  hppa-*-openbsd*)			fmt=elf em=hppa ;;
210  hppa-*-osf*)				fmt=som em=hppa ;;
211  hppa-*-hpux11*)
212    case ${cpu} in
213      hppa*64*)				fmt=elf em=hppa64 ;;
214      hppa*)				fmt=som em=hppa ;;
215    esac ;;
216  hppa-*-hpux*)				fmt=som em=hppa ;;
217  hppa-*-mpeix*)			fmt=som em=hppa ;;
218  hppa-*-bsd*)				fmt=som em=hppa ;;
219  hppa-*-hiux*)				fmt=som em=hppa ;;
220
221  h8300-*-elf)				fmt=elf ;;
222  h8300-*-linux*)			fmt=elf em=linux ;;
223
224  i386-*-beospe*)			fmt=coff em=pe ;;
225  i386-*-beos*)				fmt=elf ;;
226  i386-*-elfiamcu)			fmt=elf arch=iamcu ;;
227  i386-*-elf*)				fmt=elf ;;
228  i386-*-fuchsia*)			fmt=elf ;;
229  i386-*-haiku*)			fmt=elf em=haiku ;;
230  i386-*-genode*)			fmt=elf ;;
231  i386-*-bsd*)				fmt=aout em=386bsd ;;
232  i386-*-netbsd*-gnu* | \
233  i386-*-knetbsd*-gnu | \
234  i386-*-netbsd* | \
235  i386-*-openbsd*)			fmt=elf em=nbsd ;;
236  i386-*-linux-*)			fmt=elf em=linux
237    case ${cpu}-${os} in
238      x86_64*-linux-gnux32)		arch=x86_64:32 ;;
239    esac ;;
240  i386-*-lynxos*)			fmt=elf em=lynx ;;
241  i386-*-redox*)			fmt=elf ;;
242  i386-*-solaris*)			fmt=elf em=solaris ;;
243  i386-*-freebsd* \
244  | i386-*-kfreebsd*-gnu)		fmt=elf em=freebsd ;;
245  i386-*-msdosdjgpp* \
246  | i386-*-go32*)			fmt=coff em=go32 ;;
247  i386-*-gnu*)				fmt=elf em=gnu ;;
248  i386-*-msdos*)			fmt=aout ;;
249  i386-*-moss*)				fmt=elf ;;
250  i386-*-pe)				fmt=coff em=pe ;;
251  i386-*-cygwin*)
252   case ${cpu} in
253     x86_64*)				fmt=coff em=pep ;;
254     i*)				fmt=coff em=pe ;;
255   esac ;;
256  i386-*-interix*)			fmt=coff em=interix ;;
257  i386-*-mingw*)
258    case ${cpu} in
259      x86_64*)				fmt=coff em=pep ;;
260      i*)				fmt=coff em=pe ;;
261    esac ;;
262  i386-*-nto-qnx*)			fmt=elf ;;
263  i386-*-*nt*)				fmt=coff em=pe ;;
264  i386-*-rdos*)				fmt=elf ;;
265  i386-*-darwin*)			fmt=macho ;;
266
267  ia16-*-elf*)				fmt=elf ;;
268
269  ia64-*-elf*)				fmt=elf ;;
270  ia64-*-*vms*)				fmt=elf em=vms ;;
271  ia64-*-aix*)				fmt=elf em=ia64aix ;;
272  ia64-*-linux-*)			fmt=elf em=linux ;;
273  ia64-*-hpux*)				fmt=elf em=hpux ;;
274  ia64-*-netbsd*)			fmt=elf em=nbsd ;;
275
276  ip2k-*-*)				fmt=elf ;;
277
278  iq2000-*-elf)				fmt=elf ;;
279
280  lm32-*-*)				fmt=elf ;;
281
282  loongarch*)				fmt=elf ;;
283
284  m32c-*-elf)				fmt=elf ;;
285
286  m32r-*-elf*)				fmt=elf ;;
287  m32r-*-linux*)			fmt=elf em=linux;;
288
289  m68hc11-*-* | m6811-*-*)		fmt=elf ;;
290  m68hc12-*-* | m6812-*-*)		fmt=elf ;;
291
292  m68k-*-elf*)				fmt=elf ;;
293  m68k-*-sysv4*)			fmt=elf em=svr4 ;;
294  m68k-*-linux-*)			fmt=elf em=linux ;;
295  m68k-*-uclinux*)			fmt=elf em=uclinux ;;
296  m68k-*-gnu*)				fmt=elf ;;
297  m68k-*-netbsd*)			fmt=elf em=nbsd ;;
298  m68k-*-haiku*)			fmt=elf em=haiku ;;
299
300  s12z-*-*)				fmt=elf ;;
301
302  mep-*-elf)				fmt=elf ;;
303
304  metag-*-elf)				fmt=elf ;;
305  metag-*-linux*)			fmt=elf em=linux ;;
306
307  mcore-*-elf)				fmt=elf ;;
308  mcore-*-pe)				fmt=coff em=pe bfd_gas=yes ;;
309
310  microblaze-*-*)			fmt=elf ;;
311
312  mips-*-irix6*)			fmt=elf em=irix ;;
313  mips-*-irix5*)			fmt=elf em=irix ;;
314  mips*-*-linux*)			fmt=elf em=tmips ;;
315  mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
316					fmt=elf em=freebsd ;;
317  mips-*-sysv4* | mips-*-gnu*)		fmt=elf em=tmips ;;
318  mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
319					fmt=elf em=tmips ;;
320  mips-*-haiku*)			fmt=elf em=haiku ;;
321  mips-*-elf*)				fmt=elf ;;
322  mips-*-netbsd*)			fmt=elf em=tmips ;;
323  mips-*-openbsd*)			fmt=elf em=tmips ;;
324  mips-*-windiss)			fmt=elf ;;
325
326  mmix-*-*)				fmt=elf ;;
327
328  mn10200-*-*)				fmt=elf ;;
329
330  # cpu_type for am33_2.0 is set to mn10300
331  mn10300-*-linux*)			fmt=elf em=linux ;;
332  mn10300-*-*)				fmt=elf ;;
333
334  moxie-*-uclinux)			fmt=elf em=linux ;;
335  moxie-*-moxiebox*)                    fmt=elf endian=little ;;
336  moxie-*-*)				fmt=elf ;;
337    
338  mt-*-elf)				fmt=elf bfd_gas=yes ;;
339
340  msp430-*-*)				fmt=elf ;;
341
342  nds32-*-elf*)				fmt=elf ;;
343  nds32-*-linux*)			fmt=elf em=linux ;;
344
345  nios2*-linux*)			fmt=elf em=linux ;;
346
347  ns32k-pc532-mach*)			fmt=aout em=pc532mach ;;
348  ns32k-pc532-ux*)			fmt=aout em=pc532mach ;;
349  ns32k-pc532-lites*)			fmt=aout em=nbsd532 ;;
350  ns32k-*-*n*bsd*)			fmt=aout em=nbsd532 ;;
351
352  or1k*-*-elf | or1k*-*-rtems*) 	fmt=elf endian=big ;;
353  or1k*-*-linux*)			fmt=elf em=linux endian=big ;;
354  or1k-*-netbsd*)			fmt=elf em=nbsd ;;
355
356  pj*)					fmt=elf ;;
357
358  ppc-*-aix5.[01])			fmt=coff em=aix5 ;;
359  ppc-*-aix[5-9].*)			fmt=coff em=aix5 ;;
360  ppc-*-aix*)				fmt=coff em=aix ;;
361  ppc-*-beos*)				fmt=coff ;;
362  ppc-*-*n*bsd* | ppc-*-elf*)		fmt=elf ;;
363  ppc-*-eabi* | ppc-*-sysv4*)		fmt=elf ;;
364  ppc-*-haiku*)				fmt=elf em=haiku ;;
365  ppc-*-linux-*)			fmt=elf em=linux ;;
366  ppc-*-solaris*)			fmt=elf em=solaris ;;
367  ppc-*-macos*)				fmt=coff em=macos ;;
368  ppc-*-nto*)				fmt=elf ;;
369  ppc-*-kaos*)				fmt=elf ;;
370
371  pru-*-*)				fmt=elf ;;
372
373  riscv*-*-haiku*)			fmt=elf endian=little em=haiku ;;
374  riscv*-*-*)				fmt=elf ;;
375
376  rx-*-linux*)				fmt=elf em=linux ;;
377
378  s390-*-linux-*)			fmt=elf em=linux ;;
379  s390-*-tpf*)				fmt=elf ;;
380
381  score-*-elf)				fmt=elf ;;
382
383  sh*-*-linux*)				fmt=elf em=linux
384    case ${cpu} in
385      sh*eb)	endian=big ;;
386      *)	endian=little ;;
387    esac ;;
388  sh*-*-netbsd*)			fmt=elf em=nbsd
389    case ${cpu} in
390      sh*l*)	endian=little ;;
391      *)	endian=big ;;
392    esac ;;
393  sh-*-elf*)				fmt=elf ;;
394  sh-*-uclinux* | sh[12]-*-uclinux*)	fmt=elf em=uclinux ;;
395  sh-*-coff*)				fmt=coff ;;
396  sh-*-nto*)				fmt=elf ;;
397  sh-*-pe*)				fmt=coff em=pe endian=little ;;
398  sh-*-kaos*)				fmt=elf ;;
399  shle*-*-kaos*)			fmt=elf ;;
400
401  sparc-*-haiku*)			fmt=elf em=haiku ;;
402  sparc-*-linux-*)			fmt=elf em=linux ;;
403  sparc-*-solaris*)			fmt=elf em=solaris ;;
404  sparc-*-freebsd*)			fmt=elf em=freebsd ;;
405  sparc-*-*bsd*)			fmt=elf em=nbsd ;;
406
407  spu-*-elf)				fmt=elf ;;
408
409  tic30-*-*coff*)			fmt=coff bfd_gas=yes ;;
410  tic4x-*-* | c4x-*-*)			fmt=coff bfd_gas=yes ;;
411  tic54x-*-* | c54x*-*-*)		fmt=coff bfd_gas=yes need_libm=yes;;
412  tic6x-*-*)				fmt=elf ;;
413
414  tilepro-*-* | tilegx*-*-*)		fmt=elf ;;
415
416  v850*-*-*)				fmt=elf ;;
417
418  vax-*-netbsdaout)			fmt=aout em=nbsd ;;
419  vax-*-netbsd*)			fmt=elf em=nbsd ;;
420  vax-*-linux-*)			fmt=elf em=linux ;;
421
422  visium-*-elf)				fmt=elf ;;
423
424  wasm32-*-*)                           fmt=elf ;;
425
426  xstormy16-*-*)			fmt=elf ;;
427  
428  xgate-*-*)    			fmt=elf ;;
429
430  xtensa*-*-*)				fmt=elf ;;
431
432  z80-*-coff)				fmt=coff ;;
433
434  z8k-*-coff | z8k-*-sim)		fmt=coff ;;
435
436  *-*-aout | *-*-scout)			fmt=aout ;;
437  *-*-cloudabi*)			fmt=elf em=cloudabi ;;
438  *-*-dragonfly*)			fmt=elf em=dragonfly ;;
439  *-*-freebsd* | *-*-kfreebsd*-gnu)	fmt=elf em=freebsd ;;
440  *-*-generic)				fmt=generic ;;
441  *-*-xray | *-*-hms)			fmt=coff ;;
442  *-*-sim)				fmt=coff ;;
443  *-*-elf | *-*-rtems* | *-*-sysv4*)	fmt=elf ;;
444  *-*-solaris*)				fmt=elf em=solaris ;;
445  *-*-aros*)				fmt=elf em=linux ;;
446  *-*-vxworks* | *-*-windiss)		fmt=elf em=vxworks ;;
447esac
448
449case ${cpu_type} in
450  aarch64 | alpha | arm | csky | i386 | ia64 | microblaze | mips | ns32k | \
451  or1k | or1knd | pdp11 | ppc | riscv | sh | sparc | z80 | z8k | loongarch)
452    bfd_gas=yes
453    ;;
454esac
455case ${fmt} in
456  elf | ecoff | fdpicelf | multi | som)
457    bfd_gas=yes
458    ;;
459esac
460
461if test $bfd_gas != yes; then
462  echo This target is no longer supported in gas
463  exit 1
464fi
465
466case ${cpu_type}-${fmt}-${os} in
467i386-elf-linux*)
468  # Default to compress DWARF debug sections for Linux/x86.
469  if test ${ac_default_compressed_debug_sections} = unset; then
470    ac_default_compressed_debug_sections=yes
471  fi
472  ;;
473esac
474