configure.tgt revision 1.46
1# configure.tgt
2#
3#   Copyright (C) 2013-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# This is the linker target specific file.  This is invoked by the
20# autoconf generated configure script.  Putting it in a separate shell
21# file lets us skip running autoconf when modifying target specific
22# information.
23
24# This file switches on the shell variable ${targ}, and sets the
25# following shell variables:
26#  targ_emul		name of linker emulation to use
27#  targ_extra_emuls	additional linker emulations to provide
28#  targ_extra_libpath	additional linker emulations using LIB_PATH
29#  targ_extra_ofiles	additional host-compiled objects needed by the emulation
30#  targ64_extra_emuls	additional linker emulations to provide if
31#			--enable-64-bit-bfd is given or if host is 64 bit.
32#  targ64_extra_libpath	additional linker emulations using LIB_PATH if
33#			--enable-64-bit-bfd is given or if host is 64 bit.
34#  NATIVE_LIB_DIRS	library directories to search on this host
35#			(if we are a native or sysrooted linker)
36
37targ_extra_emuls=
38targ_extra_libpath=
39targ_extra_ofiles="ldelf.o ldelfgen.o"
40targ64_extra_emuls=
41targ64_extra_libpath=
42
43# By default the linker will generate warnings if it is creating an
44# executable stack or a segment with all three of read, write and
45# execute permissions.  These settings are not appropriate for all
46# targets however, so we can change them here:
47
48if test "${ac_default_ld_warn_rwx_segments}" = unset; then
49  case "${targ}" in
50      # The CRIS default linker script yields just one segment
51      # as intended, so a rwx segment warning is not helpful.
52      # The HPPA's and SPARC's PLT sections use a constructed trampoline
53      # hence it needs to have a RWX segment.
54      # Many MIPS targets use executable segments.
55    cris-*-* | crisv32-*-* | \
56    hppa*-*-* | \
57    mips*-*-* | \
58    sparc*-*-*)
59      ac_default_ld_warn_rwx_segments=0
60      ;;
61    *)
62      ;;
63  esac
64fi
65
66if test "${ac_default_ld_warn_execstack}" = 2; then
67  case "${targ}" in
68      # The HPPA port needs to support older kernels that
69      # use executable stacks for signals and syscalls.
70      # Many MIPS targets use executable stacks.
71    hppa*-*-* | \
72    mips*-*-*)
73      ac_default_ld_warn_execstack=0
74      ;;
75    *)
76      ;;
77  esac
78fi
79
80# Please try to keep this table more or less in alphabetic order - it
81# makes it much easier to lookup a specific archictecture.
82case "${targ}" in
83aarch64_be-*-netbsd*)	targ_emul=aarch64nbsdb
84			targ_extra_emuls="aarch64nbsd aarch64elfb aarch64elf armelfb_nbsd_eabihf armelf_nbsd_eabihf armelfb_nbsd_eabi armelf_nbsd_eabi armelfb_nbsd armelf_nbsd armelf armelfb"
85			;;
86aarch64_be-*-elf)	targ_emul=aarch64elfb
87			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf"
88			;;
89aarch64-*-netbsd*)	targ_emul=aarch64nbsd
90			targ_extra_emuls="aarch64nbsdb aarch64elf aarch64elfb armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf armelfb"
91			;;
92aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
93			targ_emul=aarch64elf
94			targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb"
95			;;
96aarch64-*-cloudabi*)	targ_emul=aarch64cloudabi
97			targ_extra_emuls=aarch64cloudabib
98			;;
99aarch64-*-freebsd*)	targ_emul=aarch64fbsd
100			targ_extra_emuls="aarch64fbsdb aarch64elf"
101			;;
102aarch64-*-fuchsia*)	targ_emul=aarch64elf
103			targ_extra_emuls="aarch64elfb armelf armelfb"
104			;;
105aarch64_be-*-linux-gnu_ilp32)
106			targ_emul=aarch64linux32b
107			targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi"
108			targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath"
109			;;
110aarch64-*-linux-gnu_ilp32)
111			targ_emul=aarch64linux32
112			targ_extra_libpath="aarch64linux aarch64linuxb aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
113			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath"
114			;;
115aarch64_be-*-linux*)	targ_emul=aarch64linuxb
116			targ_extra_libpath="aarch64linux aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
117			targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath"
118			;;
119aarch64-*-linux*)	targ_emul=aarch64linux
120			targ_extra_libpath="aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
121			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath"
122			;;
123aarch64-*-haiku*)	targ_emul=aarch64haiku
124			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb armelf_haiku $targ_extra_libpath"
125			;;
126alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
127			targ_emul=elf64alpha_fbsd
128			targ_extra_emuls="elf64alpha alpha"
129			tdir_alpha=`echo ${targ_alias} | sed -e 's/freebsd/freebsdecoff/'`
130			;;
131alpha*-*-linux*ecoff*)	targ_emul=alpha
132			targ_extra_emuls=elf64alpha
133			tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'`
134			;;
135alpha*-*-linux-*)	targ_emul=elf64alpha
136			targ_extra_emuls=alpha
137			tdir_alpha=`echo ${targ_alias} | sed -e 's/linux\(-gnu\)*/linux\1ecoff/'`
138			;;
139alpha*-*-osf*)		targ_emul=alpha
140			targ_extra_ofiles=
141			;;
142alpha*-*-gnu*)		targ_emul=elf64alpha
143			;;
144alpha*-*-netbsd*)	targ_emul=elf64alpha_nbsd
145			;;
146alpha*-*-openbsd*)	targ_emul=elf64alpha
147			;;
148alpha*-*-*vms*)		targ_emul=alphavms
149			targ_extra_ofiles=
150			;;
151am33_2.0-*-linux*)	targ_emul=elf32am33lin # mn10300 variant
152			;;
153arc*-*-elf*)		targ_emul=arcelf
154			targ_extra_emuls="arclinux arclinux_nps arcv2elf arcv2elfx"
155			;;
156arc*-*-linux*)		case "${with_cpu}" in
157			nps400)	targ_emul=arclinux_nps
158				targ_extra_emuls=arclinux
159				;;
160			*)	targ_emul=arclinux
161				targ_extra_emuls=arclinux_nps
162				;;
163			esac
164			targ_extra_emuls="${targ_extra_emuls} arcelf arcv2elf arcv2elfx"
165			;;
166arm*-*-cegcc*)		targ_emul=arm_wince_pe
167			targ_extra_ofiles="deffilep.o pe-dll.o"
168			LIB_PATH='${tooldir}/lib/w32api'
169			;;
170arm-wince-pe | arm-*-wince | arm*-*-mingw32ce*)
171			targ_emul=arm_wince_pe
172			targ_extra_ofiles="deffilep.o pe-dll.o"
173			;;
174arm-*-pe)		targ_emul=armpe
175			targ_extra_ofiles="deffilep.o pe-dll.o"
176			;;
177arm*b-*-freebsd*)	targ_emul=armelfb_fbsd
178			targ_extra_emuls="armelf_fbsd armelf"
179			;;
180arm*-*-freebsd* | arm-*-kfreebsd*-gnu)
181			targ_emul=armelf_fbsd
182			targ_extra_emuls="armelfb_fbsd armelf"
183			;;
184arm*eb-*-netbsd*-*eabihf*)
185			targ_emul=armelfb_nbsd_eabihf
186			targ_extra_emuls="armelf_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf"
187			;;
188arm*eb-*-netbsd*-*eabi*)
189			targ_emul=armelfb_nbsd_eabi
190			targ_extra_emuls="armelf_nbsd_eabi armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd armelfb_nbsd armelf"
191			;;
192arm*-*-netbsd*-*eabihf*)
193			targ_emul=armelf_nbsd_eabihf
194			targ_extra_emuls="armelfb_nbsd_eabihf armelf_nbsd_eabi armelfb_nbsd_eabi armelf_nbsd armelfb_nbsd armelf"
195			;;
196arm*-*-netbsd*-*eabi*)
197			targ_emul=armelf_nbsd_eabi
198			targ_extra_emuls="armelfb_nbsd_eabi armelf_nbsd_eabihf armelfb_nbsd_eabihf armelf_nbsd armelfb_nbsd armelf"
199			;;
200arm*eb-*-netbsd*)	targ_emul=armelfb_nbsd
201			targ_extra_emuls="armelf_nbsd armelf"
202			;;
203arm*-*-netbsd*)		targ_emul=armelf_nbsd
204 			targ_extra_emuls="armelfb_nbsd armelf"
205 			;;
206arm-*-nto*)		targ_emul=armnto
207			;;
208arm-*-phoenix*)		targ_emul=armelf
209			;;
210armeb-*-elf | armeb-*-eabi*)
211			targ_emul=armelfb
212			;;
213arm-*-elf | arm*-*-eabi* | arm-*-rtems* | arm-*-genode*)
214			targ_emul=armelf
215			;;
216arm-*-kaos*)		targ_emul=armelf
217			;;
218arm9e-*-elf)		targ_emul=armelf
219			;;
220arm*b-*-linux-*eabi*)	targ_emul=armelfb_linux_eabi
221			targ_extra_emuls=armelf_linux_eabi
222			targ_extra_libpath=$targ_extra_emuls
223			;;
224arm*b-*-linux-*)	targ_emul=armelfb_linux
225			targ_extra_emuls="armelfb armelf armelf_linux"
226			targ_extra_libpath="armelf_linux"
227			;;
228arm*-*-linux-*eabi*)	targ_emul=armelf_linux_eabi
229			targ_extra_emuls="armelfb_linux_eabi"
230			targ_extra_libpath=$targ_extra_emuls
231			;;
232arm*-*-uclinuxfdpiceabi)
233			targ_emul=armelf_linux_eabi
234			targ_extra_emuls="armelfb_linux_eabi armelf_linux_fdpiceabi armelfb_linux_fdpiceabi"
235			targ_extra_libpath=$targ_extra_emuls
236			;;
237arm*-*-linux-*)		targ_emul=armelf_linux
238			targ_extra_emuls="armelf armelfb armelfb_linux"
239			targ_extra_libpath="armelfb_linux"
240			;;
241arm*b-*-nacl*)		targ_emul=armelfb_nacl
242			targ_extra_emuls="armelf_nacl"
243			targ_extra_libpath=$targ_extra_emuls
244			;;
245arm*-*-nacl*)		targ_emul=armelf_nacl
246			targ_extra_emuls="armelfb_nacl"
247			targ_extra_libpath=$targ_extra_emuls
248			;;
249arm*-*-uclinux*eabi*)	targ_emul=armelf_linux_eabi
250			targ_extra_emuls=armelfb_linux_eabi
251			targ_extra_libpath=$targ_extra_emuls
252			;;
253arm*-*-uclinux*)	targ_emul=armelf_linux
254			targ_extra_emuls="armelf armelfb armelfb_linux"
255			targ_extra_libpath="armelfb_linux"
256			;;
257arm-*-vxworks)		targ_emul=armelf_vxworks
258			;;
259arm*-*-conix*)		targ_emul=armelf
260			;;
261arm*-*-fuchsia*)	targ_emul=armelf_fuchsia
262			targ_extra_emuls="armelfb_fuchsia armelf armelfb"
263			;;
264arm*-*-haiku*)		targ_emul=armelf_haiku
265			targ_extra_emuls=armelf
266			;;
267avr-*-*)		targ_emul=avr2
268			targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny"
269			;;
270bfin-*-elf | bfin-*-rtems*)
271			targ_emul=elf32bfin
272			targ_extra_emuls="elf32bfinfd"
273			targ_extra_libpath=$targ_extra_emuls
274			;;
275bfin-*-uclinux*)	targ_emul=elf32bfin;
276			targ_extra_emuls="elf32bfinfd"
277			targ_extra_libpath=$targ_extra_emuls
278			;;
279bfin-*-linux-uclibc*)	targ_emul=elf32bfinfd;
280			targ_extra_emuls="elf32bfin"
281			targ_extra_libpath=$targ_extra_emuls
282			;;
283bpf-*-*)		targ_emul=elf64bpf
284			;;
285cr16-*-elf*)		targ_emul=elf32cr16
286			;;
287cris-*-*aout*)		targ_emul=crisaout
288			targ_extra_emuls="criself crislinux"
289			targ_extra_libpath=$targ_extra_emuls
290			;;
291cris-*-linux-* | crisv32-*-linux-*)
292			targ_emul=crislinux
293			;;
294cris-*-* | crisv32-*-*)	targ_emul=criself
295			targ_extra_emuls="crisaout crislinux"
296			targ_extra_libpath=$targ_extra_emuls
297			;;
298crx-*-elf*)		targ_emul=elf32crx
299			;;
300
301csky-*-elf*)		targ_emul=cskyelf
302			;;
303csky-*-linux*)		targ_emul=cskyelf_linux
304			;;
305
306d10v-*-*)		targ_emul=d10velf
307			;;
308d30v-*-*ext*)		targ_emul=d30v_e
309			targ_extra_emuls="d30velf d30v_o"
310			targ_extra_ofiles=ldelfgen.o
311			;;
312d30v-*-*onchip*)	targ_emul=d30v_o
313			targ_extra_emuls="d30velf d30v_e"
314			targ_extra_ofiles=ldelfgen.o
315			;;
316d30v-*-*)		targ_emul=d30velf
317			targ_extra_emuls="d30v_e d30v_o"
318			targ_extra_ofiles=ldelfgen.o
319			;;
320dlx-*-elf*)		targ_emul=elf32_dlx
321			targ_extra_ofiles=ldelfgen.o
322			;;
323epiphany-*-*)		targ_emul=elf32epiphany
324			targ_extra_emuls="elf32epiphany_4x4"
325			;;
326fido*-*-elf*)		targ_emul=m68kelf
327			;;
328fr30-*-*)		targ_emul=elf32fr30
329			targ_extra_ofiles=ldelfgen.o
330			;;
331frv-*-*linux*)		targ_emul=elf32frvfd
332			;;
333frv-*-*)		targ_emul=elf32frv
334			targ_extra_emuls="elf32frvfd"
335			;;
336ft32-*-*)		targ_emul=elf32ft32
337			targ_extra_ofiles=ldelfgen.o
338			;;
339h8300-*-elf* | h8300-*-rtems*)
340			targ_emul=h8300elf;
341			targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf"
342			;;
343h8300-*-linux*)
344			targ_emul=h8300elf_linux;
345			targ_extra_emuls="h8300helf_linux h8300self_linux h8300sxelf_linux"
346			;;
347hppa*64*-*-linux-*)	targ_emul=hppa64linux
348			;;
349hppa*64*-hpux*)		targ_emul=elf64hppa
350			;;
351hppa*-*-linux-*)	targ_emul=hppalinux
352			;;
353hppa*-*-*elf*)		targ_emul=hppaelf
354			;;
355hppa*-*-lites*)		targ_emul=hppaelf
356			;;
357hppa*-*-netbsd*)	targ_emul=hppanbsd
358			;;
359hppa*-*-openbsd*)	targ_emul=hppaobsd
360			;;
361i[3-7]86-*-nto-qnx*)	targ_emul=i386nto
362			;;
363i[3-7]86-*-go32)	targ_emul=i386go32
364			targ_extra_ofiles=
365			;;
366i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32
367			targ_extra_ofiles=
368			;;
369i[3-7]86-*-lynxos*)	targ_emul=i386lynx
370			;;
371i[3-7]86-*-aros*)	targ_emul=elf_i386
372			targ_extra_emuls=elf_iamcu
373			;;
374i[3-7]86-*-rdos*)	targ_emul=elf_i386
375			targ_extra_emuls=elf_iamcu
376			;;
377i[3-7]86-*-bsd)		targ_emul=i386bsd
378			targ_extra_ofiles=
379			;;
380i[3-7]86-*-bsd386)	targ_emul=i386bsd
381			targ_extra_ofiles=
382			;;
383i[3-7]86-*-bsdi*)	targ_emul=i386bsd
384			targ_extra_ofiles=
385			;;
386i[3-7]86-*-linux-*)	targ_emul=elf_i386
387			targ_extra_emuls="elf_iamcu"
388			targ64_extra_emuls="elf_x86_64 elf32_x86_64"
389			targ64_extra_libpath="elf_x86_64 elf32_x86_64"
390			;;
391i[3-7]86-*-redox*)	targ_emul=elf_i386
392			targ_extra_emuls=elf_x86_64
393			;;
394i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386
395			targ_extra_emuls=elf_iamcu
396			;;
397i[3-7]86-*-solaris2*)	targ_emul=elf_i386_sol2
398			targ_extra_emuls="elf_i386_ldso elf_i386 elf_iamcu elf_x86_64_sol2 elf_x86_64"
399			targ_extra_libpath=$targ_extra_emuls
400			;;
401i[3-7]86-*-unixware)	targ_emul=elf_i386
402			targ_extra_emuls=elf_iamcu
403			;;
404i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
405			targ_extra_emuls="elf_i386"
406			targ_extra_libpath=$targ_extra_emuls
407			;;
408i[3-7]86-*-netbsdpe*)	targ_emul=i386pe
409			targ_extra_ofiles="deffilep.o pe-dll.o"
410			;;
411i[3-7]86-*-netbsd* | \
412i[3-7]86-*-netbsd*-gnu* | \
413i[3-7]86-*-knetbsd*-gnu | \
414i[3-7]86-*-openbsd*)
415			targ_emul=elf_i386
416			targ_extra_emuls="elf_iamcu"
417			;;
418i[3-7]86-*-elfiamcu)	targ_emul=elf_iamcu
419			targ_extra_emuls=elf_i386
420			;;
421i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
422			targ_emul=elf_i386
423			targ_extra_emuls=elf_iamcu
424			;;
425i[3-7]86-*-dragonfly*)	targ_emul=elf_i386
426			targ_extra_emuls="elf_iamcu i386bsd"
427			;;
428i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
429			targ_emul=elf_i386_fbsd
430			targ_extra_emuls="elf_i386 elf_iamcu i386bsd"
431			;;
432i[3-7]86-*-gnu*)	targ_emul=elf_i386
433			targ_extra_emuls=elf_iamcu
434			;;
435i[3-7]86-*-msdos*)	targ_emul=i386msdos
436			targ_extra_emuls=i386aout
437			targ_extra_ofiles=
438			;;
439i[3-7]86-*-moss*)	targ_emul=i386moss
440			targ_extra_emuls=i386msdos
441			;;
442i[3-7]86-*-winnt*)	targ_emul=i386pe ;
443			targ_extra_ofiles="deffilep.o pe-dll.o"
444			;;
445i[3-7]86-*-pe)		targ_emul=i386pe ;
446			targ_extra_ofiles="deffilep.o pe-dll.o"
447			;;
448i[3-7]86-*-cygwin*)	targ_emul=i386pe ;
449			targ_extra_ofiles="deffilep.o pe-dll.o" ;
450			test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
451			;;
452i[3-7]86-*-mingw32*)	targ_emul=i386pe ;
453			targ_extra_ofiles="deffilep.o pe-dll.o"
454			;;
455i[3-7]86-*-interix*)	targ_emul=i386pe_posix;
456			targ_extra_ofiles="deffilep.o pe-dll.o"
457			;;
458i[3-7]86-*-beospe*)	targ_emul=i386beos
459			targ_extra_ofiles=
460			;;
461i[3-7]86-*-beos*)	targ_emul=elf_i386_be
462			;;
463i[3-7]86-*-haiku*)	targ_emul=elf_i386_haiku
464			;;
465i[3-7]86-*-vxworks*)	targ_emul=elf_i386_vxworks
466			;;
467i[3-7]86-*-chaos)	targ_emul=elf_i386_chaos
468			;;
469ia16-*-elf*)		targ_emul=elf_i386
470			targ_extra_emuls=i386msdos
471			;;
472ia64-*-elf*)		targ_emul=elf64_ia64
473			;;
474ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
475			targ_emul=elf64_ia64_fbsd
476			targ_extra_emuls="elf64_ia64"
477			;;
478ia64-*-netbsd*)		targ_emul=elf64_ia64
479			;;
480ia64-*-linux*)		targ_emul=elf64_ia64
481			;;
482ia64-*-*vms*)		targ_emul=elf64_ia64_vms
483			targ_extra_ofiles=ldelfgen.o
484			;;
485ia64-*-aix*)		targ_emul=elf64_aix
486			;;
487ip2k-*-elf)		targ_emul=elf32ip2k
488			;;
489iq2000-*-elf)		targ_emul=elf32iq2000
490			targ_extra_emuls="elf32iq10"
491			targ_extra_ofiles=ldelfgen.o
492			;;
493lm32-*-*linux*)		targ_emul=elf32lm32fd
494			;;
495lm32-*-*)		targ_emul=elf32lm32
496			targ_extra_emuls="elf32lm32fd"
497			;;
498m32c-*-elf)
499			targ_emul=elf32m32c
500			;;
501m32r*le-*-elf*)		targ_emul=m32rlelf
502			;;
503m32r*-*-elf*)
504			targ_emul=m32relf
505			;;
506m32r*le-*-linux-*)	targ_emul=m32rlelf_linux
507			;;
508m32r*-*-linux-*)	targ_emul=m32relf_linux
509			;;
510m68hc11-*-*|m6811-*-*)	targ_emul=m68hc11elf
511			targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb"
512			;;
513m68hc12-*-*|m6812-*-*)	targ_emul=m68hc12elf
514			targ_extra_emuls="m68hc12elfb m68hc11elf m68hc11elfb"
515			;;
516m68*-*-netbsd*)	targ_emul=m68kelfnbsd
517			;;
518m68*-*-haiku*)		targ_emul=m68kelf
519			;;
520m68*-*-*)		targ_emul=m68kelf
521			;;
522mcore-*-pe)		targ_emul=mcorepe ;
523			targ_extra_ofiles="deffilep.o pe-dll.o"
524			;;
525mcore-*-elf)		targ_emul=elf32mcore
526			;;
527mep-*-elf)		targ_emul=elf32mep
528			;;
529metag-*-*)		targ_emul=elf32metag
530			;;
531microblazeel*-linux*)	targ_emul="elf32mbel_linux"
532			targ_extra_emuls="elf32mb_linux"
533			;;
534microblaze*-linux*)	targ_emul="elf32mb_linux"
535			targ_extra_emuls="elf32mbel_linux"
536			;;
537microblazeel*)		targ_emul=elf32microblazeel
538			targ_extra_emuls=elf32microblaze
539			;;
540microblaze*)		targ_emul=elf32microblaze
541			targ_extra_emuls=elf32microblazeel
542			;;
543mips*-sgi-irix5*)	targ_emul=elf32bsmip
544			;;
545mips*-sgi-irix6*)	targ_emul=elf32bmipn32
546			targ_extra_emuls="elf32bsmip elf64bmip"
547			targ_extra_libpath=$targ_extra_emuls
548			;;
549mips*el-*-haiku*)	targ_emul=elf_mipsel_haiku
550			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
551			;;
552mips64*el-*-netbsd*)	targ_emul=elf32ltsmipn32 	 
553			targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip" 	 
554			targ_extra_libpath=$targ_extra_emuls
555			;;
556mips64*-*-netbsd*)	targ_emul=elf32btsmipn32
557			targ_extra_emuls="elf64ltsmip elf64btsmip elf32btsmip elf32ltsmipn32 elf32ltsmip"
558			targ_extra_libpath=$targ_extra_emuls
559			;;
560mipsn64*el-*-netbsd*)	targ_emul=elf64ltsmip
561			targ_extra_emuls="elf64btsmip elf32ltsmip elf32btsmip elf32btsmipn32 elf32ltsmipn32"
562			targ_extra_libpath=$targ_extra_emuls
563			;; 	 
564mipsn64*-*-netbsd*)	targ_emul=elf64btsmip
565			targ_extra_emuls="elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32"
566			targ_extra_libpath=$targ_extra_emuls
567  			;;
568mips*el-*-netbsd*)	targ_emul=elf32ltsmip
569			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
570			;;
571mips*-*-netbsd*)	targ_emul=elf32btsmip
572			targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
573			;;
574mips64el-*-openbsd*)	targ_emul=elf64ltsmip
575			targ_extra_emuls=elf64btsmip
576			;;
577mips64-*-openbsd*)	targ_emul=elf64btsmip
578			targ_extra_emuls=elf64ltsmip
579			;;
580mips*vr4300el-*-elf*)	targ_emul=elf32l4300
581			;;
582mips*vr4300-*-elf*)	targ_emul=elf32b4300
583			;;
584mips*vr4100el-*-elf*)	targ_emul=elf32l4300
585			;;
586mips*vr4100-*-elf*)	targ_emul=elf32b4300
587			;;
588mips*vr5000el-*-elf*)	targ_emul=elf32l4300
589			;;
590mips*vr5000-*-elf*)	targ_emul=elf32b4300
591			;;
592mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
593			targ_emul=elf32ltsmip
594			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
595			;;
596mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
597			targ_emul=elf32btsmip
598			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
599			;;
600mips64*el-ps2-elf*)	targ_emul=elf32lr5900n32
601			targ_extra_emuls="elf32lr5900"
602			targ_extra_libpath=$targ_extra_emuls
603			;;
604mips*el-ps2-elf*)	targ_emul=elf32lr5900
605			targ_extra_emuls="elf32lr5900n32"
606			targ_extra_libpath=$targ_extra_emuls
607			;;
608mips*el-*-elf*)		targ_emul=elf32elmip
609			;;
610mips*-*-elf* | mips*-*-rtems*)
611			targ_emul=elf32ebmip
612			;;
613mips*el-*-vxworks*)	targ_emul=elf32elmipvxworks
614			targ_extra_emuls="elf32ebmipvxworks"
615			;;
616mips*-*-vxworks*)	targ_emul=elf32ebmipvxworks
617			targ_extra_emuls="elf32elmipvxworks"
618			;;
619mips*-*-windiss)	targ_emul=elf32mipswindiss
620			;;
621mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
622			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
623			targ_extra_libpath=$targ_extra_emuls
624			;;
625mips64*-*-linux-*)	targ_emul=elf32btsmipn32
626			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
627			targ_extra_libpath=$targ_extra_emuls
628			;;
629mips*el-*-linux-*)	targ_emul=elf32ltsmip
630			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
631			targ_extra_libpath=$targ_extra_emuls
632			;;
633mips*-*-linux-*)	targ_emul=elf32btsmip
634			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
635			targ_extra_libpath=$targ_extra_emuls
636			;;
637mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
638			targ_emul=elf32ltsmipn32_fbsd
639			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
640			targ_extra_libpath=$targ_extra_emuls
641			;;
642mips64*-*-freebsd* | mips64*-*-kfreebsd*-gnu)
643			targ_emul=elf32btsmipn32_fbsd
644			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
645			targ_extra_libpath=$targ_extra_emuls
646			;;
647mips*el-*-freebsd* | mips*el-*-kfreebsd*-gnu)
648			targ_emul=elf32ltsmip_fbsd
649			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmipn32_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
650			targ_extra_libpath=$targ_extra_emuls
651			;;
652mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
653			targ_emul=elf32btsmip_fbsd
654			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmipn32_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
655			targ_extra_libpath=$targ_extra_emuls
656			;;
657mips*-*-sysv4*)		targ_emul=elf32btsmip
658			;;
659mmix-*-*)		targ_emul=mmo
660			targ_extra_emuls=elf64mmix
661			;;
662mn10200-*-*)		targ_emul=mn10200
663			targ_extra_ofiles=ldelfgen.o
664			;;
665mn10300-*-*)		targ_emul=mn10300
666			;;
667moxie-*-moxiebox*)	targ_emul=moxiebox
668			targ_extra_ofiles=ldelfgen.o
669			;;
670moxie-*-*)		targ_emul=elf32moxie
671			;;
672msp430-*-*)		targ_emul=msp430elf
673			targ_extra_emuls="msp430X"
674			targ_extra_ofiles=ldelfgen.o
675			;;
676mt-*elf)		targ_emul=elf32mt
677			targ_extra_ofiles=ldelfgen.o
678			;;
679nds32*le-*-elf*)	targ_emul=nds32elf
680			targ_extra_emuls="nds32elf16m nds32belf nds32belf16m"
681			;;
682nds32*be-*-elf*)	targ_emul=nds32belf
683			targ_extra_emuls="nds32elf nds32elf16m nds32belf16m"
684			;;
685nds32*le-*-linux-gnu*)	targ_emul=nds32elf_linux
686			;;
687nds32*be-*-linux-gnu*)	targ_emul=nds32belf_linux
688			;;
689nios2*-*-linux*)	targ_emul=nios2linux
690			;;
691nios2*-*-*)		targ_emul=nios2elf
692			;;
693ns32k-pc532-mach* | ns32k-pc532-ux*)  targ_emul=pc532macha
694			targ_extra_ofiles=
695			;;
696ns32k-*-*bsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd
697			targ_extra_ofiles=
698			;;
699or1k-*-elf | or1knd-*-elf | or1k-*-rtems* | or1knd-*-rtems*)
700			targ_emul=elf32or1k
701			;;
702or1k-*-netbsd* | or1knd-*-netbsd*)	targ_emul=elf32or1k_nbsd
703			;;
704or1k-*-linux* | or1knd-*-linux*)	targ_emul=elf32or1k_linux
705			;;
706powerpc-*-netbsd*)
707			targ_emul=elf32ppc_nbsd
708			targ_extra_emuls="elf32ppc elf32ppcsim"
709			targ_extra_libpath=elf32ppc;
710			tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
711			targ64_extra_emuls=elf64ppc
712			targ64_extra_libpath=elf64ppc
713			;;
714powerpc64-*-netbsd*)
715			targ_emul=elf64ppc
716			targ_extra_emuls="elf32ppc elf32ppc_nbsd elf32ppcsim"
717			targ_extra_libpath="elf32ppc_nbsd elf32ppc"
718			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
719			tdir_elf32ppc_fbsd=$tdir_elf32ppc
720			;;
721pdp11-*-*)		targ_emul=pdp11
722			targ_extra_ofiles=
723			;;
724pjl*-*-*)		targ_emul=pjlelf
725			targ_extra_emuls="elf_i386 elf_iamcu"
726			;;
727pj*-*-*)		targ_emul=pjelf
728			targ_extra_ofiles=ldelfgen.o
729			;;
730powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
731			targ_emul=elf32ppc_fbsd
732			targ_extra_emuls="elf32ppc elf32ppcsim"
733			targ_extra_libpath=elf32ppc;
734			tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
735			;;
736powerpc64-*-freebsd*)
737			targ_emul=elf64ppc_fbsd
738			targ_extra_emuls="elf64ppc elf32ppc_fbsd elf32ppc"
739			targ_extra_libpath="elf32ppc_fbsd elf32ppc"
740			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
741			tdir_elf32ppc_fbsd=$tdir_elf32ppc
742			;;
743powerpc64le-*-freebsd*)
744			targ_emul=elf64lppc_fbsd
745			targ_extra_emuls="elf64lppc"
746			;;
747powerpc-*-vxworks*)
748			targ_emul=elf32ppcvxworks
749			targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
750			;;
751powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
752  | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
753  | powerpc*-*-rtems* \
754  | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
755			case "${targ}" in
756			powerpc64*)
757			    targ_emul=elf64ppc
758			    targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
759			    targ_extra_libpath="elf32ppc elf32ppclinux" ;;
760			*linux*)
761			    targ_emul=elf32ppclinux
762			    targ_extra_emuls="elf32ppc elf32ppcsim"
763			    targ_extra_libpath=elf32ppc
764			    targ64_extra_emuls=elf64ppc
765			    targ64_extra_libpath=elf64ppc ;;
766			*)
767			    targ_emul=elf32ppc
768			    targ_extra_emuls="elf32ppclinux elf32ppcsim"
769			    targ_extra_libpath=elf32ppclinux
770			    targ64_extra_emuls=elf64ppc
771			    targ64_extra_libpath=elf64ppc ;;
772			esac
773			td=tdir_elf32ppc
774			td64=tdir_elf64ppc
775			s=s/ppc/lppc/g
776			case "${targ}" in
777			powerpcle-* | powerpc64le-*)
778			    for z in td td64 targ_emul targ_extra_emuls \
779					 targ_extra_libpath targ64_extra_emuls \
780					 targ64_extra_libpath
781			    do
782				eval ${z}=\"\`echo \$${z} \| sed -e $s\`\"
783			    done
784			    s=s/lppc/ppc/g ;;
785			esac
786			# Why oh why did we set tooldir based on target_alias
787			# rather than on target?
788			eval tdir_${targ_emul}="${targ_alias}"
789			cpu=`echo "${targ_alias}" | sed -e 's/-.*//'`
790			rest=`echo "${targ_alias}" | sed -e 's/^[^-]*//'`
791			le=le
792			case "${cpu}" in
793			*little) le=little
794			esac
795			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
796			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}'/;s/be64$/64be/'`"${rest}"
797			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
798			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
799			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
800			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
801			# Now provide the other endian
802			for z in targ_extra_emuls targ_extra_libpath
803			do
804			    eval ${z}=\"\$${z} \`echo ${targ_emul} \$${z} \| sed -e $s\`\"
805			done
806			for z in targ64_extra_emuls targ64_extra_libpath
807			do
808			    eval ${z}=\"\$${z} \`echo \$${z} \| sed -e $s\`\"
809			done
810			td=`echo "${td}" | sed -e $s`
811			td64=`echo "${td64}" | sed -e $s`
812			case "${targ}" in
813			powerpcle-* | powerpc64le-*)
814			    cpu=`echo "${cpu}" | sed -e s/${le}\$//` ;;
815			*)
816			    cpu=`echo "${cpu}" | sed -e s/be\$//`${le} ;;
817			esac
818			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
819			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}/`"${rest}"
820			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
821			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
822			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
823			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
824			;;
825powerpc-*-nto*)		targ_emul=elf32ppcnto
826			;;
827powerpcle-*-nto*)	targ_emul=elf32lppcnto
828			;;
829powerpc-*-macos*)	targ_emul=ppcmacos
830			targ_extra_ofiles=
831			;;
832powerpc-*-aix[5-9]*)	targ_emul=aix5ppc
833			targ_extra_ofiles=
834			;;
835powerpc-*-aix*)		targ_emul=aixppc
836			targ_extra_ofiles=
837			;;
838powerpc-*-beos*)	targ_emul=aixppc
839			targ_extra_ofiles=
840			;;
841powerpc-*-haiku*)	targ_emul=elf32ppchaiku
842			;;
843powerpc-*-windiss*)	targ_emul=elf32ppcwindiss
844			;;
845pru*-*-*)		targ_emul=pruelf
846			;;
847riscv32be*-*-linux* | riscv32be*-*-netbsd*)
848			targ_emul=elf32briscv
849			targ_extra_emuls="elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64"
850			targ_extra_libpath=$targ_extra_emuls
851			;;
852riscv32*-*-linux* | riscv-*-netbsd* | riscv32*-*-netbsd*)
853			targ_emul=elf32lriscv
854			targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64"
855			targ_extra_libpath=$targ_extra_emuls
856			;;
857riscvbe-*-* | riscv32be*-*-*)
858			targ_emul=elf32briscv
859			targ_extra_emuls="elf64briscv elf32lriscv elf64lriscv"
860			targ_extra_libpath=$targ_extra_emuls
861			;;
862riscv-*-* | riscv32*-*-*)
863			targ_emul=elf32lriscv
864			targ_extra_emuls="elf64lriscv elf32briscv elf64briscv"
865			targ_extra_libpath=$targ_extra_emuls
866			;;
867riscv64be*-*-linux* | riscv64be*-*-netbsd*)
868			targ_emul=elf64briscv
869			targ_extra_emuls="elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32"
870			targ_extra_libpath=$targ_extra_emuls
871			;;
872riscv64*-*-linux* | riscv64*-*-netbsd*)
873			targ_emul=elf64lriscv
874			targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32"
875			targ_extra_libpath=$targ_extra_emuls
876			;;
877riscv64be*-*-*)		targ_emul=elf64briscv
878			targ_extra_emuls="elf32briscv elf64lriscv elf32lriscv"
879			targ_extra_libpath=$targ_extra_emuls
880			;;
881riscv64*-*-*)		targ_emul=elf64lriscv
882			targ_extra_emuls="elf32lriscv elf64briscv elf32briscv"
883			targ_extra_libpath=$targ_extra_emuls
884			;;
885rs6000-*-aix[5-9]*)	targ_emul=aix5rs6
886			targ_extra_ofiles=
887			;;
888rs6000-*-aix*)		targ_emul=aixrs6
889			targ_extra_ofiles=
890			;;
891rl78-*-*)		targ_emul=elf32rl78
892			;;
893rx-*-linux*)		targ_emul=elf32rx_linux
894			;;
895rx-*-*)			targ_emul=elf32rx
896			;;
897s12z-*-*)		targ_emul=m9s12zelf
898			targ_extra_ofiles=ldelfgen.o
899			;;
900s390x-*-linux*)		targ_emul=elf64_s390
901			targ_extra_emuls=elf_s390
902			targ_extra_libpath=$targ_extra_emuls
903			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
904			;;
905s390x-*-tpf*)		targ_emul=elf64_s390
906			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
907			;;
908s390-*-linux*)		targ_emul=elf_s390
909			targ64_extra_emuls=elf64_s390
910			targ64_extra_libpath=elf64_s390
911			tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
912			;;
913score-*-elf)		targ_emul=score7_elf
914			targ_extra_emuls=score3_elf
915			;;
916sh-*-linux*)		targ_emul=shlelf_linux
917			targ_extra_emuls="shelf_linux shlelf_fd shelf_fd"
918			targ_extra_libpath=shelf_linux
919			;;
920sh*eb-*-linux*)		targ_emul=shelf_linux
921			targ_extra_emuls="shelf_fd"
922			;;
923sh*-*-linux*)		targ_emul=shlelf_linux
924			targ_extra_emuls="shlelf_fd"
925			;;
926sh*l*-*-netbsdaout*)	targ_emul=shl
927			targ_extra_emuls=sh
928			;;
929sh*-*-netbsdaout*)	targ_emul=sh
930			targ_extra_emuls=shl
931			;;
932sh*l*-*-netbsd*)	targ_emul=shlelf_nbsd
933			targ_extra_emuls=shelf_nbsd
934			;;
935sh*-*-netbsd*)	targ_emul=shelf_nbsd
936			targ_extra_emuls=shlelf_nbsd
937			;;
938shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
939			targ_emul=shlelf
940			targ_extra_emuls="shelf shl sh"
941			;;
942sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*)
943			targ_emul=shelf
944			targ_extra_emuls="shlelf sh shl"
945			;;
946sh-*-uclinux* | sh[12]-*-uclinux*)
947			targ_emul=shelf_uclinux
948			targ_extra_emuls="shelf shlelf sh shl shelf_fd shlelf_fd"
949			;;
950sh-*-vxworks)		targ_emul=shelf_vxworks
951			targ_extra_emuls=shlelf_vxworks
952			;;
953sh-*-nto*)		targ_emul=shelf_nto
954			targ_extra_emuls=shlelf_nto
955			;;
956sh-*-pe)		targ_emul=shpe ;
957			targ_extra_ofiles="deffilep.o pe-dll.o"
958			;;
959sh-*-*)			targ_emul=sh;
960			targ_extra_emuls=shl
961			targ_extra_ofiles=
962			;;
963sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
964			targ_emul=elf64_sparc_fbsd
965			targ_extra_emuls="elf64_sparc elf32_sparc"
966			targ_extra_libpath=$targ_extra_emuls
967			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
968			;;
969sparc64-*-linux-*)	targ_emul=elf64_sparc
970			targ_extra_emuls="elf32_sparc"
971			targ_extra_libpath=elf32_sparc
972			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
973			;;
974sparc64-*-*bsd*)	targ_emul=elf64_sparc
975			targ_extra_emuls="elf32_sparc"
976			;;
977sparc64-*-solaris2* | sparcv9-*-solaris2*)
978			targ_emul=elf64_sparc_sol2
979			targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
980			targ_extra_libpath=$targ_extra_emuls
981			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
982			;;
983sparc64-*-haiku*)	targ_emul=elf64_sparc
984			;;
985sparc64-*-*)		targ_emul=elf64_sparc
986			;;
987sparc*-*-linux-*)	targ_emul=elf32_sparc
988			targ_extra_emuls="elf64_sparc"
989			targ_extra_libpath=elf64_sparc
990			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
991			;;
992sparc64-*-netbsd*)	targ_emul=elf64_sparc
993			targ_extra_emuls="elf32_sparc"
994			;;
995sparc*-*-netbsd*)	targ_emul=elf32_sparc
996			;;
997sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
998			targ_emul=elf32_sparc_sol2
999			targ_extra_emuls=elf32_sparc
1000			;;
1001sparc-*-solaris2*)	targ_emul=elf32_sparc_sol2
1002			targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
1003			targ_extra_libpath=$targ_extra_emuls
1004			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
1005			;;
1006sparc*-*-vxworks*)	targ_emul=elf32_sparc_vxworks
1007			;;
1008sparc*-*-*)		targ_emul=elf32_sparc
1009			;;
1010spu-*-elf*)		targ_emul=elf32_spu
1011			;;
1012tic30-*-*coff*)		targ_emul=tic30coff
1013			targ_extra_ofiles=
1014			;;
1015tic4x-*-* | c4x-*-*)	targ_emul=tic4xcoff
1016			targ_extra_emuls="tic3xcoff tic3xcoff_onchip"
1017			targ_extra_ofiles=
1018			;;
1019tic54x-*-* | c54x*-*-*)	targ_emul=tic54xcoff
1020			targ_extra_ofiles=
1021			;;
1022tic6x-*-elf)		targ_emul=elf32_tic6x_elf_le
1023			targ_extra_emuls="elf32_tic6x_elf_be elf32_tic6x_le elf32_tic6x_be"
1024			targ_extra_libpath=$targ_extra_emuls
1025			;;
1026tic6x-*-uclinux)	targ_emul=elf32_tic6x_linux_le
1027			targ_extra_emuls="elf32_tic6x_linux_be elf32_tic6x_le elf32_tic6x_be"
1028			targ_extra_libpath=$targ_extra_emuls
1029			;;
1030tilegx-*-*)		targ_emul=elf64tilegx
1031			targ_extra_emuls="elf64tilegx_be elf32tilegx elf32tilegx_be"
1032			targ_extra_libpath=$targ_extra_emuls
1033			;;
1034tilegxbe-*-*)		targ_emul=elf64tilegx_be
1035			targ_extra_emuls="elf64tilegx elf32tilegx elf32tilegx_be"
1036			targ_extra_libpath=$targ_extra_emuls
1037			;;
1038tilepro-*-*)		targ_emul=elf32tilepro
1039			;;
1040v850*-*-*)		targ_emul=v850_rh850
1041			targ_extra_emuls=v850
1042			;;
1043vax-*-netbsdaout*)	targ_emul=vaxnbsd
1044			targ_extra_emuls=elf32vax
1045			;;
1046vax-*-netbsd*)		targ_emul=elf32vax
1047			targ_extra_emuls=vaxnbsd
1048			;;
1049vax-*-linux-*)		targ_emul=elf32vax
1050			;;
1051visium-*-elf)		targ_emul=elf32visium
1052			;;
1053x86_64-*-rdos*)		targ_emul=elf64rdos
1054			;;
1055x86_64-*-cloudabi*)	targ_emul=elf_x86_64_cloudabi
1056			;;
1057x86_64-*-haiku*)	targ_emul=elf_x86_64_haiku
1058			targ_extra_emuls="elf_x86_64 elf_i386_haiku"
1059			;;
1060x86_64-*-linux-gnux32)	targ_emul=elf32_x86_64
1061			targ_extra_emuls="elf_x86_64 elf_i386 elf_iamcu"
1062			targ_extra_libpath="elf_i386 elf_iamcu elf_x86_64"
1063			tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
1064			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
1065			;;
1066x86_64-*-linux-*)	targ_emul=elf_x86_64
1067			targ_extra_emuls="elf32_x86_64 elf_i386 elf_iamcu"
1068			targ_extra_libpath="elf_i386 elf32_x86_64"
1069			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1070			;;
1071x86_64-*-redox*)	targ_emul=elf_x86_64
1072			targ_extra_emuls=elf_i386
1073			;;
1074x86_64-*-solaris2*)	targ_emul=elf_x86_64_sol2
1075			targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
1076			targ_extra_libpath=$targ_extra_emuls
1077			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1078			;;
1079x86_64-*-netbsd* | x86_64-*-openbsd*)
1080			targ_emul=elf_x86_64
1081			targ_extra_emuls="elf_i386 elf_iamcu"
1082			tdir_elf_iamcu=`echo ${targ_alias} | \
1083			    sed -e 's/x86_64/i386/' -e 's/aout//'`
1084			tdir_elf_i386=`echo ${targ_alias} | \
1085			    sed -e 's/x86_64/i386/' -e 's/aout//'`
1086			;;
1087x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
1088			targ_emul=elf_x86_64
1089			targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64"
1090			targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64"
1091			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1092			;;
1093x86_64-*-dragonfly*)	targ_emul=elf_x86_64
1094			targ_extra_emuls="elf_i386 elf_iamcu"
1095			;;
1096x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
1097			targ_emul=elf_x86_64_fbsd
1098			targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu"
1099			targ_extra_libpath="elf_i386_fbsd"
1100			tdir_elf_i386_fbsd=`echo ${targ_alias} \
1101			    | sed -e 's/x86_64/i386/'`
1102			tdir_elf_iamcu=`echo ${targ_alias} \
1103			    | sed -e 's/x86_64/i386/'`
1104			tdir_elf_i386=`echo ${targ_alias} \
1105			    | sed -e 's/x86_64/i386/'`
1106			;;
1107x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
1108			targ_extra_emuls=i386pe ;
1109			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1110			;;
1111x86_64-*-cygwin)	targ_emul=i386pep ;
1112			targ_extra_emuls=i386pe
1113			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1114			test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
1115			;;
1116x86_64-*-mingw*)	targ_emul=i386pep ;
1117			targ_extra_emuls=i386pe
1118			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1119			;;
1120xgate-*-*)		targ_emul=xgateelf
1121			targ_extra_ofiles=ldelfgen.o
1122			;;
1123xstormy16-*-*)		targ_emul=elf32xstormy16
1124			;;
1125xtensa*-*-*)		targ_emul=elf32xtensa
1126			;;
1127z80-*-elf*)		targ_emul=elf32z80
1128			targ_extra_ofiles="ldelf.o ldelfgen.o"
1129			;;
1130z80-*-coff)		targ_emul=z80
1131			targ_extra_ofiles=
1132			;;
1133z8k-*-coff)		targ_emul=z8002
1134			targ_extra_emuls=z8001
1135			targ_extra_ofiles=
1136			;;
1137loongarch32-*)		targ_emul=elf32loongarch
1138			;;
1139loongarch64-*)		targ_emul=elf64loongarch
1140			;;
1141*-*-ieee*)		targ_emul=vanilla
1142			targ_extra_ofiles=
1143			;;
1144*)
1145  echo 2>&1 "*** ld does not support target ${targ}"
1146  echo 2>&1 "*** see ld/configure.tgt for supported targets"
1147  exit 1
1148
1149esac
1150
1151NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
1152case "${target}" in
1153
1154*-*-dragonfly*)
1155  NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
1156  ;;
1157
1158*-*-freebsd*)
1159  NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
1160  ;;
1161
1162hppa*64*-*-hpux11*)
1163  NATIVE_LIB_DIRS=/usr/lib/pa20_64
1164  ;;
1165
1166i[3-7]86-*-sysv4*)
1167  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1168  ;;
1169
1170i[3-7]86-*-solaris*)
1171  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1172  ;;
1173
1174i[3-7]86-pc-interix*)
1175  NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
1176  ;;
1177
1178ia64-*-aix*)
1179  NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
1180  ;;
1181
1182sparc*-*-solaris2*)
1183  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1184  ;;
1185
1186spu-*-elf*)
1187  # This allows one to build a pair of PPU/SPU toolchains with common sysroot.
1188  NATIVE_LIB_DIRS='/lib'
1189  ;;
1190
1191i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
1192  NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
1193  ;;
1194
1195*-*-linux*)
1196  ;;
1197
1198*-*-netbsd*)
1199  ;;
1200
1201alpha*-*-*)
1202  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1203  ;;
1204
1205esac
1206
1207case "${target}" in
1208frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*)
1209  # Don't enable -z relro by default since many relro tests fail on these
1210  # targets:
1211  # FAIL: strip -z relro (relro1)
1212  # FAIL: strip -z relro -shared (relro1)
1213  # FAIL: objcopy -z relro (relro1)
1214  # FAIL: objcopy -z relro -shared (relro1)
1215  # FAIL: objcopy -z relro (tdata1)
1216  # FAIL: objcopy -shared -z relro (tdata1)
1217  # FAIL: objcopy -z relro (tdata2)
1218  # FAIL: objcopy -shared -z relro (tdata2)
1219  # FAIL: objcopy -z relro (tdata3)
1220  # FAIL: objcopy -shared -z relro (tdata3)
1221  # FAIL: objcopy -shared -z relro (tbss1)
1222  # FAIL: objcopy -shared -z relro (tbss2)
1223  # FAIL: objcopy -shared -z relro (tbss3)
1224  ;;
1225*-*-linux*)
1226  if test ${ac_default_ld_z_relro} = unset; then
1227    ac_default_ld_z_relro=1
1228  fi
1229  ;;
1230esac
1231
1232# Enable -z separate-code and --warn-textrel by default for Linux/x86.
1233case "${target}" in
1234i[3-7]86-*-linux-* | x86_64-*-linux-* | i[3-7]86-*-netbsd* | x86_64-*-netbsd*)
1235  if test ${ac_default_ld_z_separate_code} = unset; then
1236    ac_default_ld_z_separate_code=1
1237  fi
1238  if test ${ac_default_ld_textrel_check} = unset; then
1239    ac_default_ld_textrel_check=yes
1240  fi
1241  ;;
1242esac
1243